I have a train daily data and test daily data. I fit an ARIMA to my train data, forecast it 7 days and I want to get some performance measures of the forecasted values.

I can get performance measures of the trained fit by runnning summary(fit) And I can plot the forecast against the test data with this code easily: plot(forecast, main = 'ARIMA', xlab = 'Date', ylab = 'Number of patients', xlim = c(2017.75,2017.9)) lines(test_data, col = 'red', lty = 2)

But I can't find a way to evaluate the prediction. Tried using accuracy(forecast, test_data) but it returns an error: (this actually happens for all models I try running, what is the problem?)

Error in mean(actual != predicted) : 
  (list) object cannot be coerced to type 'integer'
In addition: Warning message:
In actual != predicted :
  longer object length is not a multiple of shorter object length

Can you please help me?

  • $\begingroup$ Please provide reproducible code of the problem. $\endgroup$ Commented Mar 28, 2020 at 1:38

1 Answer 1


The problem was very stupid. I had installed both libraries Metrics and forecast and both have an accuracy() function.

The one I was looking for is the forecast one, but the Metrics one is the one I was actually using, hence the error.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.