Nicholas Commons-Miller
2016-Apr-15 15:34 UTC
[R] Difficulty with LRSM Rasch analysis with eRm package in R.
Hi, I am trying to do an LRSM Rasch analysis for 72-item data. 67 of the items are binary, and 5 are ternary. I have tried it with and without a specified matrix, and cannot get it to work. The primary problems I am having are: 1. Without a matrix, I get an error: Error in `rownames<-`(`*tmp*`, value = betanames) : length of 'dimnames' [1] not equal to array extent This is from these commands: rGrps = c(rep.int(1, nrow(X))) results.LRSM <- LRSM(X, mpoints = 1, groupvec = rGrps, se = TRUE) 2. I don't know how to make a design matrix myself. I tried making one with 1's along the diagonal, but it doesn't seem to work. I get an error: Error in likLR(X, W, mpoints, groupvec, model, st.err = se, sum0, etaStart) : Mismatch between number of rows (beta's) in W and number of items (categories) in X! This is from these commands: rGrps = c(rep.int(1, nrow(X))) W = matrix(data=NA, nrow=ncol(X), ncol=ncol(X)) for(i in 1:(ncol(X) - 8)) { vec = c(rep(0, i - 1),1,rep(0, (ncol(X) - i))) W[i,] = vec } results.LRSM <- LRSM(X, W, mpoints = 1, groupvec = rGrps, se = TRUE) Both of these errors seem to arise somewhere within the eRm code, and I have had great difficulty finding specifically where. I am using R Studio, but I do not seem to be able to figure out the debugging, particularly when I need it to go into eRm package files. So basically, if I could get a few points of help, I would appreciate it: 1. How do I create a design matrix? 2. Why do the betas seem to not match the data? (The betanames to the rownames, or the betas to categories.) 3. How do I use R Studio debugging to step into the package files? Thank you, Nicholas Commons-Miller [[alternative HTML version deleted]]