Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

CFA

Confirmatory factor analysis (CFA).


Description

An extension of jmv::cfa() and lavaan::cfa().

Usage

CFA(
  data,
  model = "A =~ a[1:5]; B =~ b[c(1,3,5)]; C =~ c1 + c2 + c3",
  highorder = "",
  orthogonal = FALSE,
  missing = "listwise",
  style = "lavaan",
  CI = FALSE,
  MI = FALSE
)

Arguments

data

Data frame.

model

Model formula. See examples.

highorder

High-order factor. Default is "".

orthogonal

Default is FALSE. If TRUE, all covariances among latent variables are set to zero, and only "lavaan" style will be output.

missing

Default is "listwise". Alternative is "fiml" (using "Full Information Maximum Likelihood" method to estimate the model).

style

"jmv", "lavaan" (default), or both c("jmv", "lavaan"). If the model has high-order factors, only "lavaan" style will be output.

CI

TRUE or FALSE (default), provide confidence intervals for the model estimates.

MI

TRUE or FALSE (default), provide modification indices for the parameters not included in the model.

Value

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

See Also

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

Broadly Useful Convenient and Efficient R Functions

v0.6.2
GPL-3
Authors
Han-Wu-Shuang Bao [aut, cre]
Initial release
2021-04-08

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.