Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
213 views
in Technique[技术] by (71.8m points)

r - Loop in CatR to produce Theta estimation for a matrix

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...