Description Usage Arguments Details Value References See Also Examples
Fit a Structural Equation Model (SEM).
1 2 3 4 5 
model 
A description of the userspecified model. Typically, the model
is described using the lavaan model syntax. See

data 
An optional data frame containing the observed variables used in the model. If some variables are declared as ordered factors, lavaan will treat them as ordinal variables. 
ordered 
Character vector. Only used if the data is in a data.frame. Treat these variables as ordered (ordinal) variables, if they are endogenous in the model. Importantly, all other variables will be treated as numeric (unless they are declared as ordered in the original data.frame.) 
sampling.weights 
A variable name in the data frame containing
sampling weight information. Currently only available for nonclustered
data. Sampling weights must be nonnegative, and sum to the total number
of observations. If this is not the case, the weights will be rescaled
so that they sum to the total number of observations. Only available
if estimator is ML in combination with robust standard errors and
a robust test statistic. By default, the estimator will be

sample.cov 
Numeric matrix. A sample variancecovariance matrix. The rownames and/or colnames must contain the observed variable names. For a multiple group analysis, a list with a variancecovariance matrix for each group. 
sample.mean 
A sample mean vector. For a multiple group analysis, a list with a mean vector for each group. 
sample.th 
Vector of samplebased thresholds. For a multiple group analysis, a list with a vector of thresholds for each group. 
sample.nobs 
Number of observations if the full data frame is missing and only sample moments are given. For a multiple group analysis, a list or a vector with the number of observations for each group. 
group 
Character. A variable name in the data frame defining the groups in a multiple group analysis. 
cluster 
Character. A (single) variable name in the data frame defining the clusters in a twolevel dataset. 
constraints 
Additional (in)equality constraints not yet included in the
model syntax. See 
WLS.V 
A user provided weight matrix to be used by estimator 
NACOV 
A user provided matrix containing the elements of (N times)
the asymptotic variancecovariance matrix of the sample statistics.
For a multiple group analysis, a list with an asymptotic
variancecovariance matrix for each group. See the 
... 
Many more additional options can be defined, using 'name = value'.
See 
The sem
function is a wrapper for the more general
lavaan
function, but setting the following default options:
int.ov.free = TRUE
, int.lv.free = FALSE
,
auto.fix.first = TRUE
(unless std.lv = TRUE
),
auto.fix.single = TRUE
, auto.var = TRUE
,
auto.cov.lv.x = TRUE
, auto.efa = TRUE
,
auto.th = TRUE
, auto.delta = TRUE
,
and auto.cov.y = TRUE
.
An object of class lavaan
, for which several methods
are available, including a summary
method.
Yves Rosseel (2012). lavaan: An R Package for Structural Equation Modeling. Journal of Statistical Software, 48(2), 136. URL http://www.jstatsoft.org/v48/i02/.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22  ## The industrialization and Political Democracy Example
## Bollen (1989), page 332
model < '
# latent variable definitions
ind60 =~ x1 + x2 + x3
dem60 =~ y1 + a*y2 + b*y3 + c*y4
dem65 =~ y5 + a*y6 + b*y7 + c*y8
# regressions
dem60 ~ ind60
dem65 ~ ind60 + dem60
# residual correlations
y1 ~~ y5
y2 ~~ y4 + y6
y3 ~~ y7
y4 ~~ y8
y6 ~~ y8
'
fit < sem(model, data = PoliticalDemocracy)
summary(fit, fit.measures = TRUE)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.