Re: [R] Need help on ARIMA (time series analysis)

From: Spencer Graves <spencer.graves_at_pdf.com>
Date: Mon 17 Oct 2005 - 06:42:53 EST

          Have you received a reply to this post? I have not seen one. If you would still like some suggestions from this group, please provide more detail on your question, as requested in the posting guide (www.R-project.org/posting-guide.html), including which version of R under which operating system.

          If I understand your post, you have two questions: (1) the error message and (2) the need for a loop.

          Regarding the error message, I can not replicate it. The message suggests a series that is nonstationary. However, I don't get that message from 'arima(1:50, order=c(1,0,1))', which is clearly nonstationary. What's in the file "C:\\R\\arima.R"? Can you replicate the error without using a "source" command?

          Regarding the need for a loop, I'm sorry, but I don't know enough about time series in R to answer your question. I'm currently studying Venables and Ripley (2002) Modern Applied Statistics with S, 4th ed. (Springer), ch. 14. If you are not familiar with this book, I highly recommend it. Ch. 14 is on time series. If you would like more comments on your question regarding a loop, I suggest you rephrase your question in terms of a standard example like "lh", fitting to, e.g., windows of length 30 in this series of 48 observations, explaining also very briefly what you are trying to accomplish with the loop.

          spencer graves

park wrote:
> 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
-- 
Spencer Graves, PhD
Senior Development Engineer
PDF Solutions, Inc.
333 West San Carlos Street Suite 700
San Jose, CA 95110, USA

spencer.graves@pdf.com
www.pdf.com <http://www.pdf.com>
Tel:  408-938-4420
Fax: 408-280-7915

______________________________________________
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
Received on Mon Oct 17 06:51:48 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:40:45 EST