> 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.

Reply via email to