Request for a NNETAR() model example with regressors #7
Unanswered
fernando-pierucci-alves
asked this question in
Q&A
Replies: 1 comment 1 reply
-
It's the same as any other model with regressors. Just add them on the RHS of the formula. Here is an example. library(fpp3)
aus <- global_economy |>
filter(Country == "Australia")
fit <- aus |>
model(NNETAR(log(GDP) ~ Population))
fit |>
forecast(
new_data = new_data(aus) |> mutate(Population = 24.8e6),
times = 100
)
#> # A fable: 1 x 6 [1Y]
#> # Key: Country, .model [1]
#> Country .model Year GDP .mean Population
#> <fct> <chr> <dbl> <dist> <dbl> <dbl>
#> 1 Australia NNETAR(log(GDP) ~ Population) 2018 sample[100] 1.38e12 24800000 augment(fit) |>
ggplot(aes(x = GDP, y = .fitted)) +
geom_point() +
scale_y_log10() +
scale_x_log10() +
geom_abline(slope = 1, intercept = 0, linetype = "dashed") Created on 2025-01-05 with reprex v2.1.1 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
NNETAR() is defined and discussed in section 12.4 of the FPP3 book.
Could you please provide an example of this model with regressors?
And if this is doable, it would be helpful if code for plotting the fit against the data were also provided.
Thanks in advance and congrats again for your overall work.
Beta Was this translation helpful? Give feedback.
All reactions