Just as an addendum- the entire loop runs fine if try() is NOT included. If
included, the loop has to be evaluated in fractions that don't make any
sense- see below.
Thanks,
Pravin
Pravin Jadhav
-----Original Message-----
From: s-news-owner@lists.biostat.wustl.edu
[mailto:s-news-owner@lists.biostat.wustl.edu] On Behalf Of Pravin
Sent: Tuesday, February 17, 2004 9:15 PM
To: s-news@wubios.wustl.edu
Subject: [S] for() loop
Hi all,
This is beyond my understanding. The following loop seems to be running (CPU
usage is 100%). But the output matrix 'nlmeres.new' has all 0's(Please note
default assignment is 0 only)
I tried troubleshooting with my limited knowledge- this is what I found-
for(i in 1:10) or for(i in 11:20) or for(i in 21:30) works
fine('nlmeres.new' has some sensible numbers-close to my expectation). Then
for (i in 31:40) does not work(rows remained 0). But for(i in 31:36) works
fine. So I thought there is a problem with 37th dataset. But the only way to
get an output after i=36 is to do it manually for each trial number
(meaning, for(i in 37:37) and for(i in 38:38....and so forth)..
Finally -one would think intuitively to run - for (i in 1:36)-at one go- it
again results in all 0's.
What do you think is going on here?bug? may be! I don't know. I guess I am
wasting lot of time on this.
Any help is highly appreciated.
Pravin
ntrial<-50
for (i in 1:ntrial)
{
od.fit.new<-nlme(MODEL),
data=obsdata,
fixed=lncl+lndclm+lnv~1,
random=lncl+lnv~1|id,
start=c(log(clf),log(clm-clf),log(v)),subset=trial==i)
nlmeres.new[i,]<-as.numeric(c(fixed.effects(od.fit.new),VarCorr(od.fit.new)[
,2],summary(od.fit.new)$tTable[,2],try((intervals(od.fit.new)$reStruct$id[1,
2]-intervals(od.fit.new)$reStruct$id[1,1])/1.96))
}
--------------------------------------------------------------------
This message was distributed by s-news@lists.biostat.wustl.edu. To
unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu with
the BODY of the message: unsubscribe s-news
|