0

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.

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

ivmcphail
  • 21
  • 3
  • 1
    Hi ivmcphail, welcome to Stack Overflow. This website focuses on programing questions. The way you have phrased your question is perhaps on topic for [CrossValidated](https://stats.stackexchange.com/). If your question is truly about programing, you will be much more likely to get a response if you provide code of what you have tried thus far as well as a sample of your data using the `dput()` function. See [How to make a reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) for more info. – Ian Campbell Apr 23 '20 at 22:58
  • Hi Ian Campbell, I have edited the question as it has to do with the R code within the mice package, hopefully the revised question is clearer. I attempted a similar question on CrossValidated and they referred my here, so hopefully someone can illuminate the with() function in the mice package for me. – ivmcphail Apr 23 '20 at 23:52

0 Answers0