{{ !articles[0].partner.isSponsoringArticle ? "Platinum" : "Portal" }} Partner
architects,bigdata,theory,tools & methods,big data

Out-of-Sample One Step Forecasts

It is com­mon to fit a model using train­ing data, and then to eval­u­ate its per­for­mance on a test data set. When the data are time series, it is use­ful to com­pute one-​​step fore­casts on the test data. For some rea­son, this is much more com­monly done by peo­ple trained in machine learn­ing rather than statistics.

If you are using the fore­cast pack­age in R, it's eas­ily done with ETS and ARIMAmod­els. For example:

fit <- ets(trainingdata)
fit2 <- ets(testdata, model=fit)
onestep <- fitted(fit2)

Note that the sec­ond call to ets does not involve the model being re-​​estimated. Instead, the model obtained in the first call is applied to the test data in the sec­ond call. This works because fit­ted val­ues are one-​​step fore­casts in a time series model.

The same process works for ARIMA mod­els when ets is replaced by Arima orauto.arima. Note that it does not work with the arima func­tion from the stats pack­age. One of the rea­sons I wrote Arima (in the fore­cast pack­age) is to allow this sort of thing to be done.

Published at DZone with permission of {{ articles[0].authors[0].realName }}, DZone MVB. (source)

Opinions expressed by DZone contributors are their own.

{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks