Paul
Paul

Reputation: 75

Using accuracy function with sarima input argument to get in-sample-accuracy measures

I have fitted a Box-Jenkins model, ARIMA(2,1,0) to an univariate time series (length=38) and would like to get some in-sample accuracy measures (e.g. ME, RMSE, MAE, MAPE etc.) on the model fit in order to compare the Box-Jenkins model to an exponential smoothing model (model verification). Now, I try to use the accuracy function from the "forecast package" which takes an object of class "forecast" as input argument. It is stated that it will also work with Arima (http://www.inside-r.org/packages/cran/forecast/docs/accuracy). I do not seem to get it working though. My code:

x <- sarima(mytimeseries, 2,1,0)$fit

accuracy(x)

I get the following error:

Warning message: In trainingaccuracy(f, test, d, D) : test elements must be within sample

I do not quite understand what the warning message actually says. The basic setting the argument 'test' is NULL so that all elements are tested. How do I get the in-sample-accuracy measures (model verification) from the function accuracy in the forecast package?

Upvotes: 1

Views: 1055

Answers (1)

Mark S
Mark S

Reputation: 613

The accuracy function is expecting an object of class forecast, but in your case class(x) == "Arima". You will first need to pass mytimeseries to sarima.for (or predict), and then pass that object to accuracy.

Upvotes: 0

Related Questions