s-news
[Top] [All Lists]

for() loop

To: <s-news@wubios.wustl.edu>
Subject: for() loop
From: "Pravin" <jadhavpr@vcu.edu>
Date: Tue, 17 Feb 2004 21:14:59 -0500
Importance: Normal
In-reply-to: <002301c3f597$5a5d0be0$170111ac@Pravin>
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))
        }               



<Prev in Thread] Current Thread [Next in Thread>