sem(model = NULL, data = NULL, ordered = NULL,
sample.cov = NULL, sample.mean = NULL, sample.nobs = NULL,
group = NULL, cluster = NULL,
constraints = "", WLS.V = NULL, NACOV = NULL,
...)
model.syntax
for more information. Alternatively, a
parameter table (eg. the output of the lavaanify()
function) is also
accepted.likelihood="normal"
, the user provided covariance matrix is
internally rescaled by multiplying it with a factor (N-1)/N, to ensure
that the covariance matrix has been divided by N. This can be turned off
by setting the sample.cov.rescale
argument to FALSE
.model.syntax
for more information."WLS"
;
if the estimator is "DWLS"
, only the diagonal of this matrix will be
used. For a multiple group analysis, a list with a weight matrix
for each group. The elements of the weight matrix should be in the
following order (if all data is continuous): first the means (if a
meanstructure is involved), then the lower triangular elements of the
covariance matrix including the diagonal, ordered column by column. In
the categorical case: first the thresholds (including the means for
continuous variables), then the slopes (if any), the variances of
continuous variables (if any), and finally the lower triangular elements
of the correlation/covariance matrix excluding the diagonal, ordered
column by column.WLS.V
argument for information about the order of the elements.lavOptions
for a complete list.
, for which several methods
are available, including a summary
method.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.th = TRUE
, auto.delta = TRUE
,
and auto.cov.y = TRUE
.lavaan
## 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)
Run the code above in your browser using DataCamp Workspace