[R] LOOping problem with R

Berend Hasselman bhh at xs4all.nl
Mon Aug 30 10:07:38 CEST 2010


You made a mistake with theta

theta<-c(0.08,0.06,0.09,0)

This should be (see the fortran)

theta<-c(0.06,0.08,0.09,0)

The innermost loop (for( k in ...) is better written as while loop to take
into account how Fortran handles loops (see the previous replies):

        k <- i
        while( k <= j-1 ){
           a<-a*theta[k]
           k <- k + 1
        }

Berend



-- 
View this message in context: http://r.789695.n4.nabble.com/LOOping-problem-with-R-tp2399596p2399709.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list