Description Usage Arguments Details Value References See Also Examples
Fit a Confirmatory Factor Analysis (CFA) model.
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 data.frame.) Since 0.64, 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 nonclustered
data. Depending on the 
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 cfa
function is a wrapper for the more general
lavaan
function, using the following default arguments:
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  ## The famous Holzinger and Swineford (1939) example
HS.model < ' visual =~ x1 + x2 + x3
textual =~ x4 + x5 + x6
speed =~ x7 + x8 + x9 '
fit < cfa(HS.model, data = HolzingerSwineford1939)
summary(fit, fit.measures = TRUE)

This is lavaan 0.63
lavaan is BETA software! Please report any bugs.
lavaan 0.63 ended normally after 35 iterations
Optimization method NLMINB
Number of free parameters 21
Number of observations 301
Estimator ML
Model Fit Test Statistic 85.306
Degrees of freedom 24
Pvalue (Chisquare) 0.000
Model test baseline model:
Minimum Function Test Statistic 918.852
Degrees of freedom 36
Pvalue 0.000
User model versus baseline model:
Comparative Fit Index (CFI) 0.931
TuckerLewis Index (TLI) 0.896
Loglikelihood and Information Criteria:
Loglikelihood user model (H0) 3737.745
Loglikelihood unrestricted model (H1) 3695.092
Number of free parameters 21
Akaike (AIC) 7517.490
Bayesian (BIC) 7595.339
Samplesize adjusted Bayesian (BIC) 7528.739
Root Mean Square Error of Approximation:
RMSEA 0.092
90 Percent Confidence Interval 0.071 0.114
Pvalue RMSEA <= 0.05 0.001
Standardized Root Mean Square Residual:
SRMR 0.065
Parameter Estimates:
Information Expected
Information saturated (h1) model Structured
Standard Errors Standard
Latent Variables:
Estimate Std.Err zvalue P(>z)
visual =~
x1 1.000
x2 0.554 0.100 5.554 0.000
x3 0.729 0.109 6.685 0.000
textual =~
x4 1.000
x5 1.113 0.065 17.014 0.000
x6 0.926 0.055 16.703 0.000
speed =~
x7 1.000
x8 1.180 0.165 7.152 0.000
x9 1.082 0.151 7.155 0.000
Covariances:
Estimate Std.Err zvalue P(>z)
visual ~~
textual 0.408 0.074 5.552 0.000
speed 0.262 0.056 4.660 0.000
textual ~~
speed 0.173 0.049 3.518 0.000
Variances:
Estimate Std.Err zvalue P(>z)
.x1 0.549 0.114 4.833 0.000
.x2 1.134 0.102 11.146 0.000
.x3 0.844 0.091 9.317 0.000
.x4 0.371 0.048 7.779 0.000
.x5 0.446 0.058 7.642 0.000
.x6 0.356 0.043 8.277 0.000
.x7 0.799 0.081 9.823 0.000
.x8 0.488 0.074 6.573 0.000
.x9 0.566 0.071 8.003 0.000
visual 0.809 0.145 5.564 0.000
textual 0.979 0.112 8.737 0.000
speed 0.384 0.086 4.451 0.000
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.