| RMdimCFA | R Documentation |
Fits the observed one-factor categorical CFA to data and compares its
fit indices and per-item standardized loadings against the simulated null
distribution produced by RMdimCFACutoff. Returns a list of
two tables: model-fit indices and per-item loadings, each with the observed
value, the expected reference from the simulation, and a flag.
RMdimCFA(
data,
cutoff,
p_value = FALSE,
correction = c("fwer", "fdr_bh", "fdr_by", "none"),
alpha = 0.05,
output = c("kable", "dataframe")
)
data |
A data.frame or matrix of item responses (non-negative integers, 0-based), the same items used for the cutoff simulation. |
cutoff |
The list returned by |
p_value |
Logical. When |
correction |
Character. Multiplicity correction for the p-values:
|
alpha |
Numeric in (0, 1). Significance level used to flag
comparisons on the corrected p-value. Default |
output |
Character. |
Bootstrap p-values. The per-comparison statistic is the residual
studentised by the bootstrap mean and SD. Marginal p-values are Monte-Carlo,
(1 + count) / (B + 1), so they can be no smaller than 1 / (B + 1).
correction = "fwer" uses the Westfall-Young studentised-max step-down,
which exploits the bootstrap dependence among the statistics (Ferreira,
2024); it is liberal when the simulation is small, so at least 1000
iterations in RMdimCFACutoff() are recommended (a warning is issued
below that). These p-values are model-conditional and sample-size-sensitive
and are reported alongside the simulated expected ranges, not in place of
them.
A named list with two elements, fit and loadings:
fitCFI / RMSEA / SRMR with columns Index, Observed,
Cutoff, Direction, Flagged (one-sided, in the unfavourable
direction). With p_value = TRUE, columns p and padj are added
and Flagged reflects padj < alpha.
loadingsOne row per item with columns Item, Observed,
Expected_low, Expected_high, Flagged ("below" / "above" /
""). With p_value = TRUE, columns p_loading and padj_loading
are added and Flagged reflects padj_loading < alpha (direction
from the sign of the deviation from the simulated mean).
Each element is a knitr_kable (when output = "kable") or a data.frame
(when output = "dataframe").
The marginal p-value controls the error rate of a single comparison: for
one item (or item pair) decided on in advance it is the relevant value. But
scanning all k comparisons and flagging whichever fall below alpha tests
k hypotheses at once, so the chance of at least one false flag inflates to
roughly 1 - (1 - \alpha)^k (e.g. about 34% for k = 8 at
alpha = 0.05) – even when every marginal p-value is correctly calibrated.
The corrected (adjusted) p-value controls this: correction = "fwer" bounds
the probability of any false flag (strict, lower power), while "fdr_bh" /
"fdr_by" bound the expected proportion of false flags among those raised
(a more lenient middle ground). Rule of thumb: use the marginal p-value for a
single pre-specified comparison, and a corrected p-value when screening the
whole table – the usual workflow.
Ferreira, J. A. (2024). Methods of testing a 'small' or 'moderate' number of hypotheses simultaneously. Journal of Statistical Theory and Practice, 19(6). \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1007/s42519-024-00412-4")}
Westfall, P. H., & Young, S. S. (1993). Resampling-Based Multiple Testing. Wiley.
RMdimCFACutoff, RMdimCFAPlot
if (requireNamespace("lavaan", quietly = TRUE) &&
requireNamespace("eRm", quietly = TRUE)) {
data("raschdat1", package = "eRm")
sim <- RMdimCFACutoff(raschdat1[, 1:8], iterations = 50,
parallel = FALSE, seed = 1)
tabs <- RMdimCFA(raschdat1[, 1:8], cutoff = sim)
tabs$fit
tabs$loadings
# Bootstrap p-values with family-wise (Westfall-Young) correction
# (use iterations >= 1000 in real analyses for stable p-values)
RMdimCFA(raschdat1[, 1:8], cutoff = sim, p_value = TRUE)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.