pool_predictions: Pool Predictions and Estimated Marginal Means

View source: R/pool.R

pool_predictionsR Documentation

Pool Predictions and Estimated Marginal Means

Description

This function "pools" (i.e. combines) multiple estimate_means objects, in a similar fashion as mice::pool().

Usage

pool_predictions(x, transform = NULL, ...)

Arguments

x

A list of estimate_means objects, as returned by estimate_means(), or estimate_predicted, as returned by estimate_relation() and related functions.

transform

A function applied to predictions and confidence intervals to (back-) transform results, which can be useful in case the regression model has a transformed response variable (e.g., lm(log(y) ~ x)). For Bayesian models, this function is applied to individual draws from the posterior distribution, before computing summaries. Can also be TRUE, in which case insight::get_transformation() is called to determine the appropriate transformation-function. Note that no standard errors are returned when transformations are applied.

...

Currently not used.

Details

Averaging of parameters follows Rubin's rules (Rubin, 1987, p. 76). Pooling is applied to the predicted values on the scale of the linear predictor, not on the response scale, in order to have accurate pooled estimates and standard errors. The final pooled predicted values are then transformed to the response scale, using insight::link_inverse().

Value

A data frame with pooled predictions.

References

Rubin, D.B. (1987). Multiple Imputation for Nonresponse in Surveys. New York: John Wiley and Sons.

Examples


# example for multiple imputed datasets
data("nhanes2", package = "mice")
imp <- mice::mice(nhanes2, printFlag = FALSE)
predictions <- lapply(1:5, function(i) {
  m <- lm(bmi ~ age + hyp + chl, data = mice::complete(imp, action = i))
  estimate_means(m, "age")
})
pool_predictions(predictions)


modelbased documentation built on April 12, 2025, 2:22 a.m.