[R] Floating simulation error

2009-04-23 Thread Brendan Morse
+iteration number. So, for condition 1, iteration 1, the starting seed value would be 2, then 3 etc. etc. At some point, I will get the subscript error but it seems unpredictable. Has anyone had a similar problem or an idea as to what might be happening? - Brendan Brendan Morse, M.S

[R] Calling objects in a loop

2009-04-20 Thread Brendan Morse
Hi everyone, I am trying to calculate a particular variable (vector) from some previously defined variables in a loop but I am having trouble figuring out how to get the loop to recognize that it should index for the previously defined objects. Here is a simplified version of what I am trying to do

[R] Loop question

2009-04-17 Thread Brendan Morse
Hi everyone, I am trying to accomplish a small task that is giving me quite a headache. I would like to automatically generate a series of matrices and give them successive names. Here is what I thought at first: t1<-matrix(0, nrow=250, ncol=1) for(i in 1:10){ t1[i]<-rnorm(250) }

Re: [R] Controlling widths in write.fwf()

2009-04-14 Thread Brendan Morse
Hi Aparna, you could always use the write.table function and set sep="". This will put all of your data into a sort of "fixed-width" column depending on what you specify to separate the values. See basic example below: x<-matrix(nrow=2, ncol=2, c(1,2,3,4)) write.table(x, "/Users/morse07/Des

[R] equation help

2009-04-13 Thread Brendan Morse
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 equati

[R] puzzling lm.fit errors

2009-04-09 Thread Brendan Morse
Hi everyone, I am running a monte carlo and am getting an error that I haven't the slightest clue where to begin figuring it out. The error is as follows: Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) : 0 (non-NA) cases In addition: Warning message: In ltm.fit(X, be

[R] Writing specific columns to a data file

2009-04-06 Thread Brendan Morse
Hi, I have a function that generates some output with 2 columns, but I only want to write the first column to a file. Is there a way to do this in the write.table command? thetaout=write.table(estimatedtheta, file="/Users/morse07/Desktop/R/ Trial/score.dat", row.names=F, col.names=F) Any adv

[R] Writing specific columns to a data file

2009-04-06 Thread Brendan Morse
Hi, I have a function that generates some output with 2 columns, but I only want to write the first column to a file. Is there a way to do this in the write.table command? thetaout=write.table(estimatedtheta, file="/Users/morse07/Desktop/R/ Trial/score.dat", row.names=F, col.names=F) Any adv