Colleagues I am a new to R but already love it. I have the following problem: I fitted arima model to my time series like this (please ignore modeling parameters as they are not important now): x = scan("C:/data.txt") x = ts(x, start=1, frequency=1) x.fit<-arima(x, order = c(1,0,0), seasonal = list(order=c(0,0,1))) Now I want to use this model for forecasting and backtesting (!). My goal is to apply exactly this model to different data ? another time series object, let?s call it ?y?. How can I do this in R. One of the options is to extract coefficients and to create my own function that can be applied to any time series but I suspect and hope that there is a better way of doing this. If there is not an easy option can anyone suggest a complete equation that includes seasonal terms that can be easily programmed (for example in C) for a person who knows some programming but very little math. Thank you. -- View this message in context: http://r.789695.n4.nabble.com/Manually-reconstructing-arima-model-from-coefficients-tp4566082p4566082.html Sent from the R help mailing list archive at Nabble.com.
R. Michael Weylandt
2012-Apr-18 00:50 UTC
[R] Manually reconstructing arima model from coefficients
What exactly do you mean by "apply" it to a different data set? Unlike regular regressions, time series models don't (generally) use new data to make forecasts ... By the way, this is a good guide to the time series functionality available in R: http://cran.r-project.org/web/views/TimeSeries.html Michael On Tue, Apr 17, 2012 at 5:54 PM, sergey777 <ssamson at uwo.ca> wrote:> Colleagues > > I am a new to R but already love it. > > I have the following problem: > I fitted arima model to my time series like this (please ignore modeling > parameters as they are not important now): > x = scan("C:/data.txt") > x = ts(x, start=1, frequency=1) > x.fit<-arima(x, order = c(1,0,0), seasonal = list(order=c(0,0,1))) > > Now I want to use this model for forecasting and backtesting (!). My goal is > to apply exactly this model to different data ? another time series object, > let?s call it ?y?. How can I do this in R. > > One of the options is to extract coefficients and to create my own function > that can be applied to any time series but I suspect and hope that there is > a better way of doing this. > If there is not an easy option can anyone suggest a complete equation that > includes seasonal terms ?that can be easily programmed (for example in C) > for a person who knows some programming but very little math. > > Thank you. > > > -- > View this message in context: http://r.789695.n4.nabble.com/Manually-reconstructing-arima-model-from-coefficients-tp4566082p4566082.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
Sergey Samsonov
2012-Apr-18 01:21 UTC
[R] Manually reconstructing arima model from coefficients
Michael My final goal is to perform forecasting in real time. My historical data that is used for training consist of about 2000 samples. Fitting ARIMA model x.fit<-arima(x, order = c(5,0,0), seasonal = list(order=c(0,0,1))) takes about 3-5 minutes, often I do not have so much time between receiving new samples of data. Therefore, I want to re-create my arima model let's say only every 50 samples but I want to update my forecast every time new data sample arrives (in a real time). In other words I want to apply my arima model to forecasting future events that will occurre not right after the model was created but some time later after a few more intermediate samples were received. I think this problem is similar to applying already fitted arima forecasting to a new time series object that has similar statistical properties as a tested set, since these are the same series just shifted in the future. [[alternative HTML version deleted]]