kfa_report: Creates summary report from a k-fold factor analysis

View source: R/kfa_report.R

kfa_reportR Documentation

Creates summary report from a k-fold factor analysis

Description

Generates a report summarizing the factor analytic results over k-folds.

Usage

kfa_report(
  models,
  file.name,
  report.title = file.name,
  path = NULL,
  report.format = "html_document",
  word.template = NULL,
  index = "default",
  load.flag = 0.3,
  cor.flag = 0.9,
  rel.flag = 0.6,
  digits = 2
)

Arguments

models

an object returned from kfa

file.name

character; file name to create on disk.

report.title

character; title of the report

path

character; path of the directory where summary report will be saved. Default is working directory. path and file.name are combined to create final file path

report.format

character; file format of the report. Default is HTML ("html_document"). See render for other options.

word.template

character; file path to word document to use as a formatting template when report.format = "word_document".

index

character; one or more fit indices to summarize in the report. Use index_available to see choices. Chi-square value and degrees of freedom are always reported. Default is CFI and RMSEA (naive, scaled, or robust version depends on estimator used in models).

load.flag

numeric; factor loadings of variables below this value will be flagged. Default is .30

cor.flag

numeric; factor correlations above this value will be flagged. Default is .90

rel.flag

numeric; factor (scale) reliabilities below this value will be flagged. Default is .60.

digits

integer; number of decimal places to display in the report.

Value

a summary report of factor structures and model fit within and between folds

Examples


# simulate data based on a 3-factor model with standardized loadings
sim.mod <- "f1 =~ .7*x1 + .8*x2 + .3*x3 + .7*x4 + .6*x5 + .8*x6 + .4*x7
                f2 =~ .8*x8 + .7*x9 + .6*x10 + .5*x11 + .5*x12 + .7*x13 + .6*x14
                f3 =~ .6*x15 + .5*x16 + .9*x17 + .4*x18 + .7*x19 + .5*x20
                f1 ~~ .2*f2
                f2 ~~ .2*f3
                f1 ~~ .2*f3
                x9 ~~ .2*x10"
set.seed(1161)
sim.data <- simstandard::sim_standardized(sim.mod, n = 900,
                                          latent = FALSE,
                                          errors = FALSE)[c(2:9,1,10:20)]

# include a custom 2-factor model
custom2f <- paste0("f1 =~ ", paste(colnames(sim.data)[1:10], collapse = " + "),
                   "\nf2 =~ ",paste(colnames(sim.data)[11:20], collapse = " + "))


mods <- kfa(variables = sim.data,
            k = NULL, # prompts power analysis to determine number of folds
            cores = 2,
            custom.cfas = custom2f)
            

## Not run: 
kfa_report(mods, file.name = "example_sim_kfa_report",
           report.format = "html_document",
           report.title = "K-fold Factor Analysis - Example Sim")
           
## End(Not run)


kfa documentation built on March 18, 2022, 5:26 p.m.