how_many_imputations {howManyImputations} | R Documentation |
Implements two-stage "how_many_imputations" from von Hippel (2020)
Description
The old advice of 5-10 imputations is sufficient for a point estimate (e.g. an estimated coefficient), but not for estimates of standard errors (and consequently, hypothesis tests or confidence intervals).
Usage
how_many_imputations(model, cv = 0.05, alpha = 0.05)
howManyImputations(model, cv = 0.05, alpha = 0.05)
Arguments
model |
Either a |
cv |
Desired precision of standard errors. Default to .05. If the data were re-imputed, the estimated standard errors would differ by no more than this amount. |
alpha |
Significance level for choice of "conservative" FMI. |
Details
von Hippel (2020) provides a way to calculate the number of imputations needed to have consistent estimates of the standard error. To do so requires an estimate of the Fraction of Missing Information (FMI) which can only be obtained after running some number of imputations. Therefore, von Hippel (2020) recommends the following procedure:
Carry out a limited number of imputations to enable estimation of the FMI. von Hippel (2020) recommends 20 imputations.
Use this function,
how_many_imputations()
, to calculate how many total imputations you will need.If the number of total imputations you will need is larger than your initial batch of 20, run additional imputations.
Value
The number of required imputations to obtain the cv
level of
precision.
References
von Hippel, Paul T. "How Many Imputations Do You Need? A Two-stage Calculation Using a Quadratic Rule." Sociological Methods & Research 49.3 (2020): 699-718.
Examples
data(airquality)
# Add some missingness
airquality[4:10, 3] <- rep(NA, 7)
airquality[1:5, 4] <- NA
airquality <- airquality[-c(5, 6)]
impdata1 <- mice::mice(airquality, m = 5, maxit = 10,
method = 'pmm', seed = 500)
modelFit1 <- with(impdata1, lm(Temp ~ Ozone + Solar.R + Wind))
how_many_imputations(modelFit1)
how_many_imputations(modelFit1, cv = .01)
# Using a non-`mice` libraries.
library(jomo)
library(mitools) # for the `imputationList` function
jomodata <- jomo::jomo1(airquality, nburn = 100, nbetween = 100, nimp = 5)
impdata2 <- mitools::imputationList(split(jomodata, jomodata$Imputation))
modelfit2 <- with(impdata2, lm(Temp ~ Ozone + Solar.R + Wind))
how_many_imputations(modelfit2)
library(Amelia)
data(freetrade)
a.out <- amelia(freetrade, m = 20, ts = "year", cs = "country")
modelFit3 <- with(imputationList(a.out$imputations),
lm(tariff ~ polity + pop + gdp.pc + year + country))
how_many_imputations(modelFit3)