collapse_matrices: Collapse OMEGA or SIGMA matrix lists

collapse_omegaR Documentation

Collapse OMEGA or SIGMA matrix lists

Description

If multiple OMEGA (or SIGMA) blocks were written into the model, these can be collapsed into a single matrix. This will not change the functionality of the model, but will alter how OMEGA (or SIGMA) are updated, usually making it easier. This "collapsing" of the matrix list is irreversible.

Usage

collapse_omega(x, range = NULL, name = NULL)

collapse_sigma(x, range = NULL, name = NULL)

Arguments

x

a model object.

range

numeric vector of length 2 specifying the range of matrices to collapse in case there are more than 2. The second element may be NA to indicate the length of the list of matrices.

name

a new name for the collapsed matrix; note that this is the matrix name, not the labels which alias ETA(n) or EPS(n); specifying a name will only alter how this matrix is potentially updated in the future.

Value

A model object with updated OMEGA or SIGMA matrix lists.

See Also

collapse_matrix()

Examples

code <- '
$OMEGA 1 2 3
$OMEGA 4 5
$OMEGA 6 7 8 9
'

mod <- mcode("collapse-example", code, compile = FALSE)
revar(mod)
collapse_omega(mod) %>% omat()
collapse_omega(mod, range = c(2,3), name = "new_matrix") %>% omat()
collapse_omega(mod, range = c(2,NA), name = "new_matrix") %>% omat()


mrgsolve documentation built on Oct. 18, 2024, 5:12 p.m.