knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

noisemaker

Codecov test coverage Lifecycle: experimental

The goal of noisemaker is to provide functions to make it easy to generate population correlation matrices that fit a common factor analysis model imperfectly. In particular, the noisemaker() function provides an interface to three methods for generating population correlation matrices with RMSEA and/or CFI values that are close to user-specified target values.

Installation

You can install the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("JustinKracht/noisemaker")

To also build the vignette when the package is installed (highly recommended), you can use:

devtools::install_github("JustinKracht/noisemaker", build_vignettes = TRUE)

Examples

In this example, the factor model has two factors, each with three salient items. I'll demonstrate using the noisemaker() function to generate a population correlation matrix with model error ($\Sigma$) such that $\textrm{RMSEA}(\Sigma, \Omega) = 0.05$, where $\Omega$ is the model-implied correlation matrix. For this first example, I'll use the method described by Cudeck and Browne (1992).

library(noisemaker)
library(fungible)

# Generate a simple factor model with two factors and six items
mod <- simFA(Model = list(NFac = 2, NItemPerFac = 3),
             Seed = 42)

(Omega <- mod$Rpop) # the model-implied correlation matrix

set.seed(42)

# Generate a population correlation matrix with model error (Sigma) using the
# Cudeck and Browne (1992) method
noisemaker(mod, method = "CB", target_rmsea = 0.05)

The noisemaker() function implements a method for simulating correlation matrices with RMSEA values close to a target value based on the adventitious error framework developed by Wu and Browne (2015).

noisemaker(mod, method = "WB", target_rmsea = 0.05)

Finally, the noisemaker() function implements a procedure that optimizes the values of the parameters for the Tucker, Koopman, and Linn (1969) method to produce a $\Sigma$ matrix that has both RMSEA and CFI values close to the user-specified targets:

noisemaker(mod, method = "TKL", 
           target_rmsea = 0.05, 
           target_cfi = 0.95,
           tkl_ctrl = list(optim_type = "optim"))


JustinKracht/noisemaker documentation built on Jan. 29, 2024, 1:26 a.m.