Hi, 
 
I am so novice in using R. I have some problems in my R script below
which fits time series data and predict it one-step ahead.  Here is a
brief explanation on what I try to achieve
 
Th16k is time series data (500 data points). The size of window for
fitting and predicting is 50 (data points). As you can easily discover
from my code,  (fixed) window is moving/sliding to get next one-step
ahead prediction. The predicted value will be saved in pth.
 
The problem is,  every time I execute following script, I got error
saying 
 
> source("C:\\R\\arima.R")
Error in arima(temp, order = c(1, 0, 1)) : 
        non-stationary AR part from CSS
 
I think there should be better way to achieve this goal without using
for loop.  If you can share your knowledge, please advise me!!! :-)
 
<-----------------------------------------------------------------------
----------------------------->
w <- 50
pth <- th16k[1:w]
limit <- length(th16k)-w
for (i in 1:limit) {
      ws <- i
      we <- i+w-1
      temp <- th16k[ws:we]
      fit <- arima(temp, order=c(1, 0, 1))
      pred <- predict(fit, n.ahead=1)
      pth[i+w] <- pred$pred
}
plot(pth)
<-----------------------------------------------------------------------
----------------------------->
 

        [[alternative HTML version deleted]]

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to