miinference | R Documentation |
Multiple Imputation Inference using Rubin's (1987) rules for MI inference.
miinference(est, std.err, confidence = 0.95)
est |
a list of |
std.err |
a list of |
confidence |
confidence level; default is to compute 95% confidence intervals |
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.
a list of vectors
combined parameter estimates
combined standard errors representing both between and within-imputation variability
t-ratio: t.value
=est
/std.err
degrees of freedom
p-values for the two-tailed tests that the respective combined estimate is zero
lower limits of the MI confidence intervals
upper limits of the MI confidence intervals
relative increases in variance due to nonresponse
fractions of missing information
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.
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.