[R] arima forecasting problem
Hi all, I am running into a problem using forecast with ARIMA models, hope you can help shed some light onto this. I am fitting several ARIMA models using the auto.arima() function onto several time series, which are basically the residuals from a linear model fit. There are 40 such data points in every series. Lets say for example that auto.arima() returns a ARIMA(0,0,1) model called huc.arima I then try to forecast the points for the next 20 time steps by doing the following: e_t.pred-forecast(huc.arima,h=length(time.test)) where time.test = 20. However, instead of getting 20 points I am getting only the first point with a non-zero value and 19 other points with value 0. I run into this problem with almost every other time series I try, regardless of the type of ARIMA model. I am thinking it must be something with the way I define the time series data? I am simply taking a vector of numbers and converting to a time series using the ts() function. Any help is much appreciated, thanks! -- View this message in context: http://r.789695.n4.nabble.com/arima-forecasting-problem-tp4636985.html Sent from the R help mailing list archive at Nabble.com. __ R-help@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.
Re: [R] Arima forecasting
Matteo Bertini schrieb: Hello everyone, I'm doing some benchmark comparing Arima [1] and SVR on time series data. I'm using an out-of-sample one-step-ahead prediction from Arima using the fitted method [2]. Do someone know how to have a two-steps-ahead forecast timeseries from Arima? Thanks, Matteo Bertini [1] http://robjhyndman.com/software/forecast [2] AirPassengers example on page 5 On Fri, Mar 19, 2010 at 5:31 PM, Stephan Kolassa stephan.kola...@gmx.de wrote: Hi Matteo, just use forecast.Arima() with h=2 to get forecasts up to 2 steps ahead. R will automatically use forecast.Arima() if you call forecast() with an Arima object. library(forecast) model - auto.arima(AirPassengers) forecast(model,h=2) HTH, Stephan I can perhaps reformulate my question, suppose I have like in [2]: air.model - Arima(AirPassengers[1:100],c(0,1,1)) air.model2 - Arima(AirPassengers,model=air.model) outofsample - ts(fitted(air.model2)[-c(1:100)],s=1957+4/12,f=12) As I can understand 'outofsample' is the timeseries of t+1 forecasts. What is the equivalent code to obtain the 'outofsample' timeseries using forecast.Arima()? Something like this pseudo code? for i in range(100, 200): air.model - Arima(AirPassengers[1+i:100+i], c(0,1,1)) air.model2 - Arima(AirPassengers, model=air.model) outofsample.append( forecast(air.model2, h=1) ) Thanks, Matteo Bertini __ R-help@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.
[R] Arima forecasting
Hello everyone, I'm doing some benchmark comparing Arima [1] and SVR on time series data. I'm using an out-of-sample one-step-ahead prediction from Arima using the fitted method [2]. Do someone know how to have a two-steps-ahead forecast timeseries from Arima? Thanks, Matteo Bertini [1] http://robjhyndman.com/software/forecast [2] AirPassengers example on page 5 __ R-help@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.
Re: [R] Arima forecasting
Hi Matteo, just use forecast.Arima() with h=2 to get forecasts up to 2 steps ahead. R will automatically use forecast.Arima() if you call forecast() with an Arima object. library(forecast) model - auto.arima(AirPassengers) forecast(model,h=2) HTH, Stephan Matteo Bertini schrieb: Hello everyone, I'm doing some benchmark comparing Arima [1] and SVR on time series data. I'm using an out-of-sample one-step-ahead prediction from Arima using the fitted method [2]. Do someone know how to have a two-steps-ahead forecast timeseries from Arima? Thanks, Matteo Bertini [1] http://robjhyndman.com/software/forecast [2] AirPassengers example on page 5 __ R-help@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. __ R-help@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.