Ian McPhail
2020-Apr-24 19:52 UTC
[R] Computing tetrachoric covariance matrices for multiple imputed datasets using MICE package
Using the mice package, I have created multiple imputed datasets to deal with missing data. I am looking for an example of the R code to use in order to analyze the set of imputed datasets using tetrachoric correlations in such a way that after pooling, I will have a combined tetrachoric covariance-variance matrix to use as input for an exploratory factor analysis. I have taken a few attempts at the with() command in the mice package, using the poly() function, but do not quite know what I'm doing so am out of my depth with the R code. All of the examples for using the with() command in the mice package involve lm() and regression formula. I provide some examples below of what I have attempted, but I think my question is about not understanding what the expression part of the with() function code is about and how to implement different analysis onto the imputed datasets using the with() function. For example, using an example with only 3 variables, I have attempted the following code, imp<- mice(df, meth = pmm, m = 25) fit <- with(imp, poly(var1, var2, var3)) Alternatively, I have tried: imp<- mice(df, meth = pmm, m = 25) fit <- with(imp, poly(var1:var3)) Alternatively, I have tried: imp<- mice(df, meth = pmm, m = 25) fit <- with(imp, poly(imp)) I have attempted the same series of code, but using the polychoric() function in the psych package. The data I am working with are 22 scale items that have a yes/no response type. I am not very savvy with R, but I appreciate any help people are able to provide. tia, Ian [[alternative HTML version deleted]]