Type: Package
Title: DFI Cutoffs for Latent Variable Models
Version: 1.1.0
Description: Returns dynamic fit index (DFI) cutoffs for latent variable models that are tailored to the user's model statement, model type, and sample size. This is the counterpart of the Shiny Application, https://dynamicfit.app.
License: AGPL-3
Language: en-US
Encoding: UTF-8
RoxygenNote: 7.1.2
Depends: R (≥ 4.0.0)
URL: https://github.com/melissagwolf/dynamic
BugReports: https://github.com/melissagwolf/dynamic/issues
Imports: dplyr (≥ 1.0.0), simstandard (≥ 0.6.2), tidyr (≥ 1.1.0), lavaan (≥ 0.6-7), ggplot2 (≥ 3.3.0), magrittr (≥ 1.5), tibble (≥ 3.0.0), patchwork (≥ 1.1.1), stringr (≥ 1.4.0), purrr (≥ 0.3.3)
Suggests: knitr, rmarkdown
VignetteBuilder: knitr
NeedsCompilation: no
Packaged: 2022-02-25 00:35:10 UTC; missg
Author: Melissa G. Wolf [aut, cre], Daniel McNeish [aut]
Maintainer: Melissa G. Wolf <missgord@gmail.com>
Repository: CRAN
Date/Publication: 2022-02-28 19:40:02 UTC

Pipe operator

Description

See magrittr::%>% for details.

Usage

lhs %>% rhs

Dynamic fit index (DFI) cutoffs adapted from Hu & Bentler (1999) for multi-factor CFA models

Description

This function generates DFI cutoffs adapted from Hu & Bentler (1999) for multi-factor CFA models using ML estimation. 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.

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

Usage

cfaHB(model, n = NULL, plot = FALSE, manual = FALSE, reps = 500)

## S3 method for class 'cfaHB'
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.

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

(**Do not modify this**): 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.

x

cfaHB object

...

other print parameters

Value

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

Author(s)

Melissa G Wolf & Daniel McNeish

Maintainer: Melissa G Wolf <missgord@gmail.com>

Examples

#Lavaan object example (manual=FALSE)
dat <- lavaan::HolzingerSwineford1939
lavmod <- "F1 =~ x1 + x2 + x3
           F2 =~ x4 + x5 + x6
           F3 =~ x7 + x8 + x9"
fit <- lavaan::cfa(lavmod,dat)
cfaHB(fit)

#Manual entry example for a sample size of 400 (manual=TRUE)
manmod <- "F1 =~ .602*Y1 + .805*Y2 + .516*Y3 + .415*Y4
           F2 =~ .413*Y5 + -.631*Y6
           F1 ~~ .443*F2
           Y4 ~~ .301*Y5"
exactFit(model=manmod,n=400,manual=TRUE)


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

Description

This function generates DFI cutoffs for one-factor CFA models using ML estimation. 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.

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

Usage

cfaOne(model, n = NULL, plot = FALSE, manual = FALSE, reps = 500)

## S3 method for class 'cfaOne'
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.

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

(**Do not modify this**): 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.

x

cfaOne object

...

other print parameters

Value

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

Author(s)

Melissa G Wolf & Daniel McNeish

Maintainer: Melissa G Wolf <melissagordon@ucsb.edu>

Examples

#Lavaan object example (manual=FALSE)
dat <- lavaan::HolzingerSwineford1939
lavmod <- "F1 =~ x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9"
fit <- lavaan::cfa(lavmod,dat)
cfaOne(fit)

#Manual entry example for a sample size of 300 (manual=TRUE)
manmod <- "F1 =~ .602*Y1 + .805*Y2 + .857*Y3 + .631*Y4 + .345*Y5 + .646*Y6"
cfaOne(model=manmod,n=300,manual=TRUE)


Equivalence testing with adjusted fit indexes for structural equation modeling

Description

This function generates adjusted fit index cutoffs using equivalence testing, introduced by Yuan, Chan, Marcoulides, & Bentler (2016). The default argument is a singular argument: a lavaan object. The function can also accommodate manual entry of the sample size (n), model chi-square (T_ml), degrees of freedom (df), baseline chi-square (T_mli), and number of observed variables (p).

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

Usage

equivTest(
  n,
  T_ml = NULL,
  df = NULL,
  T_mli = NULL,
  p = NULL,
  manual = FALSE,
  plot = FALSE
)

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

Arguments

n

This can either be a lavaan object, OR your sample size.

T_ml

If you entered a lavaan object for n, leave this blank. Otherwise, enter your model chi-square.

df

If you entered a lavaan object for n, leave this blank. Otherwise, enter your model degrees of freedom.

T_mli

If you entered a lavaan object for n, leave this blank. Otherwise, enter your baseline chi-square.

p

If you entered a lavaan object for n, leave this blank. Otherwise, enter the number of observed variables in your model.

manual

If you entered a lavaan object, keep this set to FALSE. If you manually entered each argument, set this to TRUE.

plot

Displays a simple plot that compares your T-size RMSEA and T-Size CFI to the adjusted bins.

x

equivTest object

...

other print parameters

Value

T-size RMSEA and T-Size CFI, along with adjusted bins for each index

Author(s)

Melissa G Wolf & Daniel McNeish

Maintainer: Melissa G Wolf <melissagordon@ucsb.edu>

Examples

#Lavaan object example (manual=FALSE)
dat <- lavaan::HolzingerSwineford1939
lavmod <- "F1 =~ x1 + x2 + x3
           F2 =~ x4 + x5 + x6
           F3 =~ x7 + x8 + x9"
fit <- lavaan::cfa(lavmod,dat)
equivTest(fit)

#' #Manual entry example (manual=TRUE)
n <- 301
T_ml <- 85.306
df <- 24
T_mli <- 918.852
p <- 9
equivTest(n,T_ml,df,T_mli,p,manual=TRUE)


DFI cutoffs for a Test of Exact Fit

Description

This function generates DFI cutoffs by treating the data generating model as the true model (using ML estimation). 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.

Usage

exactFit(model, n, plot = FALSE, manual = FALSE, reps = 500)

## S3 method for class 'exactFit'
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.

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 fit index.

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

(**Do not modify this**): 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 (not yet available).

x

exactFit object

...

other print parameters

Value

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

Author(s)

Melissa G Wolf & Daniel McNeish

Maintainer: Melissa G Wolf <missgord@gmail.com>

Examples

#Lavaan object example (manual=FALSE)
dat <- lavaan::HolzingerSwineford1939
lavmod <- "F1 =~ x1 + x2 + x3
           F2 =~ x4 + x5 + x6
           F3 =~ x7 + x8 + x9"
fit <- lavaan::cfa(lavmod,dat)
exactFit(fit)

#Manual entry example for a sample size of 400 (manual=TRUE)
manmod <- "F1 =~ .602*Y1 + .805*Y2 + .516*Y3 + .415*Y4
           F2 =~ .413*Y5 + -.631*Y6
           F1 ~~ .443*F2
           Y4 ~~ .301*Y5"
exactFit(model=manmod,n=400,manual=TRUE)