I am conducting a multidimensional item response theory analysis using (mirt) package.
df.mirt <- mirt(data = df, model = 1, itemtype = "gpcm")
after that, I used the summary function to get the loading for each item
summary.df <- summary(df.mirt)
The summary results showed that I have items with really bad loading. Now, I would like to drop these items from my df without the need to drop each item one-by-one by using the loading values from the summary function.
The loading values are stored in summary.df$rotF
, the criteria is to drop any item with loading less than the absolute value of 0.4, this is what I tried:
New.df <- SelectVar[, summary.df$rotF > abs(0.4)]
Another one:
df2 <- if (summary.df$rofF < abs(0.4), SelectVar)
My.vars <- names(df.mirt) %in% names(df2)
New.df <- df.mirt[!My.vars]
Clearly, it is a beginner question, but I am still learning R. I do appreciate your help.