Create a structural equation model from a data frame

Share:

Description

Create model matrices from a data frame with columns label (for parameter labels) and class1 to classX.

Usage

1
  create_sem(dat)

Arguments

dat

data frame with first column label and one column for each latent class labeled class1, class2 and so on. See Details.

Details

Labels in column label need to be labeled in a certain way. Labels can be looked up by creating an object with specify_sem and then transforming it to a data frame with as.data.frame. See examples below.

Value

Gives back an object of class singleClass, semm, or nsemm which can be fitted using em.

See Also

specify_sem

Examples

1
2
3
4
5
6
7
# specify model
model <- specify_sem(num.x = 4, num.y = 1, num.xi = 2, num.eta = 1, 
  xi = "x1-x2,x3-x4", eta = "y1", interaction = "eta1~xi1:xi2")
# create data frame
dat <- as.data.frame(model)
# recreate model
create_sem(dat)