| overimpute | R Documentation |
Answers "is my imputation model well calibrated?" without ground truth
(the analogue of Amelia::overimpute(), model-agnostic): the
observed cells of one variable are treated as missing – fold by
fold, so every observed cell is overimputed exactly once – and imputed
with draws multiple imputations via vimpute(). For each cell the
observed value is compared with the mean and a level interval of
its draws; a well-calibrated model covers roughly level of the
observed values. Any genuinely missing cells stay missing and are imputed
as part of the model, exactly as they would be in a real run.
overimpute(data, variable, ..., draws = 5, folds = 5, level = 0.9, seed = NULL)
## S3 method for class 'vimpute_overimpute'
print(x, ...)
## S3 method for class 'vimpute_overimpute'
plot(x, ...)
data |
Dataset with (possibly) missing values. |
variable |
Single column name: the numeric variable whose observed cells are overimputed. |
... |
Passed on to |
draws |
Number of multiple-imputation draws per cell (>= 2). |
folds |
Number of folds the observed cells are split into (each fold
is set missing and overimputed in one |
level |
Coverage level of the reported interval (default 0.9). |
seed |
Optional single number: applied via |
x |
A |
The ... arguments are passed on to vimpute(), so the diagnostic runs
for any method, spec, or grammar configuration – e.g.
overimpute(dat, "y", method = "robust") or
overimpute(dat, "y", spec = list(y = vs_ranger(num.trees = 300))).
Note the cost: folds x draws imputation runs; lower folds and
draws (the defaults are modest) or use a fast method for large data.
For a stochastic spread of the draws keep an uncertainty source switched
on (the default uncert = "pmm", or boot/uncert); with purely
deterministic settings all draws coincide and the intervals collapse.
A data.frame of class vimpute_overimpute with one row per
observed cell: row (row index in data), observed,
mean, lower, upper (quantiles of the draws at
level), and covered. Attributes: variable,
level, draws, folds. print() reports the
empirical coverage; plot() draws the observed-vs-imputed
calibration plot with intervals and the 45-degree line.
Matthias Templ
vimpute(), makeMissing(), evaluation()
## Not run:
data(sleep)
ov <- overimpute(sleep, "Sleep", method = "robust", sequential = FALSE,
draws = 5, folds = 5, seed = 1)
print(ov) # empirical coverage of the 90% intervals
plot(ov)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.