Applies glm() to a multiply imputed data set
glm.mids(formula, family = gaussian, data, ...)a formula expression as for other regression models, of the
form response ~ predictors. See the documentation of lm and
formula for details.
The family of the glm model
An object of type mids, which stands for 'multiply imputed
data set', typically created by function mice().
Additional parameters passed to glm.
An objects of class mira, which stands for 'multiply imputed
repeated analysis'. This object contains data$m distinct
glm.objects, plus some descriptive information.
This function is included for backward compatibility with V1.0. The function
is superseded by with.mids.
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.
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
#> -8.29196 0.10502 0.01992
#>
#> Degrees of Freedom: 24 Total (i.e. Null); 22 Residual
#> Null Deviance: 25.02
#> Residual Deviance: 21.99 AIC: 27.99
#>
#> [[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
#>
#>