We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
melissagwolf/dynamic#3
get_dynamic <- function(model, type, level, rate = c(0.05, 0.10), verbose = TRUE) { type <- match.arg(type, c("CFA.one", "CFA.multi")) stopifnot(rate %in% c(0.05, 0.10)) rate <- rate[1] * 100 insight::check_if_installed("dynamic") if (verbose) message("Simulating...") foo <- switch (type, CFA.one = dynamic::cfaOne, CFA.multi = dynamic::cfaHB) dynamic_res <- foo(model)[[c(2,1)]] if (nrow(dynamic_res)/2 < level) { warning() level <- nrow(dynamic_res)/2 } th <- dynamic_res[sprintf("Level %d: %d/%d", level, 100-rate, rate),] th <- lapply(th, as.numeric) th$CFI <- effectsize::rules(th$CFI, c("poor", "satisfactory"), right = FALSE) th$RMSEA <- effectsize::rules(th$RMSEA, c("satisfactory", "poor")) th$SRMR <- effectsize::rules(th$SRMR, c("satisfactory", "poor")) th } dat <- lavaan::HolzingerSwineford1939 lavmod <- "F1 =~ x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9" fit <- lavaan::cfa(lavmod,dat) rules <- get_dynamic(fit, type = "CFA.one", level = 3L) #> Simulating... effectsize::interpret( lavaan::fitMeasures(fit, "CFI"), rules = rules$CFI ) #> cfi #> "poor" #> (Rules: Custom rules) effectsize::interpret( lavaan::fitMeasures(fit, "RMSEA"), rules = rules$RMSEA ) #> rmsea #> "poor" #> (Rules: Custom rules) effectsize::interpret( lavaan::fitMeasures(fit, "SRMR"), rules = rules$SRMR ) #> srmr #> "poor" #> (Rules: Custom rules)
The text was updated successfully, but these errors were encountered:
@DominiqueMakowski Something to look forward to (in the long run)
Sorry, something went wrong.
No branches or pull requests
melissagwolf/dynamic#3
The text was updated successfully, but these errors were encountered: