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.37595 -0.01104 0.01657
#>
#> Degrees of Freedom: 24 Total (i.e. Null); 22 Residual
#> Null Deviance: 25.02
#> Residual Deviance: 22.83 AIC: 28.83
#>
#> [[2]]
#>
#> Call: glm(formula = formula, family = family, data = complete(data,
#> i))
#>
#> Coefficients:
#> (Intercept) bmi chl
#> -9.05577 0.07106 0.02981
#>
#> Degrees of Freedom: 24 Total (i.e. Null); 22 Residual
#> Null Deviance: 27.55
#> Residual Deviance: 23.41 AIC: 29.41
#>
#> [[3]]
#>
#> Call: glm(formula = formula, family = family, data = complete(data,
#> i))
#>
#> Coefficients:
#> (Intercept) bmi chl
#> -6.64292 -0.02691 0.02764
#>
#> Degrees of Freedom: 24 Total (i.e. Null); 22 Residual
#> Null Deviance: 21.98
#> Residual Deviance: 19.09 AIC: 25.09
#>
#> [[4]]
#>
#> Call: glm(formula = formula, family = family, data = complete(data,
#> i))
#>
#> Coefficients:
#> (Intercept) bmi chl
#> -6.535917 0.003013 0.026024
#>
#> Degrees of Freedom: 24 Total (i.e. Null); 22 Residual
#> Null Deviance: 27.55
#> Residual Deviance: 24.05 AIC: 30.05
#>
#> [[5]]
#>
#> Call: glm(formula = formula, family = family, data = complete(data,
#> i))
#>
#> Coefficients:
#> (Intercept) bmi chl
#> -2.45033 -0.15232 0.02873
#>
#> Degrees of Freedom: 24 Total (i.e. Null); 22 Residual
#> Null Deviance: 29.65
#> Residual Deviance: 24.61 AIC: 30.61
#>
#>