Skip to content
Back to formatted view

Raw Message

Message-ID: <1292764136739-3094421.post@n4.nabble.com>
Date: 2010-12-19T13:08:56Z
From: Torch
Subject: Replacing the for loop for time series buid-up

Hi,
is there a function that replaces the following code?

n=200
boot.x[1]=odhad+boot.res[1]  #(boot.x[0]=1)

      for (j in 1:(n-1)) {
      boot.x[j+1]=odhad*boot.x[j]+boot.res[j+1]
      }

This is nested in two other loops, and I am looking for some way to improve
code performance
I tried sapply and cumprod but no success.

Thanks
Jan
-- 
View this message in context: http://r.789695.n4.nabble.com/Replacing-the-for-loop-for-time-series-buid-up-tp3094421p3094421.html
Sent from the R help mailing list archive at Nabble.com.