# CFA: Confirmatory Factor Analysis (CFA). In bruceR: Broadly Useful Convenient and Efficient R Functions

 CFA R Documentation

## Confirmatory Factor Analysis (CFA).

### Description

An extension of `lavaan::cfa()`.

### Usage

``````CFA(
data,
model = "A =~ a[1:5]; B =~ b[c(1,3,5)]; C =~ c1 + c2 + c3",
estimator = "ML",
highorder = "",
orthogonal = FALSE,
missing = "listwise",
digits = 3,
file = NULL
)
``````

### Arguments

 `data` Data frame. `model` Model formula. See examples. `estimator` The estimator to be used (for details, see lavaan options). Defaults to `"ML"`. Can be one of the following: `"ML"`Maximum Likelihood (can be extended to `"MLM"`, `"MLMV"`, `"MLMVS"`, `"MLF"`, or `"MLR"` for robust standard errors and robust test statistics) `"GLS"`Generalized Least Squares `"WLS"`Weighted Least Squares `"ULS"`Unweighted Least Squares `"DWLS"`Diagonally Weighted Least Squares `"DLS"`Distributionally-weighted Least Squares `highorder` High-order factor. Defaults to `""`. `orthogonal` Defaults to `FALSE`. If `TRUE`, all covariances among latent variables are set to zero. `missing` Defaults to `"listwise"`. Alternative is `"fiml"` ("Full Information Maximum Likelihood"). `digits` Number of decimal places of output. Defaults to `3`. `file` File name of MS Word (`.doc`).

### Value

A list of results returned by `lavaan::cfa()`.

`Alpha`, `EFA`, `lavaan_summary`

### Examples

``````data.cfa=lavaan::HolzingerSwineford1939
CFA(data.cfa, "Visual =~ x[1:3]; Textual =~ x[c(4,5,6)]; Speed =~ x7 + x8 + x9")
CFA(data.cfa, model="
Visual =~ x[1:3]
Textual =~ x[c(4,5,6)]
Speed =~ x7 + x8 + x9
", highorder="Ability")

data.bfi = na.omit(psych::bfi)
CFA(data.bfi, "E =~ E[1:5]; A =~ A[1:5]; C =~ C[1:5]; N =~ N[1:5]; O =~ O[1:5]")

``````

bruceR documentation built on Sept. 27, 2023, 5:06 p.m.