add_population_error {latentFactoR}R Documentation

Adds Population Error to simulate_factors Data

Description

Adds population error to simulated data from simulate_factors. See examples to get started

Usage

add_population_error(
  lf_object,
  cfa_method = c("minres", "ml"),
  fit = c("cfi", "rmsea", "rmsr", "raw"),
  misfit = c("close", "acceptable"),
  error_method = c("cudeck", "yuan"),
  tolerance = 0.01,
  convergence_iterations = 10,
  leave_cross_loadings = FALSE
)

Arguments

lf_object

Data object from simulate_factors

cfa_method

Character (length = 1). Method to generate population error. Defaults to "minres". Available options:

  • "minres" — Minimum residual

  • "ml" — Maximum likelihood

fit

Character (length = 1). Fit index to control population error. Defaults to "rmsr". Available options:

  • "cfi" — Comparative fit index

  • "rmsea" — Root mean square error of approximation

  • "rmsr" — Root mean square residuals

  • "raw" — Direct application of error

misfit

Character or numeric (length = 1). Magnitude of error to add. Defaults to "close". Available options:

  • "close" — Slight deviations from original population correlation matrix

  • "acceptable" — Moderate deviations from original population correlation matrix

While numbers can be used, they are not recommended. They can be used to specify misfit but the level of misfit will vary depending on the factor structure

error_method

Character (length = 1). Method to control population error. Defaults to "cudeck". Description of methods:

  • "cudeck" — Description coming soon... see Cudeck & Browne, 1992 for more details

  • "yuan" — Description coming soon...

tolerance

Numeric (length = 1). Tolerance of SRMR difference between population error correlation matrix and the original population correlation matrix. Ensures that appropriate population error was added. Similarly, verifies that the MAE of the loadings are not greater than the specified amount, ensuring proper convergence. Defaults to 0.01

convergence_iterations

Numeric (length = 1). Number of iterations to reach parameter convergence within the specified 'tolerance'. Defaults to 10

leave_cross_loadings

Boolean. Should cross-loadings be kept? Defaults to FALSE. Convergence problems can arise if cross-loadings are kept, so setting them to zero is the default. Only set to TRUE with careful consideration of the structure. Make sure to perform additional checks that the data are adequate

Value

Returns a list containing:

data

Simulated data from the specified factor model

population_correlation

Population correlation matrix with local dependence added

population_error

A list containing the parameters used to generate population error:

  • error_correlation — Correlation matrix with population error added (same as population_correlation)

  • fit — Fit measure used to control population error

  • delta — Minimum of the objective function corresponding to the misfit value

  • misfit — Specified misfit value

  • loadings — Estiamted CFA loadings after error has been added

original_results

Original lf_object input into function

Author(s)

bifactor authors
Marcos Jimenez, Francisco J. Abad, Eduardo Garcia-Garzon, Vithor R. Franco, Luis Eduardo Garrido <luisgarrido@pucmm.edu>

latentFactoR authors
Alexander P. Christensen <alexpaulchristensen@gmail.com>, Hudson Golino <hfg9s@virginia.edu>, Luis Eduardo Garrido <luisgarrido@pucmm.edu>, Marcos Jimenez, Francisco J. Abad, Eduardo Garcia-Garzon, Vithor R. Franco

References

Cudeck, R., & Browne, M.W. (1992). Constructing a covariance matrix that yields a specified minimizer and a specified minimum discrepancy function value. Psychometrika, 57, 357–369.

Examples

# Generate factor data
two_factor <- simulate_factors(
  factors = 2, # factors = 2
  variables = 6, # variables per factor = 6
  loadings = 0.55, # loadings between = 0.45 to 0.65
  cross_loadings = 0.05, # cross-loadings N(0, 0.05)
  correlations = 0.30, # correlation between factors = 0.30
  sample_size = 1000 # number of cases = 1000
)

# Add small population error using Cudeck method
two_factor_Cudeck <- add_population_error(
  lf_object = two_factor,
  cfa_method = "minres",
  fit = "rmsr", misfit = "close",
  error_method = "cudeck"
)

# Add small population error using Yuan method
two_factor_Yuan <- add_population_error(
  lf_object = two_factor,
  cfa_method = "minres",
  fit = "rmsr", misfit = "close",
  error_method = "yuan"
)


[Package latentFactoR version 0.0.6 Index]