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 |
cfa_method |
Character (length = 1).
Method to generate population error.
Defaults to
|
fit |
Character (length = 1).
Fit index to control population error.
Defaults to
|
misfit |
Character or numeric (length = 1).
Magnitude of error to add.
Defaults to
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
|
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 |
convergence_iterations |
Numeric (length = 1).
Number of iterations to reach parameter convergence
within the specified 'tolerance'.
Defaults to |
leave_cross_loadings |
Boolean.
Should cross-loadings be kept?
Defaults to |
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:
|
original_results |
Original |
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"
)