View source: R/infit_cutoff_mi.R
| RMitemInfitCutoffMI | R Documentation |
Extends RMitemInfitCutoff to work with multiply imputed datasets
produced by the mice package. Runs the parametric bootstrap simulation on
each imputed dataset and stacks the resulting distributions, so that the
final cutoff intervals reflect both sampling variability and imputation
uncertainty.
RMitemInfitCutoffMI(
mids_object,
iterations = 500,
parallel = TRUE,
n_cores = NULL,
verbose = FALSE,
seed = NULL,
cutoff_method = "hdci",
hdci_width = 0.999
)
mids_object |
A |
iterations |
Integer. Total number of simulation iterations to run
across all imputations. These are distributed approximately evenly across
the |
parallel |
Logical. Use parallel processing via |
n_cores |
Integer or |
verbose |
Logical. Show progress messages (default |
seed |
Integer or |
cutoff_method |
Character string specifying how cutoff intervals are
computed from the stacked distribution. Either |
hdci_width |
Numeric. Width of the HDCI when |
The function completes each of the m imputed datasets via
mice::complete(), then calls RMitemInfitCutoff on each one. The
total number of iterations is split approximately evenly across imputations
(i.e., each imputed dataset receives ceiling(iterations / m) or
floor(iterations / m) iterations). The per-imputation simulation results
are stacked into a single distribution from which cutoff intervals are
computed, naturally incorporating imputation uncertainty.
Imputed datasets that cause model convergence failures are dropped with a warning. If all imputations fail, the function stops with an error.
The mice package must be installed (it is in Suggests, not Imports).
A list with the same structure as RMitemInfitCutoff, so
that the result can be passed directly to RMitemInfit,
RMitemInfitMI, and RMitemInfitPlot:
resultsdata.frame with columns iteration, imputation,
Item, InfitMSQ, OutfitMSQ — the stacked simulation results from
all imputed datasets.
item_cutoffsdata.frame with per-item cutoff summaries: Item,
infit_low, infit_high, outfit_low, outfit_high. Computed from
the stacked distribution.
actual_iterationsTotal number of successful iterations across all imputations.
sample_nNumber of rows (respondents) per imputed dataset.
sample_summarySummary statistics of estimated person parameters from the first imputed dataset.
item_namesCharacter vector of item names.
cutoff_methodThe method used to compute cutoffs.
hdci_widthThe HDCI width used.
n_imputationsNumber of imputed datasets used.
iterations_per_imputationInteger vector of requested iterations per imputed dataset.
actual_iterations_per_imputationInteger vector of successful iterations per imputed dataset.
hdci_width defaults to 0.999 here, not to the 0.95 used by
RMitemInfitCutoff. RMitemInfitMI has no
corrected-p-value path yet, so under imputation the interval is still the
decision rule and keeps a width chosen for that job. Combining bootstrap
p-values across imputations is planned but needs its own calibration, since
Johansson (2026) covers complete data only.
RMitemInfitCutoff, RMitemInfitMI,
RMitemInfitPlot
if (requireNamespace("mice", quietly = TRUE) &&
requireNamespace("iarm", quietly = TRUE) &&
requireNamespace("ggdist", quietly = TRUE)) {
# Create example data with ~10% MCAR missingness
set.seed(42)
mat <- matrix(sample(0:1, 200 * 8, replace = TRUE), nrow = 200, ncol = 8)
mat[sample(length(mat), round(0.10 * length(mat)))] <- NA
sim_data <- as.data.frame(mat)
colnames(sim_data) <- paste0("Item", 1:8)
# mice's ordinal method (`polr`) requires the items to be ordered
# factors, so code them as such before imputing. RMitemInfitCutoffMI()
# converts the completed factors back to numeric internally.
sim_data[] <- lapply(sim_data, function(x) factor(x, ordered = TRUE))
# Impute (use more imputations, e.g. m = 5+, in real analyses)
imp <- mice::mice(sim_data, m = 2, method = "polr", seed = 123,
printFlag = FALSE)
# Compute simulation-based cutoffs across imputations
# (use more iterations, e.g. 250+, in real analyses)
cutoff_mi <- RMitemInfitCutoffMI(imp, iterations = 50, parallel = FALSE,
seed = 42)
cutoff_mi$item_cutoffs
# Use with RMitemInfitMI()
RMitemInfitMI(imp, cutoff = cutoff_mi)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.