Description Usage Arguments Details Value Author(s) References See Also Examples
The with()
function performs a computation on each of the n
imputed datasets. The typical sequence of steps to do a matching procedure on the imputed datasets are:
Impute the missing data points by the mice
function (from the mice package), resulting in a multiple imputed dataset (an object of the mids
class);
Match each imputed dataset using a matching model by the matchitmice()
function, resulting in an object of the mimids
class;
Fit the model of interest (scientific model) on each matched dataset by the with()
function, resulting in an object of the mira
class;
Pool the estimates from each model into a single set of estimates and standard errors, resulting in an object of the mipo
class.
1 2 |
data |
This argument specifies an object of the |
expr |
This argument specifies an expression of the usual syntax of R formula. See |
... |
Additional arguments to be passed to |
The with()
performs a computation on each of the imputed datasets.
This function returns an object of the mira
class (multiply imputed repeated analyses).
Extracted from the mice package written by Stef van Buuren et al. with few changes
Stef van Buuren and Karin Groothuis-Oudshoorn (2011). mice
: Multivariate Imputation by Chained Equations in R
. Journal of Statistical Software, 45(3): 1-67. https://www.jstatsoft.org/v45/i03/
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | #Loading the dataset
data(dataset)
#Multiply imputing the missing values
imputed.datasets <- mice(dataset, m = 5, maxit = 10,
method = c("", "", "", "mean", "polyreg", "logreg", "logreg", "logreg"))
#Matching the multiply imputed datasets
matched.datasets <- matchitmice(OSP ~ AGE + SEX + BMI + RAC + SMK, imputed.datasets,
approach = 'within', method = 'nearest')
#Analyzing the matched datasets
models <- with(data = matched.datasets,
exp = glm(KOA ~ OSP, family = binomial))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.