Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

mi.anova

Analysis of Variance for Multiply Imputed Data Sets (Using the D_2 Statistic)


Description

This function combines F values from analysis of variance using the D_2 statistic which is based on combining χ^2 statistics (see Allison, 2001, Grund, Luedtke & Robitzsch, 2016; micombine.F, micombine.chisquare).

Usage

mi.anova(mi.res, formula, type=2)

Arguments

mi.res

Object of class mids or mids.1chain

formula

Formula for lm function. Note that this can be also a string.

type

Type for ANOVA calculations. For type=3, the car::Anova function from the car package is used.

Value

A list with the following entries:

r.squared

Explained variance R^2

anova.table

ANOVA table

References

Allison, P. D. (2002). Missing data. Newbury Park, CA: Sage.

Grund, S., Luedtke, O., & Robitzsch, A. (2016). Pooling ANOVA results from multiply imputed datasets: A simulation study. Methodology, 12(3), 75-88. doi: 10.1027/1614-2241/a000111

See Also

This function uses micombine.F and micombine.chisquare.

See mice::pool.compare and mitml::testModels for model comparisons based on the D_1 statistic. The D_2 statistic is also included in mitml::testConstraints.

The D_1, D_2 and D_3 statistics are also included in the mice package in functions mice::D1, mice::D2 and mice::D3.

Examples

#############################################################################
# EXAMPLE 1: nhanes2 data | two-way ANOVA
#############################################################################

library(mice)
library(car)
data(nhanes2, package="mice")
set.seed(9090)

# nhanes data in one chain and 8 imputed datasets
mi.res <- miceadds::mice.1chain( nhanes2, burnin=4, iter=20, Nimp=8 )
# 2-way analysis of variance (type 2)
an2a <- miceadds::mi.anova(mi.res=mi.res, formula="bmi ~ age * chl" )

# test of interaction effects using mitml::testModels()
mod1 <- with( mi.res, stats::lm( bmi ~ age*chl ) )
mod0 <- with( mi.res, stats::lm( bmi ~ age+chl ) )
## Not run: 
mitml::testModels(model=mod1$analyses, null.model=mod0$analyses, method="D1")
mitml::testModels(model=mod1$analyses, null.model=mod0$analyses, method="D2")

# 2-way analysis of variance (type 3)
an2b <- miceadds::mi.anova(mi.res=mi.res, formula="bmi ~ age * chl", type=3)

#****** analysis based on first imputed dataset

# extract first dataset
dat1 <- mice::complete( mi.res$mids )

# type 2 ANOVA
lm1 <- stats::lm( bmi ~ age * chl, data=dat1 )
summary( stats::aov( lm1 ) )
# type 3 ANOVA
lm2 <- stats::lm( bmi ~ age * chl, data=dat1, contrasts=list(age=contr.sum))
car::Anova(mod=lm2, type=3)

## End(Not run)

miceadds

Some Additional Multiple Imputation Functions, Especially for 'mice'

v3.11-6
GPL (>= 2)
Authors
Alexander Robitzsch [aut,cre] (<https://orcid.org/0000-0002-8226-3132>), Simon Grund [aut] (<https://orcid.org/0000-0002-1290-8986>), Thorsten Henke [ctb]
Initial release
2021-01-21 11:48:47

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.