Learn R Programming

mi (version 0.10-2)

mi.pooled: Modeling Functions for Multiply Imputed Dataset

Description

Modeling Function that pulls together the estimates from multiply imputed dataset.

Usage

mi.pooled(coef, se)
lm.mi(formula, mi.object, ...)
glm.mi(formula, mi.object, family = gaussian, ...)
bayesglm.mi(formula, mi.object, family = gaussian, ...)
polr.mi(formula, mi.object, ...)
bayespolr.mi(formula, mi.object, ...)
lmer.mi(formula, mi.object, rescale=FALSE, ...)
glmer.mi(formula, mi.object, family = gaussian, rescale=FALSE, ...)
## S3 method for class 'mi.pooled':
print(x, \dots)
## S3 method for class 'mi.pooled':
coef(object)
## S3 method for class 'mi.pooled':
se.coef(object)
## S3 method for class 'mi.pooled':
display(object, digits=2)

Arguments

coef
list of coefficients
se
list of standard errors
formula
See lm, glm, polr, lmerfor detail.
mi.object
mi object
family
See glm, polr, lmerfor detail.
rescale
default is FALSE, see rescale for detail.
x
mi.pooled object.
object
mi.pooled object.
digits
number of significant digits to display, default=2.
...
Any option to pass on to lm, glm, bayesglm, bayespolr<

Value

  • callthe matched call.
  • mi.pooledpulled estimates from the multiple dataset.
  • mi.fitestimates from each dataset.

References

Andrew Gelman and Jennifer Hill, Data Analysis Using Regression and Multilevel/Hierarchical Models, Cambridge University Press, 2007.

See Also

lm, glm, bayesglm, bayespolr, polr, and lmer

Examples

Run this code
# true data
  n <- 100
  x <- rbinom(n,1,.45) 
  z <- ordered(rep(seq(1, 5),n)[sample(1:n, n)])
  y <- rnorm(n)
  group <- rep(1:10, 10)

  # create artificial missingness
  dat.xy <- data.frame(x, y, z)
  dat.xy <- mi:::.create.missing(dat.xy, pct.mis=10)  
  
  # imputation 
  IMP <- mi(dat.xy, n.iter=6, add.noise=FALSE)

  # fit models
  M1 <- lm.mi(y ~ x + z, IMP)
  display(M1)
  coef(M1)
  se.coef(M1)

  M2 <- glm.mi(x ~ y , IMP, family = binomial(link="logit"))
  display(M2)
  coef(M2)
  se.coef(M2)

  M3 <- bayesglm.mi(x ~ y , IMP, family = binomial(link="logit"))
  display(M3)
  coef(M3)
  se.coef(M3)

  M4 <- polr.mi(ordered(z) ~  y, IMP)
  display(M4)
  coef(M4)
  se.coef(M4)

  M5 <- bayespolr.mi(ordered(z) ~  y, IMP)
  display(M5)
  coef(M5)
  se.coef(M5)

  M6 <- lmer.mi(y ~ x  + (1|group), IMP)
  display(M6)
  coef(M6)
  se.coef(M6)

  M7 <- glmer.mi(x ~ y  + (1|group), IMP, family = binomial(link="logit"))
  display(M7)
  coef(M7)
  se.coef(M7)

Run the code above in your browser using DataLab