miinference: Multiple Imputation Inference

miinferenceR Documentation

Multiple Imputation Inference

Description

Multiple Imputation Inference using Rubin's (1987) rules for MI inference.

Usage

miinference(est, std.err, confidence = 0.95)

Arguments

est

a list of m vectors containing parameter estimates (e.g. regression coefficients)

std.err

a list of m vectors with corresponding standard errors

confidence

confidence level; default is to compute 95% confidence intervals

Details

Combines m sets of parmater estimates and standard errors into an overall set of estimate using Rubin's (1987) rules for multiple imputation inference. This function is an adaptation of function mi.inference from package norm.

Value

a list of vectors

est

combined parameter estimates

std.err

combined standard errors representing both between and within-imputation variability

t.value

t-ratio: t.value=est/std.err

df

degrees of freedom

signif

p-values for the two-tailed tests that the respective combined estimate is zero

lower

lower limits of the MI confidence intervals

upper

upper limits of the MI confidence intervals

r

relative increases in variance due to nonresponse

fminf

fractions of missing information

References

  • Rubin, D. B. (1987). Multiple imputation for nonresponse in surveys. New York: Wiley.

  • Schafer, J. L. (1997). Analysis of incomplete multivariate data. London: Chapman & Hall.

Examples

## simulate overdespersed count data
b0 <- 1
b1 <- .75
b2 <- -.25
b3 <- .5
N <- 5000
x1 <- rnorm(N)
x2 <- rnorm(N)
x3 <- rnorm(N)
mu <- exp(b0+b1*x1+b2*x2+b3*x3)
y <- MASS::rnegbin( N, theta = 2, mu)
NB <- data.frame(y,x1,x2,x3)

## introduce MAR missingness to simulated data
total <- round(.2 * N)  ##number of missing data in y     
sm <- which( NB[,2] < mean(NB[,2]) )  ##subset: cases with x2<mean(x2)
gr <- which( NB[,2] > mean(NB[,2]) )	##subset: cases with x2>mean(x2)
sel.sm <- sample( sm, round(.2*total) )	##select cases to set as missing
sel.gr <- sample( gr, round(.8*total) )	##select cases to set as missing
sel <- c(sel.sm, sel.gr)
MNB <- NB
MNB[sel,1] <- NA	##delete selected data

## imputation and repeated data analysis
imp <- mice( MNB, method=c("nb","","","") )
res <- with( imp, glm.nb(y~x1+x2+x3) )
## get MI inferences for dispersion parameter theta
EST <- vector( length = 5, mode = "list" )
SE <- vector( length = 5, mode = "list" )

for (i in 1:5){
EST[[i]] <- res$analyses[[i]]$theta 
SE[[i]] <- res$analyses[[i]]$SE.theta 
}

miinference(EST,SE)

kkleinke/countimp documentation built on Nov. 5, 2024, 11:51 a.m.