Learn R Programming

mitml (version 0.3-4)

testEstimates: Compute final estimates and inferences

Description

Computes final parameter estimates and inferences from multiply imputed data sets.

Usage

testEstimates(model, qhat, uhat, var.comp=FALSE, df.com=NULL)

Arguments

model
A list of fitted statistical models (see examples).
qhat, uhat
Two matrices or lists containing point and variances estimates, respectively, for each imputed data set (see examples).
var.comp
A logical flag indicating if estimates for variance components should be calculated. Default is to FALSE.
df.com
(optional) A numeric vector denoting the complete-data degrees of freedom for the hypothesis test.

Value

Returns a list containing the final parameter and inferences, the relative increase in variance due to nonresponse, and the fraction of missing information (Rubin, 1987). A print method is used for better readable console output.

Details

This function calculates final parameter estimates and inferences as suggested by Rubin (1987, "Rubin's rules") for each parameter of the fitted model. In other words, testEstimates aggregates estimates and standard errors across multiply imputed data sets. The parameters and standard errors can either be supplied as fitted statistical models (model), or as two matrices or lists (qhat and uhat, see examples).

Rubin's original method assumes that the complete-data degrees of freedom are infinite, which is reasonable in larger samples. Alternatively, the degrees of freedom can be adjusted for smaller samples by specifying df.com (Barnard & Rubin, 1999). The df.com argument can either be a single number if the degrees of freedom are equal for all tests, or a numeric vector with one element per test.

Using the var.comp argument, final estimates for variance components and related parameters can be requested. These will be shown as a separate table within the console output. Accessing variance components is highly dependent on the model being estimated and not implemented for all models. Users may prefer calculating these estimates manually using with.mitml.list (see Example 3). No inferences are calculated for variance components.

Currently, the procedure supports statistical models that define coef and vcov methods (e.g., lm) and multilevel models estimated with lme4 or nlme. The arguments qhat and uhat allow for more general aggregation of parameter estimates regardless of model class. Support for further models may be added in future releases.

References

Barnard, J., & Rubin, D. B. (1999). Small-sample degrees of freedom with multiple imputation. Biometrika, 86, 948-955.

Rubin, D. B. (1987). Multiple imputation for nonresponse in surveys. Hoboken, NJ: Wiley.

See Also

with.mitml.list

Examples

Run this code
data(studentratings)

fml <- ReadDis + SES ~ ReadAchiev + (1|ID)
imp <- panImpute(studentratings, formula=fml, n.burn=1000, n.iter=100, m=5)

implist <- mitmlComplete(imp, print=1:5)

# fit multilevel model using lme4
require(lme4)
fit.lmer <- with(implist, lmer(SES ~ (1|ID)))

# * Example 1: combine estimates using model recognition
# final estimates and inferences sperately for each parameter (Rubin's rules)
testEstimates(fit.lmer)

# ... adjusted df for finite samples
testEstimates(fit.lmer, df.com=49)

# ... with additional table for variance components and ICCs
testEstimates(fit.lmer, var.comp=TRUE)

# * Example 2: combine estimates using matrices or lists
fit.lmer <- with(implist, lmer(SES ~ ReadAchiev + (1|ID)))

qhat <- sapply(fit.lmer, fixef)
uhat <- sapply(fit.lmer, function(x) diag(vcov(x)))
testEstimates(qhat=qhat, uhat=uhat)

Run the code above in your browser using DataLab