
Fit a profile or class model to each imputed data set and pool the results across the imputations
Source:R/pool-imputations.R
pool_imputations.Rdpool_imputations() fits the same profile or class model to each of
several completed (imputed) data sets and combines the results, so that
the standard errors include the uncertainty due to the missing values.
It is the way to handle missing covariates, which the model cannot
integrate out as missing = "fiml" does for missing indicators.
Class labels can differ across fitted mixture models even when their profiles are similar. Before pooling, the function matches the profiles and group classes of every fit to those of the first imputation's fit. It then combines the aligned parameter estimates and covariance matrices using Rubin's rules: the pooled estimate is the mean over imputations, and its variance adds the average sampling variance within the imputations to the variance of the estimates between them.
The function returns pooled estimates, standard errors, confidence
intervals, and tests for eligible parameters, together with summaries of
the individual analyses. Completed data sets must be supplied as a list or
a mids object from mice; the function does not construct the imputation
model.
Usage
pool_imputations(
imputed,
vars,
id,
n_profiles,
...,
level = 0.95,
vcov_type = c("observed", "robust", "opg"),
adjust = .multilpa_p_adjust_methods
)Arguments
- imputed
The completed data sets: a list of at least two data frames with the same columns and rows in the same order, or a
midsobject from the mice package, which is completed here.- vars, id, n_profiles
The indicator columns, the group identifier and the number of profiles, as in
multilpa(). The model is the profile or class modelmultilpa()fits by default (family = "profiles"), with or without membership covariates; the other families are not pooled.- ...
Further arguments for
multilpa(), such asn_group_classes,profile_covariates,group_covariates,categorical,n_startsandseed, used for every imputation.- level
Confidence level of the pooled intervals (default 0.95).
- vcov_type
Covariance estimator applied to every imputation's fit, as in
parameter_inference():"observed"(default): the inverse of the observed information;"robust": the sandwich over the independent groups;"opg": the inverse of the outer product of the group scores.
For fits with sampling weights the default is
"robust", and the other types are refused withlatents_unsupported_weights; for fits with person centring or scaling the default is"robust"too, and the other types raiselatents_unsupported_inference.- adjust
Multiplicity correction applied to the pooled p-values to give
p_adjusted:"none"(default): no correction (p_adjustedequalsp_value);"holm","hochberg","hommel","bonferroni": control the family-wise error rate;"BH"(or its alias"fdr"): Benjamini-Hochberg, controls the false discovery rate;"BY": Benjamini-Yekutieli, controls the false discovery rate under any dependence.
These are the methods of
stats::p.adjust(). The per-imputation tables are computed without correction.
Value
An object of class latents_pooled. Printing it shows the pooled
estimates; summary() gives a one-row data frame describing the
pooling (number of imputations, convergence, range of the log
likelihoods, how many fits were relabelled, largest and median fraction
of missing information); plot() draws the pooled estimates with their
intervals over the single imputations; coef(), vcov() and
confint() give the pooled estimates, their total covariance and the
pooled intervals. Its three tables are read with
get_results(x, what = ) or as.data.frame(x, what = ):
"estimates"(default): one row per parameter, with the columns ofparameter_inference()(level,outcome,term,parameter,estimate,standard_error,statistic,p_value,p_adjusted,conf_low,conf_high) plusdf(Rubin's degrees of freedom),withinandbetween(the two variance components),riv(the relative increase in variance due to missingness) andfmi(the fraction of missing information).statisticandp_valueareNAwhereparameter_inference()reports no test (variances and probabilities);"imputations": each imputation's aligned estimates, one row per imputation and parameter:imputation,level,outcome,term,parameter,estimateandstandard_error;"fits": one row per imputation:imputation,log_likelihood,n_parameters,converged, andprofile_orderandgroup_order, the label permutations that aligned the fit to the first imputation's.
get_results(x, "all") returns the three tables as a named list.
Details
Pooling is on the reported (natural) scale: the pooled estimate is the mean
over imputations, and its variance is the mean within-imputation variance
plus (1 + 1/m) times the between-imputation variance. Degrees of freedom
follow Rubin's rules with a large complete-data sample. Pooled intervals are
symmetric t intervals, rather than the transformed Wald intervals used
for bounded parameters by parameter_inference(). A structural constant, such as the
probability of one for a single class, has zero within- and
between-imputation variance and zero missing information. When the
within-imputation variance is zero and the between-imputation variance is
positive, riv is infinite and fmi is one.
Interpretation
Pooling requires an imputation model appropriate for the analysis and missingness assumptions, including the grouping structure where relevant. The number of classes and other model specifications remain fixed across imputations. Label matching resolves differences in numbering but cannot establish that substantially different class solutions represent the same underlying profiles.
Estimates are pooled on their reported scale. Consequently, symmetric confidence intervals for probabilities or variances can extend beyond their permissible ranges.
Choosing the imputation model
Valid pooling requires an imputation model compatible with the analysis model and the assumed missingness mechanism. Associations between covariates and indicators may be nonlinear because they depend on latent class membership. The imputation model should represent these associations, account for clustering, include relevant indicators and predictors of missingness, and propagate uncertainty in its estimated parameters. Imputing separately within modally assigned classes omits classification uncertainty. Complete-case analysis can also change the within-class indicator distributions when missingness depends on the indicators.
Conditions
latents_bad_data when imputed is not a list of at least two data frames
with identical columns and row counts; latents_pooling_failed when any
imputation's fit or inference fails (the message names the imputation and
gives the original reason), for example a fit parameter_inference()
refuses because a parameter is on a bound, or when the imputations'
fits do not report the same parameters; latents_missing_package for a
mids object without mice installed. Warnings from the individual fits
are passed on as they are raised.
Examples
set.seed(1)
# Illustrative completed data sets for demonstrating the pooling interface.
# For an analysis, supply data generated by an appropriate imputation model.
completed <- lapply(seq_len(2), function(i) {
within(subset(course_engagement, student <= 40),
previous_grade <- previous_grade + rnorm(length(previous_grade), sd = 0.1))
})
pooled <- pool_imputations(completed, c("browse", "lectures", "forum_read"),
"student", n_profiles = 2, n_group_classes = 1,
profile_covariates = "previous_grade",
n_starts = 2, seed = 1)
pooled
#> Pooled over 2 imputations (Rubin's rules): multilpa_covariates, 2 profiles, 1 group classes
#> Largest fraction of missing information: 0.002
#> level outcome term parameter estimate standard_error
#> measurement profile_1 browse mean 0.5673 0.04202
#> measurement profile_1 lectures mean 0.4578 0.05095
#> measurement profile_1 forum_read mean 0.6314 0.04057
#> measurement profile_2 browse mean -0.8397 0.05746
#> measurement profile_2 lectures mean -0.6244 0.05838
#> measurement profile_2 forum_read mean -0.9157 0.04881
#> measurement profile_1 browse variance 0.5414 0.04379
#> measurement profile_1 lectures variance 0.8138 0.06410
#> measurement profile_1 forum_read variance 0.4740 0.03935
#> measurement profile_2 browse variance 0.4890 0.05733
#> measurement profile_2 lectures variance 0.5656 0.06255
#> measurement profile_2 forum_read variance 0.3392 0.04177
#> profile profile_1 (Intercept) coefficient 0.6143 0.10891
#> profile profile_1 previous_grade coefficient 0.6516 0.10996
#> conf_low conf_high fmi
#> 0.4850 0.6497 9.204e-04
#> 0.3579 0.5577 4.156e-04
#> 0.5519 0.7109 1.910e-03
#> -0.9523 -0.7271 1.533e-03
#> -0.7389 -0.5100 7.724e-04
#> -1.0113 -0.8200 1.362e-03
#> 0.4556 0.6272 5.685e-05
#> 0.6881 0.9394 8.618e-05
#> 0.3968 0.5511 8.793e-04
#> 0.3766 0.6013 1.392e-04
#> 0.4430 0.6882 6.543e-04
#> 0.2573 0.4210 7.721e-05
#> 0.4008 0.8277 3.680e-04
#> 0.4361 0.8672 1.331e-03
get_results(pooled, "fits")
#> imputation log_likelihood n_parameters converged profile_order group_order
#> 1 1 -2099.880 14 TRUE 1,2 1
#> 2 2 -2099.696 14 TRUE 1,2 1