Description Usage Arguments Details Value Examples
View source: R/Bootstrap_Variance.R
This function takes a dataset with stacked multiple imputation and a model fit and applies bootstrap to estimate the covariance matrix accounting for imputation uncertainty.
1 | Bootstrap_Variance(fit, stack, M, n_boot = 100)
|
fit |
object with corresponding vcov method (e.g. glm, coxph, survreg, etc.) from fitting to the (weighted) stacked dataset |
stack |
data frame containing stacked dataset across multiple imputations. Could have 1 or M rows for each subject with complete data. Should have M rows for each subject with imputed data. Must contain the following named columns: (1) stack$.id, which correspond to a unique identifier for each subject. This column can be easily output from MICE. (2) stack$wt, which corresponds to weights assigned to each row. Standard analysis of stacked multiple imputations should set these weights to 1 over the number of times the subject appears in the stack. (3) stack$.imp, which indicates the multiply imputed dataset (from 1 to M). This column can be easily output from MICE. |
M |
number of multiple imputations |
n_boot |
number of bootstrap samples |
This function implements the bootstrap-based estimation method for stacked multiple imputations proposed by Dr. Paul Bernhardt in “A Comparison of Stacked and Pooled Multiple Imputation" at the Joint Statistical Meetings, 2019.
Variance, estimated covariance matrix accounting for within and between imputation variation
1 2 3 4 5 6 7 | data(stackExample)
fit = stackExample$fit
stack = stackExample$stack
bootcovar = Bootstrap_Variance(fit, stack, M = 5, n_boot = 10)
VARIANCE_boot = diag(bootcovar)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.