Reputation: 193
I have made a 365-step ahead forecast using the forecast() package and the following code:
##The time series is 3650 daily observations of rainfall
x <- ts(x$obs, start=c(2007, 10), end=c(2017, 9), frequency = 365)
##create training set - first 9 years of observations
x_train <- subset(x, start = 1, end = 3285)
##test set - last year of observations
x_test <- subset(x, start = 3286, end = 3650)
##fit the model
x_train_fit <- auto.arima(x_train, seasonal=FALSE, xreg=fourier(x_train, K=1))
##forecast using the model
x_fcast_test <- forecast(x_train_fit,h=365, xreg=fourier(x_test, K=1))
plot(x_fcast_test, col="black")
lines(x_test,col="red")
Problem: When I run the accuracy() function to test the accuracy of this forecast, the output looks like this:
> accuracy(x_fcast_test)
$`Models`
Call
1 "Not supported"
2 "Not supported"
3 "Not supported"
4 "Not supported"
5 "Not supported"
6 "Not supported"
7 "Not supported"
8 "Not supported"
9 "Not supported"
10 "Not supported"
$Fit.criteria
Min.max.accuracy MAE MAPE MSE RMSE NRMSE.mean NRMSE.median NRMSE.mean.accuracy NRMSE.median.accuracy Efron.r.squared
1 NA NA NA NA NA NA NA NA NA NA
2 NA NA NA NA NA NA NA NA NA NA
3 NA NA NA NA NA NA NA NA NA NA
4 NA NA NA NA NA NA NA NA NA NA
5 NA NA NA NA NA NA NA NA NA NA
6 NA NA NA NA NA NA NA NA NA NA
7 NA NA NA NA NA NA NA NA NA NA
8 NA NA NA NA NA NA NA NA NA NA
9 NA NA NA NA NA NA NA NA NA NA
10 NA NA NA NA NA NA NA NA NA NA
?accuracy() indicates that I need to be inputting an object of class forecast and optionally a numeric vector or time series of the same length for comparison.
> class(x_fcast_test)
[1] "forecast"
> class(x_test)
[1] "ts"
Here are some variations I've tried in an effort to make sure I am achieving that. None of these work either.
accuracy(x_fcast_test, x_test)
accuracy(x_fcast_test$mean, x_test)
accuracy(x_fcast_test$mean, as.numeric(x_test))
accuracy(x_fcast_test, as.numeric(x_test))
How should I interpret these outputs? What might cause this type of error?
Upvotes: 0
Views: 209
Reputation: 31820
It appears that you have loaded a package that over-rides the accuracy()
function in the forecast package.
Upvotes: 2