1

and especially to those who can help.

I'm trying to run a mixed model ANOVA on an imputed data set (MICE) after dealing with missing data. I have managed to run the MICE analysis and generate 5 complete data sets. I am looking to get a pooled estimate on a time x group interaction.

My data set looks like this after running the following code:

library(mice) 
missdata2 <- mice(x, seed = 393939)
summary(missdata2)

nomiss = complete(missdata2, 1)

SS-d1, SS-d7, SS-d14, A-d1, A-d7, A-d14, ER-d1, ER-d7, ER-d14, Group

Above is the variables in my data set

I then ran the following code to save all 5 imputed data sets in my files

implist <- mids2mplus(missdata2) 

This created the following in my files

imp1
imp2
imp3
imp4
imp5

I need to fit an anova model to these imputed data sets (implist) that gives me the pooled estimate for the time by group interaction f statistics. There are three-time points D1 (day 1) D7 (day 7) and D14 (day 14) measured across three constructs of SS, A and ER as labelled in the data set and a group variable that contains three groups labels 1, 2 and 4. Ultimately I'm looking to obtain the pooled Time by group interaction for each of the following - SS, A, and ER.

For the first interaction, I tried several things that led to this, but this does not work either:

library(lme4) # package needed to run MIXED ANOVA
fit3 <- with(implist, lmer(SS_D1, SS_D7, SS_D14 + GROUP))
testEstimates(fit3, var.comp = TRUE)

#Errors  
`fit3 <- with(implist, lmer(SS_D1, SS_D7, SS_D14 + GROUP))
Error in as.formula(formula) : object 'SS_D1' not found
> testEstimates(fit3, var.comp = TRUE)
Error in testEstimates(fit3, var.comp = TRUE) :
  could not find function "testEstimates"`

When I run

head (implist)

it comes back as null which may indicate why it can't find the SS_D1 variables etc.

I am new to r and have jumped straight in the deep end, so please be gentle with me :).

Thanks to anyone who will give this a go.

  • The error says it can't find the function `testEstimates`. Therefore run `library(mitml)` before calling the function. That should be the library it belongs to. If the library command says there is no library called that way, then install the package with `install.packages("mitml")` – Edo Nov 30 '20 at 15:02
  • also, I can't run your code. To post a question on StackOverflow you should create a reproducible example and be very clear about your expected result. – Edo Nov 30 '20 at 15:04
  • check [this](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) out – Edo Nov 30 '20 at 15:05
  • Thank Edo, I have made some edits to clean it up a bit. Even with this package installed there is still an error in which r cannot find my variables (i.e., SS_D1 etc) and cannot find 'fit3'. I think some example code of a mixed model anova using MICE would help, but I can find detailed examples. – marley willegers Nov 30 '20 at 15:26

0 Answers0