Applies lm() to multiply imputed data set
Arguments
- formula
a formula object, with the response on the left of a ~ operator, and the terms, separated by + operators, on the right. See the documentation of
lmandformulafor details.- data
An object of type 'mids', which stands for 'multiply imputed data set', typically created by a call to function
mice().- ...
Additional parameters passed to
lm
Value
An objects of class mira, which stands for 'multiply imputed
repeated analysis'. This object contains data$m distinct
lm.objects, plus some descriptive information.
Details
This function is included for backward compatibility with V1.0. The function
is superseded by with.mids.
References
Van Buuren, S., Groothuis-Oudshoorn, K. (2011). mice:
Multivariate Imputation by Chained Equations in R. Journal of
Statistical Software, 45(3), 1-67.
doi:10.18637/jss.v045.i03
Examples
imp <- mice(nhanes)
#>
#> iter imp variable
#> 1 1 bmi hyp chl
#> 1 2 bmi hyp chl
#> 1 3 bmi hyp chl
#> 1 4 bmi hyp chl
#> 1 5 bmi hyp chl
#> 2 1 bmi hyp chl
#> 2 2 bmi hyp chl
#> 2 3 bmi hyp chl
#> 2 4 bmi hyp chl
#> 2 5 bmi hyp chl
#> 3 1 bmi hyp chl
#> 3 2 bmi hyp chl
#> 3 3 bmi hyp chl
#> 3 4 bmi hyp chl
#> 3 5 bmi hyp chl
#> 4 1 bmi hyp chl
#> 4 2 bmi hyp chl
#> 4 3 bmi hyp chl
#> 4 4 bmi hyp chl
#> 4 5 bmi hyp chl
#> 5 1 bmi hyp chl
#> 5 2 bmi hyp chl
#> 5 3 bmi hyp chl
#> 5 4 bmi hyp chl
#> 5 5 bmi hyp chl
fit <- lm.mids(bmi ~ hyp + chl, data = imp)
#> Warning: Use with(imp, lm(yourmodel)).
fit
#> call :
#> lm.mids(formula = bmi ~ hyp + chl, data = imp)
#>
#> call1 :
#> mice(data = nhanes)
#>
#> nmis :
#> age bmi hyp chl
#> 0 9 8 10
#>
#> analyses :
#> [[1]]
#>
#> Call:
#> lm(formula = formula, data = complete(data, i))
#>
#> Coefficients:
#> (Intercept) hyp chl
#> 21.89068 1.68101 0.01359
#>
#>
#> [[2]]
#>
#> Call:
#> lm(formula = formula, data = complete(data, i))
#>
#> Coefficients:
#> (Intercept) hyp chl
#> 18.76622 -0.48289 0.04181
#>
#>
#> [[3]]
#>
#> Call:
#> lm(formula = formula, data = complete(data, i))
#>
#> Coefficients:
#> (Intercept) hyp chl
#> 21.28388 -1.72926 0.04037
#>
#>
#> [[4]]
#>
#> Call:
#> lm(formula = formula, data = complete(data, i))
#>
#> Coefficients:
#> (Intercept) hyp chl
#> 19.18195 0.26517 0.03424
#>
#>
#> [[5]]
#>
#> Call:
#> lm(formula = formula, data = complete(data, i))
#>
#> Coefficients:
#> (Intercept) hyp chl
#> 22.42447 0.60556 0.01699
#>
#>
#>
