catHB: Dynamic fit index (DFI) cutoffs for categorical multi-factor...

View source: R/catHB.R

catHBR Documentation

Dynamic fit index (DFI) cutoffs for categorical multi-factor CFA models

Description

This function generates DFI cutoffs for multi-factor CFA models that treat items as categorical. The default argument is a singular argument: a lavaan object from the cfa function. The function can also accommodate manual entry of the model statement and sample size (including threshold estimates).

The app-based version of this function can be found at dynamicfit.app.

Usage

catHB(
  model,
  n = NULL,
  plot = FALSE,
  manual = FALSE,
  reps = 250,
  estimator = "WLSMV"
)

## S3 method for class 'catHB'
print(x, ...)

Arguments

model

This can either be a lavaan object from the cfa function, OR a model statement written in lavaan model.syntax with standardized loadings and thresholds.

n

If you entered a lavaan object for model, leave this blank. Otherwise, enter your sample size (numeric).

plot

Displays distributions of fit indices for each level of misspecification.

manual

If you entered a lavaan object, keep this set to FALSE. If you manually entered standardized loadings and sample size, set this to TRUE.

reps

The number of replications used in your simulation. This is set to 500 by default in both the R package and the corresponding Shiny App.

estimator

Which estimator to use within the simulations (enter in quotes). The default is WLSMV. Only limited-information estimators that produce fit indices are permitted (i.e., maximum likelihood is not available)

x

catHB object

...

other print parameters

Value

Dynamic fit index (DFI) cutoffs for SRMR, RMSEA, and CFI.

Author(s)

Daniel McNeish & Melissa G Wolf

Maintainer: Daniel McNeish <dmcneish@asu.edu>

Examples

#Example using a lavaan object as input (manual=FALSE)

#two-factor model with correlated factors
m1<-"
 F1=~X1 + X2 +X3
 F2=~X6 + X7 + X8 + X9
 F1~~F2"

 #fit the model in lavaan, treating items are categorical
 fit<-lavaan::cfa(m1, data=Example, ordered=TRUE)

catHB(fit)

#Manual entry example (manual=TRUE)

#two-factor model with correlated factors
m1<-"
 F1=~X1 + X2 +X3
 F2=~X6 + X7 + X8 + X12
 F1~~F2"

 #fit the model, treating items are categorical
 #lavaan is used here to shown where estimates come from
 #but manual entry supports standardized estimates from models fit in any software

 fit<-lavaan::cfa(m1, data=Example, ordered=TRUE)
 lavaan::standardizedsolution(fit)

#thresholds go in model statement as
  #(a)categorical item name
  #(b) vertical pipe
  #(c) estimate
  #(d)times t+threshold number

manual_model <-"F1=~.448*X1 + .557*X2 + .770*X3
 F2=~.612*X6 + .684*X7 + .736*X8 + .365*X12
 F1~~.424*F2

X1 |-0.285*t1
X1 | 0.337*t2
X1 | 0.793*t3
X1 | 1.305*t4

X2 |-0.243*t1
X2 | 0.369*t2
X2 | 0.849*t3
X2 | 1.227*t4

X3 |-0.285*t1
X3 | 0.353*t2
X3 | 0.827*t3
X3 | 1.379*t4

X6 |-0.279*t1
X6 | 0.353*t2
X6 | 0.827*t3
X6 | 1.379*t4

X7 |-0.269*t1
X7 | 0.385*t2
X7 | 0.871*t3
X7 | 1.329*t4

X8 |-0.274*t1
X8 | 0.358*t2
X8 | 0.779*t3
X8 | 1.237*t4

X12 |-0.248*t1
X12 | 0.440*t2
X12 | 0.900*t3
X12 | 1.392*t4"
catHB(model=manual_model,n=500,manual=TRUE)


melissagwolf/dynamic documentation built on June 29, 2024, 6:24 p.m.