I'm trying to write a loop in order to estimate ability (Theta) on a matrix of questionnaire responses.
I'm using the thetaEst function in CatR to derive ability estimates using an IRT model. I have produced a matrix of item parameters which I can apply to a single vector of scores:
x <- c(3,4,2,1,4,3,3,3,2,1)
thetaEst(obj,x, model="GRM")
I'd like to write a for loop, to run this function on a matrix of responses.
Something like this:
for (i in nrow(items)){
thetaScore <- thetaEst(obj,items[i], model="GRM")
print(thetaScore)
}
Where "obj" is the parameters and "items" is the response matrix.
I just can't get this to work, currently the error I have is:
Error in `[.data.frame`(items, i) : undefined columns selected
I'd really appreciate some help on my error here. I'm sure it's pretty simple, but I'm a bit of an r novice.
Thanks
question from:
https://stackoverflow.com/questions/65848960/loop-in-catr-to-produce-theta-estimation-for-a-matrix 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…