[R] How to perform Mixed Design ANOVA on MICE imputed dataset in R?

Bert Gunter bgunter@4567 @ending from gm@il@com
Fri Jan 4 17:09:12 CET 2019


You might wish to post on the r-sig-mixed-models list, which is
specifically devoted to mixed effects models, instead of here. You are more
likely to find both interest and expertise there.

Cheers,
Bert

Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Fri, Jan 4, 2019 at 7:49 AM Lisa Snel <lisa_1995_s using hotmail.com> wrote:

> Dear Ista,
>
> Thank you for your response and the link you have sent me. However, I know
> the basic things of the MICE package (how impute, to pool and to do basic
> analyses), but the problem is that I cannot find anything about this
> specific analysis.
>
> Best,
> Lisa
> ________________________________
> Van: Ista Zahn <istazahn using gmail.com>
> Verzonden: vrijdag 4 januari 2019 15:11
> Aan: Lisa Snel
> CC: r-help using r-project.org
> Onderwerp: Re: [R] How to perform Mixed Design ANOVA on MICE imputed
> dataset in R?
>
> Hi Lisa,
>
> The package web page at http://stefvanbuuren.github.io/mice/ has all
> the info you need to get started.
>
> Best,
> Ista
>
> On Fri, Jan 4, 2019 at 3:29 AM Lisa Snel <lisa_1995_s using hotmail.com> wrote:
> >
> > Hi all,
> >
> > I have a question about performing a Mixed Design ANOVA in R after
> multiple imputation using MICE. My data is as follows:
> >
> > id <- c(1,2,3,4,5,6,7,8,9,10)
> > group <- c(0,1,1,0,0,1,0,0,0,1)
> > measure_1 <- c(60,80,90,54,60,61,77,67,88,90)
> > measure_2 <- c(55,88,88,55,70,62,78,66,65,92)
> > measure_3 <- c(58,88,85,56,68,62,89,62,70,99)
> > measure_4 <- c(64,80,78,92,65,64,87,65,67,96)
> > measure_5 <- c(64,85,80,65,74,69,90,65,70,99)
> > measure_6 <- c(70,83,80,55,73,64,91,65,91,89)
> > dat <- data.frame(id, group, measure_1, measure_2, measure_3, measure_4,
> measure_5, measure_6)
> > dat$group <- as.factor(dat$group)
> >
> > So: we have 6 repeated measurements of diastolic blood pressure (measure
> 1 till 6). The grouping factor is gender, which is called group. This
> variable is coded 1 if male and 0 if female. Before multiple imputation, we
> have used the following code in R:
> >
> > library(reshape)
> > library(reshape2)
> > datLong <- melt(dat, id = c("id", "group"), measured = c("measure_1",
> "measure_2", "measure_3", "measure_4", "measure_5", "measure_6"))
> > datLong
> >
> > colnames(datLong) <- c("ID", "Gender", "Time", "Score")
> > datLong
> > table(datLong$Time)
> > datLong$ID <- as.factor(datLong$ID)
> >
> > library(ez)
> > model_mixed <- ezANOVA(data = datLong,
> >                dv = Value,
> >                wid = ID,
> >                within = Time,
> >                between = Gender,
> >                detailed = TRUE,
> >                type = 3,
> >                return_aov = TRUE)
> > model_mixed
> >
> > This worked perfectly. However, our data is not complete. We have
> missing values, that we impute using MICE:
> >
> > id <- c(1,2,3,4,5,6,7,8,9,10)
> > group <- c(0,1,1,0,0,1,0,0,0,1)
> > measure_1 <- c(60,80,90,54,60,61,77,67,88,90)
> > measure_2 <- c(55,NA,88,55,70,62,78,66,65,92)
> > measure_3 <- c(58,88,85,56,68,62,89,62,70,99)
> > measure_4 <- c(64,80,78,92,NA,NA,87,65,67,96)
> > measure_5 <- c(64,85,80,65,74,69,90,65,70,99)
> > measure_6 <- c(70,NA,80,55,73,64,91,65,91,89)
> > dat <- data.frame(id, group, measure_1, measure_2, measure_3, measure_4,
> measure_5, measure_6)
> > dat$group <- as.factor(dat$group)
> >
> > imp_anova <- mice(dat, maxit = 0)
> > meth <- imp_anova$method
> > pred <- imp_anova$predictorMatrix
> > imp_anova <- mice(dat, method = meth, predictorMatrix = pred, seed =
> 2018, maxit = 10, m = 5)
> >
> > (The imputation gives logged events, because of the made-up data and the
> simple imputation code e.g id used as a predictor. For my real data, the
> imputation was correct and valid)
> >
> > Now I have the imputed dataset of class ‘mids’. I have searched the
> internet, but I cannot find how I can perform the mixed design ANOVA on
> this imputed set, as I did before with the complete set using ezANOVA. Is
> there anyone who can and wants to help me?
> >
> >
> > Best,
> >
> > Lisa
> >
> >         [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list