lavaan | R Documentation |
Fit a latent variable model.
lavaan(model = NULL, data = NULL, ordered = NULL,
sampling.weights = NULL,
sample.cov = NULL, sample.mean = NULL, sample.th = NULL,
sample.nobs = NULL,
group = NULL, cluster = NULL, constraints = "",
WLS.V = NULL, NACOV = NULL, ov.order = "model",
slotOptions = NULL, slotParTable = NULL, slotSampleStats = NULL,
slotData = NULL, slotModel = NULL, slotCache = NULL,
sloth1 = NULL,
...)
model |
A description of the user-specified 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 data.frame.) Since 0.6-4, ordered can also be logical. If TRUE, all observed endogenous variables are treated as ordered (ordinal). If FALSE, all observed endogenous variables are considered to be numeric (again, unless they are declared as ordered in the data.frame.) |
sampling.weights |
A variable name in the data frame containing
sampling weight information. Currently only available for non-clustered
data. Depending on the |
sample.cov |
Numeric matrix. A sample variance-covariance matrix. The rownames and/or colnames must contain the observed variable names. For a multiple group analysis, a list with a variance-covariance 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 sample-based 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 two-level 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 variance-covariance matrix of the sample statistics.
For a multiple group analysis, a list with an asymptotic
variance-covariance matrix for each group. See the |
ov.order |
Character. If |
slotOptions |
Options slot from a fitted lavaan object. If provided, no new Options slot will be created by this call. |
slotParTable |
ParTable slot from a fitted lavaan object. If provided, no new ParTable slot will be created by this call. |
slotSampleStats |
SampleStats slot from a fitted lavaan object. If provided, no new SampleStats slot will be created by this call. |
slotData |
Data slot from a fitted lavaan object. If provided, no new Data slot will be created by this call. |
slotModel |
Model slot from a fitted lavaan object. If provided, no new Model slot will be created by this call. |
slotCache |
Cache slot from a fitted lavaan object. If provided, no new Cache slot will be created by this call. |
sloth1 |
h1 slot from a fitted lavaan object. If provided, no new h1 slot will be created by this call. |
... |
Many more additional options can be defined, using 'name = value'.
See |
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), 1-36. \Sexpr[results=rd]{tools:::Rd_expr_doi("https://doi.org/10.18637/jss.v048.i02")}
cfa
, sem
, growth
# The Holzinger and Swineford (1939) example
HS.model <- ' visual =~ x1 + x2 + x3
textual =~ x4 + x5 + x6
speed =~ x7 + x8 + x9 '
fit <- lavaan(HS.model, data=HolzingerSwineford1939,
auto.var=TRUE, auto.fix.first=TRUE,
auto.cov.lv.x=TRUE)
summary(fit, fit.measures=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.