testEstimates.RdComputes final parameter estimates and inferences from multiply imputed data sets.
testEstimates(model, qhat, uhat, extra.pars = FALSE, df.com = NULL, ...)A list of fitted statistical models as produced by with.mitml.list or similar.
A matrix or list containing the point estimates of the parameters for each imputed data set (see 'Details').
(optional) An array, matrix, or list containing the variance estimates (i.e., squared standard errors) of the parameters for each imputed data set (see 'Details').
A logical flag indicating if estimates of additional parameters (e.g., variance components) should be calculated. Default is FALSE.
(optional) A numeric vector denoting the complete-data degrees of freedom for the hypothesis tests (see 'Details').
Not used.
This function calculates pooled parameter estimates and inferences as suggested by Rubin (1987, "Rubin's rules") for each parameter of the fitted model.
The parameters can either be extracted automatically from the fitted statistical models (model) or provided manually as matrices, arrays, 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 parameters being tested, or a numeric vector with one element per parameter.
Using the extra.pars argument, pooled estimates for additional parameters can be requested (e.g., variance components).
This option is available for a number of models but may not provide estimates for all parameters in all model types.
In such a case, users may extract the estimates of additional parameters by hand and pool them with the qhat argument (see 'Examples').
No inferences are calculated for pooled additional parameters.
Currently, the procedure supports automatic extraction of model parameters from models that define coef and vcov methods (e.g., lm, glm, lavaan and others) as well as multilevel models estimated with lme4 or nlme and GEEs estimated with geepack.
The arguments qhat and uhat provide a general method for pooling parameter estimates regardless of model type (see 'Examples').
Support for further models may be added in future releases.
A list containing the pooled parameter and inferences.
A print method is used for more readable output.
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.
data(studentratings)
fml <- ReadDis + SES ~ ReadAchiev + (1|ID)
imp <- panImpute(studentratings, formula = fml, n.burn = 1000, n.iter = 100, m = 5)
#> Running burn-in phase ...
#> Creating imputed data set ( 1 / 5 ) ...
#> Creating imputed data set ( 2 / 5 ) ...
#> Creating imputed data set ( 3 / 5 ) ...
#> Creating imputed data set ( 4 / 5 ) ...
#> Creating imputed data set ( 5 / 5 ) ...
#> Done!
implist <- mitmlComplete(imp)
# fit multilevel model using lme4
require(lme4)
fit.lmer <- with(implist, lmer(SES ~ (1|ID)))
# * Example 1: pool estimates of fitted models (automatic)
# pooled estimates and inferences separately for each parameter (Rubin's rules)
testEstimates(fit.lmer)
#>
#> Call:
#>
#> testEstimates(model = fit.lmer)
#>
#> Final parameter estimates and inferences obtained from 5 imputed data sets.
#>
#> Estimate Std.Error t.value df P(>|t|) RIV FMI
#> (Intercept) 46.680 1.235 37.805 79.272 0.000 0.290 0.243
#>
#> Unadjusted hypothesis test as appropriate in larger samples.
#>
# ... adjusted df for finite samples
testEstimates(fit.lmer, df.com = 49)
#>
#> Call:
#>
#> testEstimates(model = fit.lmer, df.com = 49)
#>
#> Final parameter estimates and inferences obtained from 5 imputed data sets.
#>
#> Estimate Std.Error t.value df P(>|t|) RIV FMI
#> (Intercept) 46.680 1.235 37.805 25.007 0.000 0.290 0.280
#>
#> Hypothesis test adjusted for small samples with df=[49]
#> complete-data degrees of freedom.
#>
# ... with additional table for variance components and ICCs
testEstimates(fit.lmer, extra.pars = TRUE)
#>
#> Call:
#>
#> testEstimates(model = fit.lmer, extra.pars = TRUE)
#>
#> Final parameter estimates and inferences obtained from 5 imputed data sets.
#>
#> Estimate Std.Error t.value df P(>|t|) RIV FMI
#> (Intercept) 46.680 1.235 37.805 79.272 0.000 0.290 0.243
#>
#> Estimate
#> Intercept~~Intercept|ID 38.329
#> Residual~~Residual 311.650
#> ICC|ID 0.110
#>
#> Unadjusted hypothesis test as appropriate in larger samples.
#>
# * Example 2: pool estimates using matrices or lists (qhat, uhat)
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)
#>
#> Call:
#>
#> testEstimates(qhat = qhat)
#>
#> Final parameter estimates and inferences obtained from 5 imputed data sets.
#>
#> Estimate
#> (Intercept) 18.404
#> ReadAchiev 0.058
#>
#> Unadjusted hypothesis test as appropriate in larger samples.
#>
testEstimates(qhat = qhat, uhat = uhat)
#>
#> Call:
#>
#> testEstimates(qhat = qhat, uhat = uhat)
#>
#> Final parameter estimates and inferences obtained from 5 imputed data sets.
#>
#> Estimate Std.Error t.value df P(>|t|) RIV FMI
#> (Intercept) 18.404 5.188 3.547 15.323 0.003 1.045 0.564
#> ReadAchiev 0.058 0.010 5.675 15.393 0.000 1.040 0.563
#>
#> Unadjusted hypothesis test as appropriate in larger samples.
#>