Replies: 1 comment 1 reply
|
Use the library(fpp2)
#> ── Attaching packages ──────────────────────────────────────────── fpp2 2.5.1 ──
#> ✔ ggplot2 4.0.3 ✔ fma 2.5
#> ✔ forecast 9.0.2 ✔ expsmooth 2.3
#>
fit1 <- Arima(insurance[, "TV.advert"],
xreg = seasonaldummy(insurance[, "TV.advert"]),
order = c(0, 0, 2)
)
forecast(fit1, xreg = seasonaldummy(insurance[, "TV.advert"], h = 12))
#> Point Forecast Lo 80 Hi 80 Lo 95 Hi 95
#> May 2005 9.689146 8.401893 10.976400 7.720462 11.657830
#> Jun 2005 8.267309 6.685478 9.849140 5.848107 10.686511
#> Jul 2005 7.999618 6.374112 9.625125 5.513621 10.485616
#> Aug 2005 7.605722 5.980215 9.231228 5.119724 10.091719
#> Sep 2005 7.693269 6.067762 9.318775 5.207271 10.179267
#> Oct 2005 7.311492 5.685986 8.936999 4.825495 9.797490
#> Nov 2005 7.883501 6.257994 9.509007 5.397503 10.369498
#> Dec 2005 7.251027 5.625520 8.876533 4.765029 9.737024
#> Jan 2006 8.493880 6.868374 10.119387 6.007882 10.979878
#> Feb 2006 9.841441 8.215935 11.466948 7.355443 12.327439
#> Mar 2006 8.295398 6.669892 9.920905 5.809401 10.781396
#> Apr 2006 7.505733 5.880226 9.131239 5.019735 9.991730Created on 2026-06-03 with reprex v2.1.1 |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Using a monthly dataset from second edition of the book (link), suppose that
If we wanted to include seasonal dummies, how could we do this? Of course we have the option of SARIMA but I am interested in using seasonal dummies. I think that we should use
xregbut I do not know how to incorporate these dummies in xreg.All reactions