Specify a structural equation model with constraints.
1 2 3
number of observed variables for xi.
number of observed variables for eta.
number of latent exogenous variabeles.
number of latent endognous variables.
which observed variables are indicators for which exogenous variable. See Details.
which observed variables are indicators for which endogenous variable. See Details.
which should be set for a model with more than one latent class. See Details.
number of latent classes.
define which interaction terms should be included. Default is ‘none’. See Details for how to enter interaction terms.
define relations between latent variables. Influences Beta and Gamma matrices. For ‘defaults’ and how to define see Details.
The notation for the
matrices given back by
follows typical notation used in structural equation modeling. The
notation, of course, may vary dependingly. Therefore, here are examples
for typical structural equation models with the notation used by
specify_sem (in matrix notation):
Structural model for LMS, QML (nonlinear SEM), and NSEMM (nonlinear SEM with latent classes):
eta = alpha + Gamma xi + xi' Omega xi + zeta
Structural model for SEMM (linear SEM with latent classes):
B eta = alpha + Gamma xi + zeta
x = nu_x + lambda_x xi + delta
y = nu_y + lambda_y eta + epsilon
Which indicators belong to which latent variable is defined by
eta. Must be specified in the following way:
xi='x1-x2,x3-x4' which means that variables
x1, x2 are
x3, x4 are indicators for
xi2. And accordingly for the endogenous variables
Interactions between latent exogenous variables are defined by
interaction='eta1~xi1:xi2,eta1~xi1:xi1'. It is important to note,
that interactions must always start with
xi1 and build from there.
A definition like
interaction='eta1~xi1:xi2,eta1~xi2:xi3' is not
feasible and must be changed to
interaction='eta1~xi1:xi2,eta1~xi1:xi3' (by simple switching
xi2 in one's definitions).
the Omega matrix (see above) and must always be a
triangular matrix where the lower triangle is filled with 0's (see Klein
& Moosbrugger, 2000, for details).
rel.lat defines which latent variables influence each
other. It must be defined like
rel.lat='eta1~xi1+xi2,eta2~eta1'. Free parameters will be
set accordingly in Beta and Gamma
matrices. When nothing is defined, Gamma defaults to
NAs (which means all xi's influence all
eta's) and Beta is an identity matrix.
Structural equation models with latent classes like SEMM and NSEMM can be
used in two different approaches usually called direct and indirect. When
constraints are set to
indirect then parameters for the latent
classes are constraint to be equal except for the parameters for the
mixture distributions (tau's and Phi). In a
direct approach, parameters for the latent classes are estimated
direct1 all parameters will be estimated
independently for each latent class. For
direct2 it is assumed
that the measurement model is equal for both groups and only the
parameters for the mixtures and the structural model are estimated
An object of class
which can be used to estimate parameters using
consists of the following components:
list of matrices specifying the structural equation model.
list of informations about structural equation model.
Jedidi, K., Jagpal, H. S., & DeSarbo, W. S. (1997). STEMM: A General Finite Mixture Structural Equation Model, Journal of Classification, 14, 23–50. doi:http://dx.doi.org/10.1007/s003579900002
Kelava, A., Nagengast, B., & Brandt, H. (2014). A nonlinear structural equation mixture modeling approach for non-normally distributed latent predictor variables. Structural Equation Modeling, 21, 468-481. doi:http://dx.doi.org/10.1080/10705511.2014.915379
Klein, A. &, Moosbrugger, H. (2000). Maximum likelihood estimation of latent interaction effects with the LMS method. Psychometrika, 65, 457–474. doi:http://dx.doi.org/10.1007/bf02296338
Klein, A. &, Muthen, B. O. (2007). Quasi-Maximum Likelihood Estimation of Structural Equation Models With Multiple Interaction and Quadratic Effects. Multivariate Behavior Research, 42, 647–673. doi:http://dx.doi.org/10.1080/00273170701710205
1 2 3 4 5 6 7 8 9 10 11 12 13 14
# with default constraints model <- specify_sem(num.x = 6, num.y = 3, num.xi = 2, num.eta = 1, xi = "x1-x3,x4-x6", eta = "y1-y3") # create data frame specs <- as.data.frame(model) # and add custom constraints constr <- c(1, NA, NA, 0, 0, 0, 0, 0, 0, 1, NA, NA, 1, NA, NA, NA, NA, 1, NA, 0, 0, 0, 0, 0, 0, NA, 0, 0, 0, 0, 0, 0, NA, 0, 0, 0, 0, 0, 0, NA, 0, 0, 0, 0, 0, 0, NA, 0, 0, 0, 0, 0, 0, NA, NA, 0, 0, 0, NA, 0, 0, 0, NA, NA, NA, NA, 0, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0, 0, 0, 0, NA, 0) specs$class1 <- constr # create model from data frame model.custom <- create_sem(specs)
Loading required package: orthopolynom Loading required package: polynom
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.