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

pool_predictions(x, ...)

Arguments

x

A list of ggeffects objects, as returned by ggpredict, ggemmeans or ggeffect.

...

Currently not used.

Value

A data frame with pooled predictions.

Details

Averaging of parameters follows Rubin's rules (Rubin, 1987, p. 76).

References

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

Examples

# example for multiple imputed datasets
if (require("mice")) {
  data("nhanes2")
  imp <- mice(nhanes2, printFlag = FALSE)
  predictions <- lapply(1:5, function(i) {
    m <- lm(bmi ~ age + hyp + chl, data = complete(imp, action = i))
    ggpredict(m, "age")
  })
  pool_predictions(predictions)
}
#> Loading required package: mice
#> 
#> Attaching package: ‘mice’
#> The following object is masked from ‘package:stats’:
#> 
#>     filter
#> The following objects are masked from ‘package:base’:
#> 
#>     cbind, rbind
#> # Predicted values of bmi
#> 
#> age   | Predicted |         95% CI
#> ----------------------------------
#> 20-39 |     29.28 | [25.80, 32.75]
#> 40-59 |     23.85 | [20.60, 27.10]
#> 60-99 |     21.55 | [17.71, 25.40]
#> 
#> Adjusted for:
#> * hyp =     no
#> * chl = 192.79