I want to perform a Levene’s Test on multiply imputed datasets (m=5) using the pool_leventest function in R.
First, I followed the example code to understand the procedure:
imp_data <- mice(lbp_orig, m=5, seed=3025, printFlag = FALSE)
imp_list <- mids2milist(imp_data)
ra <- with(data=imp_list,
expr = levene_test(Pain ~ factor(Satisfaction)))
res <- pool_levenetest(ra, method = “D1”)
res
Here “Satisfaction” is a variable with three levels ‘1’,’2′ or ‘3’. But when I chose “Gender” as a factor with two levels ‘1’ and ‘2’, I encountered the error: Error in apply(u, c(1, 2), mean) : ‘MARGIN’ does not match dim(X).
I solved the issue by using the method=”D2″.
Now, I applied the same procedure on my datasets. My grouping variable has 2 levels. When I used the D1 method, I encountered the same error message as in the example. However, using the D2 method it works. But for some dependent variables, df2 is infinite. Can someone help me with the issue? I’d prefer using the D1 method for my sample size (N=420).
Next, I ran the with(data,leveneTest(..)) on each imputed dataset. But now I’m not sure on how to proceed with pooling the results. I know the Rubin’s Rules, but how do I apply them on my results?
Abby is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.