Skip to content
Prev 176930 / 398503 Next

equation help

On Apr 13, 2009, at 10:54 AM, Brendan Morse wrote:

            
It's really a series of assignments.
I am guessing that what you really want is:

for(i in 1:numItem){
          for(x in 1:numCat){
                    Ptheta[i,x]<-(exp(-1.702*a[i]*(theta-b[i,x+1]))
                    } }  #obviously untested

That should populate the i, x entries of a matrix with your  
calculations. The extra comma in your attempt was telling R that you  
wanted a three dimensional array. The other possibility as a  
construction would be to use expand.grid
Each value is an integer by the time it gets to the innards of the loop.