[R] equation help

Brendan Morse morse.brendan at gmail.com
Mon Apr 13 16:54:09 CEST 2009


Hi everyone, I am having a bit of trouble correctly structuring an  
equation in R.


Here is the equation



Here is what I thought

for(i in 1:numItem)for(x in 1:numCat)

           Ptheta[,i,x]<-(exp(-1.702*a[i]*(theta-b[i,x+1]))

My problem is that I am not sure how to get it to read the equation as  
having two indexing points (i and x). Right now it is trying to read  
it as a matrix, but each value (i and x) are only vectors. Does anyone  
have any suggestions on how to get R to recognize this? As an example,  
numItem may = 20 and numCat may = 3 and I am trying to evaluate this  
over all values of numCat for each value of numItem.

Thanks,
Brendan




More information about the R-help mailing list