2
votes

Used R code and got matrix error

library(eRm)
data <- na.omit(Main_data[,51:72])
model <- RSM(data)

got error like

Error in solve.default(parest$hessian) : system is computationally singular: reciprocal condition number = 5.82277e-23

I have removed all the missing values. I have tried with the pcIRT package with MPRM() code got some table format error. I also tried converting data as a matrix and got the same error.

2

2 Answers

1
votes

Apparently, you are doing Rasch analysis using the Rasch-Andrich Rating Scale Model. You could try the packages mirt or TAM instead of eRm. I had a similar problem with eRm, but the other two packages worked.

For example, something like this using mirt:

model <- "scale = 1 - 10" #define the model
fit <- mirt(data = data, model = model, itemtype = "rsm")
coef(fit, simplify = T)

Or TAM:

fit <- tam.mml(ati_clean_mh, irtmodel="RSM")
summary(fit)
0
votes

The RSM method is a wrapper around lm in the R base package. One of the implicit necessities of the lm method is that the matrix to which it is applied must be invertible. This translates into a situation where highly correlated data (correlation values considerably greater than 0 and approaching 1) can cause potholes in your matrix making it locally not invertible....then you get this error.

It does not matter how you structure the data (dataframe, matrix, list of lists) when you pass it into the method, it will throw the error because the values in the data destabilize the matrix and make using that method impossible in the current state.

The best solution would be to use a correlation matrix to figure out if you can pare out some of the highly correlated variables to make the matrix invertible.

Even if you were able to get the model to run as is, you would end up with stability issues in the results which would compromise the safe utility of the model.