[1] subscript out of bounds - What's the problem?
USMortality opened this issue · 0 comments
USMortality commented
I am trying to calculate the accuracy of a single point forecast for 2013. Model is trained on 2010-2012 data. It produces expected result, but also throws error: [1] subscript out of bounds
. How would I fix the error?
MRE:
df <- as_tsibble(data.frame(x = seq(2010:2013), y = sample(1:10, 4)), index = x)
df[1:3, ] %>%
model(RW(y ~ drift())) %>%
forecast(h = 1) %>%
accuracy(df)
Result:
# A tibble: 1 × 10
.model .type ME RMSE MAE MPE MAPE MASE RMSSE ACF1
<chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 RW(y ~ drift()) Test -0.5 0.5 0.5 -10 10 0.0769 0.0750 NA
Warning message:
1 error encountered
[1] subscript out of bounds