Applies glm()
to a multiply imputed data set
Arguments
- formula
a formula expression as for other regression models, of the form response ~ predictors. See the documentation of
lm
andformula
for details.- family
The family of the glm model
- data
An object of type
mids
, which stands for 'multiply imputed data set', typically created by functionmice()
.- ...
Additional parameters passed to
glm
.
Value
An objects of class mira
, which stands for 'multiply imputed
repeated analysis'. This object contains data$m
distinct
glm.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, C.G.M. (2000) Multivariate Imputation by Chained Equations: MICE V1.0 User's manual. Leiden: TNO Quality of Life.
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
# logistic regression on the imputed data
fit <- glm.mids((hyp == 2) ~ bmi + chl, data = imp, family = binomial)
#> Warning: Use with(imp, glm(yourmodel)).
fit
#> call :
#> glm.mids(formula = (hyp == 2) ~ bmi + chl, family = binomial,
#> data = imp)
#>
#> call1 :
#> mice(data = nhanes)
#>
#> nmis :
#> age bmi hyp chl
#> 0 9 8 10
#>
#> analyses :
#> [[1]]
#>
#> Call: glm(formula = formula, family = family, data = complete(data,
#> i))
#>
#> Coefficients:
#> (Intercept) bmi chl
#> -4.98053 0.02486 0.01474
#>
#> Degrees of Freedom: 24 Total (i.e. Null); 22 Residual
#> Null Deviance: 25.02
#> Residual Deviance: 23.12 AIC: 29.12
#>
#> [[2]]
#>
#> Call: glm(formula = formula, family = family, data = complete(data,
#> i))
#>
#> Coefficients:
#> (Intercept) bmi chl
#> -7.51505 0.02664 0.02666
#>
#> Degrees of Freedom: 24 Total (i.e. Null); 22 Residual
#> Null Deviance: 25.02
#> Residual Deviance: 22.03 AIC: 28.03
#>
#> [[3]]
#>
#> Call: glm(formula = formula, family = family, data = complete(data,
#> i))
#>
#> Coefficients:
#> (Intercept) bmi chl
#> -7.92351 0.08376 0.02085
#>
#> Degrees of Freedom: 24 Total (i.e. Null); 22 Residual
#> Null Deviance: 25.02
#> Residual Deviance: 22.3 AIC: 28.3
#>
#> [[4]]
#>
#> Call: glm(formula = formula, family = family, data = complete(data,
#> i))
#>
#> Coefficients:
#> (Intercept) bmi chl
#> -7.09719 0.01271 0.02846
#>
#> Degrees of Freedom: 24 Total (i.e. Null); 22 Residual
#> Null Deviance: 29.65
#> Residual Deviance: 25.16 AIC: 31.16
#>
#> [[5]]
#>
#> Call: glm(formula = formula, family = family, data = complete(data,
#> i))
#>
#> Coefficients:
#> (Intercept) bmi chl
#> -2.55325 -0.10346 0.02218
#>
#> Degrees of Freedom: 24 Total (i.e. Null); 22 Residual
#> Null Deviance: 29.65
#> Residual Deviance: 26.23 AIC: 32.23
#>
#>