R/glmmTMB.R
getReStruc.RdCalculate random effect structure Calculates number of random effects, number of parameters, block size and number of blocks. Mostly for internal use.
getReStruc(
reTrms,
ss = NULL,
aa = NULL,
reXterms = NULL,
fr = NULL,
full_cor = NULL
)random-effects terms list
a vector of character strings indicating a valid covariance structure (one for each RE term).
Must be one of names(glmmTMB:::.valid_covstruct);
default is to use an unstructured variance-covariance
matrix ("us") for all blocks).
additional arguments (i.e. rank, or var-cov matrix)
terms objects corresponding to each RE term
model frame
compute full correlation matrices? can be either a length-1 logical vector (TRUE/FALSE) to include full correlation matrices for all or none of the random-effect terms in the model, or a logical vector with length equal to the number of correlation matrices, to include/exclude correlation matrices individually
a list
number of variance covariance parameters per term
size (dimension) of one block
number of times the blocks are repeated (levels)
structure code
simulation code; should we "zero" (set to zero/ignore), "fix" (set to existing parameter values), "random" (draw new random deviations)?
logical vector (compute/store full correlation matrix?)
data(sleepstudy, package="lme4")
rt <- lme4::lFormula(Reaction~Days+(1|Subject)+(0+Days|Subject),
sleepstudy)$reTrms
rt2 <- lme4::lFormula(Reaction~Days+(Days|Subject),
sleepstudy)$reTrms
getReStruc(rt)
#> $`1 | Subject`
#> $`1 | Subject`$blockReps
#> [1] 18
#>
#> $`1 | Subject`$blockSize
#> [1] 1
#>
#> $`1 | Subject`$blockNumTheta
#> [1] 1
#>
#> $`1 | Subject`$blockCode
#> us
#> 1
#>
#> $`1 | Subject`$simCode
#> [1] 2
#>
#> $`1 | Subject`$fullCor
#> integer(0)
#>
#>
#> $`0 + Days | Subject`
#> $`0 + Days | Subject`$blockReps
#> [1] 18
#>
#> $`0 + Days | Subject`$blockSize
#> [1] 1
#>
#> $`0 + Days | Subject`$blockNumTheta
#> [1] 1
#>
#> $`0 + Days | Subject`$blockCode
#> us
#> 1
#>
#> $`0 + Days | Subject`$simCode
#> [1] 2
#>
#> $`0 + Days | Subject`$fullCor
#> integer(0)
#>
#>
getReStruc(rt2)
#> $`Days | Subject`
#> $`Days | Subject`$blockReps
#> [1] 18
#>
#> $`Days | Subject`$blockSize
#> [1] 2
#>
#> $`Days | Subject`$blockNumTheta
#> [1] 3
#>
#> $`Days | Subject`$blockCode
#> us
#> 1
#>
#> $`Days | Subject`$simCode
#> [1] 2
#>
#> $`Days | Subject`$fullCor
#> integer(0)
#>
#>