Learn R Programming

FCO (version 2.0.0)

pop_mod: Helper function to obtain population model for simulation based on data and model

Description

Helper function to obtain population model for simulation based on data and model

Usage

pop_mod(
  mod,
  x,
  type = "NM",
  data.types = NULL,
  standardized = NULL,
  afl = 0.7,
  aco = 0.3,
  seed = seed
)

Value

List of population model type, standardized, average factor loading and average correlation. All values are round to three decimals.

Arguments

mod

A lavaan model (only CFA supported so far)

x

A dataset for the model of nrow observations (minimum: 50) and ncol indicators (minimum: 4)

type

Type of population model. NM (the default): Uses the factor loadings and covariances from Niemand & Mai's (2018) simulation study. HB: Uses the factor loadings and covariances from Hu & Bentler's (1999) simulation study. EM: Empirical, uses the given factor loadings and covariances. EM is not recommended for confirmative use as it leads to the least generalizable cutoffs.

data.types

Types of the manifest variables. Users can specify a vector of the length of variables with C = count, B = binary, O = ordinal, N = normal in the same order as in the dataset. These types are then used to simulate data for the population model based on median (count), mean (binary), cumulative relative frequencies of values (ordinal) as well as mean and variance (normal) applying the PoisBinOrdNor::intermat and PoisBinOrdNor::genPBONdata functions from package PoisBinOrdNor. That is, categorial and binary variables are also supported. Argument type is set to EM when data.types are defined (otherwise, normal data would be implied).

standardized

Are factor loadings assumed to be standardized and covariances to be correlations (default: TRUE)?

afl

Average factor loading of indicators per factor, only relevant for type = "NM" (default: .7).

aco

Average correlation between factors, only relevant for type = "NM" (default: .3).

seed

The seed to be set to obtain reproducible cutoffs (default: 1111). Defines a vector of length rep with the seed being the first value.

Examples

Run this code
mod <- "
F1 =~ Q5 + Q7 + Q8
F2 =~ Q2 + Q4
F3 =~ Q10 + Q11 + Q12 + Q13 + Q18 + Q19 + Q20 + Q21 + Q22
F4 =~ Q1 + Q17
F5 =~ Q6 + Q14 + Q15 + Q16
"
pop_mod(mod, x = bb1992, type = "NM")$pop.mod
pop_mod(mod, x = bb1992, type = "HB")$pop.mod
pop_mod(mod, x = bb1992, type = "EM")$pop.mod
pop_mod(mod, x = bb1992, type = "NM", afl = .9)$pop.mod
pop_mod(mod, x = bb1992, type = "NM", aco = .5)$pop.mod
pop_mod(mod, x = bb1992, type = "EM", standardized = FALSE)$pop.mod

Run the code above in your browser using DataLab