s-news
[Top] [All Lists]

for() loop

To: <s-news@wubios.wustl.edu>
Subject: for() loop
From: "Pravin" <jadhavpr@vcu.edu>
Date: Wed, 25 Feb 2004 02:26:57 -0500
Importance: Normal

Hello all,

 

I am just wondering as to why there was no reply to my previous query. Was the question clear? Although one of the users suggested using lapply(), I am not in a position to rewrite my code.

 

Here is one more try:

 

I am using a for() loop and at every call it runs NLME function inside. I am trying to extract some of the elements from the output (see below). Since C.I. on var-cov components cannot be determined for some of the runs, I am using try(). The loops runs okay when I have

for(i in 1:10)       or

for(i in 11:20)     or

for(i in 21:30)     or

for(i in 31:36)     or

What I am mean by runs okay is I have some numbers in the output matrix that make sense to me.

 

But for (i in 1:36) does not work. There are all zero’’s in the output matrix.

 

To me, this is beyond my understanding.

 

Hope someone can help.

 

LOOP:

for (i in 1:ntrial)

            {

            od.fit.new<-nlme(MODEL),

            data="">

            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))

            }                      

  

 

Thanks in anticipation,

 

Pravin

 

Pravin Jadhav

 

<Prev in Thread] Current Thread [Next in Thread>
  • for() loop, Pravin <=