coef2: Model Coefficients With Small Sample Correction

coef2R Documentation

Model Coefficients With Small Sample Correction

Description

Extract the coefficients from a latent variable model. Similar to lava::compare but with small sample correction.

Usage

coef2(object, as.lava, ...)

## S3 method for class 'lvmfit'
coef2(object, as.lava = TRUE, ssc = lava.options()$ssc, ...)

Arguments

object

a lvmfit or lvmfit2 object (i.e. output of lava::estimate or lavaSearch2::estimate2).

as.lava

[logical] if TRUE, uses the same names as when using stats::coef.

...

additional argument passed to estimate2 when using a lvmfit object.

ssc

[character] method used to correct the small sample bias of the variance coefficients: no correction (code"none"/FALSE/NA), correct the first order bias in the residual variance ("residual"), or correct the first order bias in the estimated coefficients "cox"). Only relevant when using a lvmfit object.

Details

When argument object is a lvmfit object, the method first calls estimate2 and then extract the model coefficients.

Value

A numeric vector named with the names of the coefficients.

See Also

estimate2 to obtain lvmfit2 objects.

Examples

#### simulate data ####
set.seed(10)
dW <- sampleRepeated(10, format = "wide")
set.seed(10)
dL <- sampleRepeated(10, format = "long")
dL$time2 <- paste0("visit",dL$time)

#### latent variable models ####
e.lvm <- estimate(lvm(c(Y1,Y2,Y3) ~ 1*eta + X1, eta ~ Z1), data = dW)
coef(e.lvm)
coef2(e.lvm)
coef2(e.lvm, as.lava = FALSE)

lavaSearch2 documentation built on April 12, 2023, 12:33 p.m.