Learn R Programming

lavaSearch2 (version 2.0.3)

coefByType: Extract the Coefficient by Type

Description

Extract specific types of coefficient from a lvm object: covariance coefficient(s) (coefCov), extra parameter(s) (coefExtra), position in the list of models for each coefficient (coefIndexModel), intercept coefficient(s) (coefIntercept), coefficient(s) that are used as reference (coefRef), regression coefficient(s) (coefReg), variance coefficient(s) (coefVar).

Usage

coefCov(object, value, keep.var, ...)

# S3 method for lvm coefCov(object, value = FALSE, keep.var = FALSE, ...)

# S3 method for lvmfit coefCov(object, value = FALSE, keep.var = FALSE, ...)

# S3 method for multigroup coefCov(object, value = FALSE, keep.var = FALSE, ...)

coefExtra(object, value, ...)

# S3 method for lvm coefExtra(object, value = FALSE, ...)

# S3 method for lvmfit coefExtra(object, value = FALSE, ...)

# S3 method for multigroup coefExtra(object, value = FALSE, ...)

coefIndexModel(object, ...)

# S3 method for lvm coefIndexModel(object, ...)

# S3 method for lvmfit coefIndexModel(object, ...)

# S3 method for multigroup coefIndexModel(object, ...)

# S3 method for multigroupfit coefIndexModel(object, ...)

coefIntercept(object, value, ...)

# S3 method for lvm coefIntercept(object, value = FALSE, ...)

# S3 method for lvmfit coefIntercept(object, value = FALSE, ...)

# S3 method for multigroup coefIntercept(object, value = FALSE, ...)

coefRef(object, value, ...)

# S3 method for lvmfit coefRef(object, value = FALSE, ...)

coefReg(object, value, ...)

# S3 method for lvm coefReg(object, value = FALSE, ...)

# S3 method for lvmfit coefReg(object, value = FALSE, ...)

# S3 method for multigroup coefReg(object, value = FALSE, ...)

coefVar(object, value, ...)

# S3 method for lvm coefVar(object, value = FALSE, ...)

# S3 method for lvmfit coefVar(object, value = FALSE, ...)

# S3 method for multigroup coefVar(object, value = FALSE, ...)

Value

A vector containing the names of the positions of the coefficients.

Arguments

object

a lvm model or a fitted lvm model

value

should the name of the coefficient be returned? Else return the coefficients

keep.var

should the variance coefficients be returned?

...

arguments to be passed to

Examples

Run this code
#### regression ####
m <- lvm(Y~X1+X2)
e <- estimate(m, lava::sim(m, 1e2))

coefCov(m)
coefCov(m, value = TRUE)

coefCov(m, keep.var = TRUE)
coefCov(m, value = TRUE, keep.var = TRUE)

coefIndexModel(m)
coefIndexModel(e)

coefIntercept(m)
coefIntercept(m, value = TRUE)

coefReg(m)
coefReg(m, value = TRUE)

#### LVM ####
m <- lvm()
regression(m) <- c(y1,y2,y3)~u
regression(m) <- u~x1+x2
latent(m) <- ~u
covariance(m) <- y1~y2

m.Sim <- m
categorical(m.Sim, labels = c("a","b","c")) <- ~x2
e <- estimate(m, lava::sim(m.Sim, 1e2))

coefCov(m)
coefCov(m, value = TRUE) 

coefCov(m, keep.var = TRUE)
coefCov(m, value = TRUE, keep.var = TRUE)

coefExtra(m)

coefIndexModel(m)
coefIndexModel(e)

## additional categorical variable 
categorical(m, labels = as.character(1:3)) <- "X1"

coefExtra(m)
coefExtra(m, value = TRUE)

## additional categorical variable
categorical(m, labels = as.character(1:3)) <- "x1"

coefIntercept(m)
coefIntercept(m, value = TRUE)
coefIntercept(e)

coefReg(e, value = TRUE)

#### multigroup ####
m <- lvm(Y~X1+X2)
eG <- estimate(list(m,m), list(lava::sim(m, 1e2), lava::sim(m, 1e2)))

coefIndexModel(eG)

Run the code above in your browser using DataLab