How to plot a prediction interval from a NNETAR model using autoplot

Dear friends,

With my data, adding some predictors variables I did not find any particular example about how to plot a NNETAR model, and also I would ask which metrics I should use to evaluate this PI?

library(fpp3)
library(imputeTS)

serie <- tibble(data = seq(as.Date("1949-01-01"), length = 24, by = "month"),
value1 = sample(1:24),
value2 = sample(1:24)) %>%
as_tsibble() %>%
fill_gaps(.full = TRUE)

serie<- serie %>%
na_kalman()

fit_nn <- serie %>%
model(NNETAR(value1 ~ value2 + trend() + season() + AR(p = 4), n_nodes = 14, scale_inputs = T))

future <- new_data(serie, 1) %>%
mutate(value2 = mean(serie$value2)) %>%
mutate(value1 = 6)

fc <- forecast(fit_nn,new_data = future)

Plotting only a point forecast as an example

serie %>%
autoplot(value1) +
autolayer(fc) +
labs(title = "Forecast of Power Generated")

Thansk in Advance

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.