find_k: Find k for k-fold cross-validation

View source: R/find_k.R

find_kR Documentation

Find k for k-fold cross-validation

Description

This function is specifically for determining k in the context of factor analysis using change in RMSEA as the criterion for identifying the optimal factor model.

Usage

find_k(
  variables,
  n,
  p,
  m = NULL,
  max.k = 10,
  min.n = 200,
  rmsea0 = 0.05,
  rmseaA = 0.08,
  ...
)

Arguments

variables

a data.frame (or convertible to a data.frame) with variables to factor analyze in columns and observations in rows. The power analysis assumes all observations have complete data. Use n argument or remove rows manually to account for missingness.

n

integer; number of observations. Ignored if variables is provided.

p

integer; number of variables to factor analyze. Ignored ifvariables is provided.

m

integer; maximum number of factors expected to be extracted from variables. Default is p / 4 (i.e., 4 variables per factor).

max.k

integer; maximum number of folds. Default is 10. NULL indicates no maximum.

min.n

integer; minimum sample size per fold. Default is 200 based on simulations from Curran et al. (2003).

rmsea0

numeric; RMSEA under the null hypothesis.

rmseaA

numeric; RMSEA under the alternative hypothesis.

...

other arguments passed to findRMSEAsamplesize.

Value

named vector with the number of folds (k), sample size suggested by the power analysis (power.n), and the actual sample size used for determining k (actual.n).

References

Curran, P. J., Bollen, K. A., Chen, F., Paxton, P., & Kirby, J. B. (2003). Finite sampling properties of the point estimates and confidence intervals of the RMSEA. Sociological Methods & Research, 32(2), 208-252. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1177/0049124103256130")}

MacCallum, R. C., Browne, M. W., & Sugawara, H. M. (1996). Power analysis and determination of sample size for covariance structure modeling. Psychological Methods, 1(2), 130–149. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1037/1082-989X.1.2.130")}

Examples

find_k(n = 900, p = 20, m = 3)

# adjust precision
find_k(n = 900, p = 20, m = 3, rmsea0 = .03, rmseaA = .10)


kfa documentation built on July 9, 2023, 5:44 p.m.

Related to find_k in kfa...