Produces an object that may be used in place of a matrix in the creation of arguments to spec_rescomp().

rescomp_coefs_matrix_custom(func, nrow, ncol)

Arguments

func

A function that takes params (a list of parameters) and returns a matrix.

nrow

The number of rows in the matrix returned by func.

ncol

The number of columns in the matrix returned by func.

Value

S3 object of class rescomp_coefs_matrix.

Examples

# Matrix with one time-varying coefficient
rescomp_coefs_matrix_custom(
  function(params) {
    matrix(c(0.2, 0.3, 0.4, params$fourth_coeff), nrow = 2, ncol = 2)
  },
  nrow = 2, ncol = 2
)
#> $func
#> function (params) 
#> {
#>     matrix(c(0.2, 0.3, 0.4, params$fourth_coeff), nrow = 2, ncol = 2)
#> }
#> <environment: 0x156f958c0>
#> 
#> $dim
#> [1] 2 2
#> 
#> attr(,"class")
#> [1] "rescomp_coefs_matrix_custom" "rescomp_coefs_custom"       
#> [3] "rescomp_coefs_matrix"        "rescomp_coefs"