[Stable]

Manipulate $OMEGA (and $SIGMA) BLOCKs to introduce or remove correlations.

block(iomega, eta_numbers = NA, diag_init = 0.01)

unblock(iomega, eta_numbers)

Arguments

iomega

A tibble output from init_omega() or init_sigma().

eta_numbers

Numeric vector. ETA numbers to put into a block or unblock for block() and unblock(), respectively. Must be contiguous.

diag_init

Numeric. Default value for off diagonal elements.

Value

An nm object with modified ctl_contents field.

Examples



# create example object m1 from package demo files
exdir <- system.file("extdata", "examples", "theopp", package = "NMproject")
m1 <- new_nm(run_id = "m1", 
             based_on = file.path(exdir, "Models", "ADVAN2.mod"),
             data_path = file.path(exdir, "SourceData", "THEOPP.csv"))

io <- m1 %>% init_omega()
io <- io %>% block(c(2, 3))
m1 <- m1 %>% init_omega(io)
m1 %>% dollar("OMEGA") ## to display $OMEGA
#> $`execute.Models/m1`
#>   1| $OMEGA
#>   2| 0.1   ;  IIV_KA ; LOG
#>   3| $OMEGA BLOCK (2)
#>   4| 0.1   ;  IIV_K ; LOG
#>   5| 0.01 0.1   ;  IIV_V ; LOG
#> 


# create example object m1 from package demo files
exdir <- system.file("extdata", "examples", "theopp", package = "NMproject")
m1 <- new_nm(run_id = "m1", 
             based_on = file.path(exdir, "Models", "ADVAN2.mod"),
             data_path = file.path(exdir, "SourceData", "THEOPP.csv"))

## first create a block
io <- m1 %>% init_omega()
io <- io %>% block(c(2, 3))
m1 <- m1 %>% init_omega(io)
m1 %>% dollar("OMEGA") ## to display $OMEGA
#> $`execute.Models/m1`
#>   1| $OMEGA
#>   2| 0.1   ;  IIV_KA ; LOG
#>   3| $OMEGA BLOCK (2)
#>   4| 0.1   ;  IIV_K ; LOG
#>   5| 0.01 0.1   ;  IIV_V ; LOG
#> 

## now unblock
io <- io %>% unblock(c(2, 3))
m1 <- m1 %>% init_omega(io)
m1 %>% dollar("OMEGA") ## to display $OMEGA
#> $`execute.Models/m1`
#>   1| $OMEGA
#>   2| 0.1   ;   IIV_KA ; LOG
#>   3| 0.1
#>   4| 0.1   ;   IIV_K ; LOG
#>   5| 0.01   ;   IIV_V ; LOG
#>