-
Notifications
You must be signed in to change notification settings - Fork 29
Open
Description
Is the intended behavior of the forecast special within the x13 model to match that of the seasonal package?
By way of example, with the forecast.save and forecast.maxlead arguments the return behavior is different than the seasonal example (could be user error).
Is it intended that this would be performed within a downstream model and forecast or is there a method for extracting these from the feasts special?
I appreciate the help and guidance in advance.
library(fpp3)
#> ── Attaching packages ──────────────────────────────────────────── fpp3 0.4.0 ──
#> ✓ tibble 3.1.6 ✓ tsibble 1.1.1
#> ✓ dplyr 1.0.7 ✓ tsibbledata 0.4.0
#> ✓ tidyr 1.2.0 ✓ feasts 0.2.2.9000
#> ✓ lubridate 1.8.0 ✓ fable 0.3.1
#> ✓ ggplot2 3.3.5
#> ── Conflicts ───────────────────────────────────────────────── fpp3_conflicts ──
#> x lubridate::date() masks base::date()
#> x dplyr::filter() masks stats::filter()
#> x tsibble::intersect() masks base::intersect()
#> x tsibble::interval() masks lubridate::interval()
#> x dplyr::lag() masks stats::lag()
#> x tsibble::setdiff() masks base::setdiff()
#> x tsibble::union() masks base::union()
library(seasonal)
#>
#> Attaching package: 'seasonal'
#> The following object is masked from 'package:tibble':
#>
#> view
seas_fcast <- seas(
x = AirPassengers,
transform.function = "log",
forecast.maxlead = 36,
forecast.save = "fct"
)
str(seas_fcast)
#> List of 13
#> $ series :List of 8
#> ..$ fct: Time-Series [1:36, 1:3] from 1961 to 1964: 444 414 466 498 498 ...
#> .. ..- attr(*, "dimnames")=List of 2
#> .. .. ..$ : NULL
#> .. .. ..$ : chr [1:3] "forecast" "lowerci" "upperci"
#> ..$ rsd: Time-Series [1:144] from 1949 to 1961: -0.000686 0.006451 -0.005287 0.008333 -0.009011 ...
#> ..$ s10: Time-Series [1:144] from 1949 to 1961: 0.902 0.954 1.07 1.002 0.949 ...
#> ..$ s11: Time-Series [1:144] from 1949 to 1961: 123 125 125 128 127 ...
#> ..$ s12: Time-Series [1:144] from 1949 to 1961: 123 124 126 127 127 ...
#> ..$ s13: Time-Series [1:144] from 1949 to 1961: 0.998 1.004 0.996 1.006 1.003 ...
#> ..$ s16: Time-Series [1:144] from 1949 to 1961: 0.913 0.946 1.055 1.012 0.95 ...
#> ..$ s18: Time-Series [1:144] from 1949 to 1961: 0.913 0.946 1.055 1.012 0.95 ...
#> $ udg : Named chr [1:344] "Aug 6, 2022" "09.41.27" "1.1" "57" ...
#> ..- attr(*, "names")= chr [1:344] "date" "time" "version" "build" ...
#> $ data : Time-Series [1:144, 1:6] from 1949 to 1961: 123 125 125 128 127 ...
#> ..- attr(*, "dimnames")=List of 2
#> .. ..$ : NULL
#> .. ..$ : chr [1:6] "final" "seasonal" "seasonaladj" "trend" ...
#> $ err :List of 3
#> ..$ error : list()
#> ..$ warning: list()
#> ..$ note : list()
#> ..- attr(*, "class")= chr "x13messages"
#> $ est :List of 5
#> ..$ reg :'data.frame': 3 obs. of 5 variables:
#> .. ..$ group : chr [1:3] "1-Coefficient Trading Day" "Easter[1]" "Automatically Identified Outliers"
#> .. ..$ variable : chr [1:3] "Weekday" "Easter[1]" "AO1951.May"
#> .. ..$ estimate : chr [1:3] "-0.294969914081430E-02" "+0.177673735674792E-01" "+0.100155824411322E+00"
#> .. ..$ standard.error: chr [1:3] "+0.523191799014611E-03" "+0.715802978553251E-02" "+0.204386646810968E-01"
#> .. ..$ fixed : chr [1:3] " " " " " "
#> ..$ arima :'data.frame': 2 obs. of 7 variables:
#> .. ..$ operator : chr [1:2] "MA" "MA"
#> .. ..$ factor : chr [1:2] "Nonseasonal" "Seasonal"
#> .. ..$ period : chr [1:2] "01" "12"
#> .. ..$ lag : chr [1:2] "01" "12"
#> .. ..$ estimate : chr [1:2] "+0.11562041392576E+00" "+0.49736001930226E+00"
#> .. ..$ standard.error: chr [1:2] "+0.85858806039688E-01" "+0.77467729778807E-01"
#> .. ..$ fixed : chr [1:2] " " " "
#> ..$ variance :'data.frame': 2 obs. of 2 variables:
#> .. ..$ V1: chr [1:2] "mle" "se"
#> .. ..$ V2: num [1:2] 0.000954 0.000118
#> ..$ coefficients: Named num [1:5] -0.00295 0.01777 0.10016 0.11562 0.49736
#> .. ..- attr(*, "names")= chr [1:5] "Weekday" "Easter[1]" "AO1951.May" "MA-Nonseasonal-01" ...
#> ..$ se : Named num [1:5] 0.000523 0.007158 0.020439 0.085859 0.077468
#> .. ..- attr(*, "names")= chr [1:5] "Weekday" "Easter[1]" "AO1951.May" "MA-Nonseasonal-01" ...
#> $ model :List of 2
#> ..$ regression:List of 2
#> .. ..$ variables: chr [1:3] "td1coef" "easter[1]" "ao1951.May"
#> .. ..$ b : num [1:3] -0.00295 0.01777 0.10016
#> ..$ arima :List of 2
#> .. ..$ model: chr "(0 1 1)(0 1 1)"
#> .. ..$ ma : num [1:2] 0.116 0.497
#> ..- attr(*, "class")= chr [1:2] "spclist" "list"
#> $ fivebestmdl: chr [1:11] "<p>Best Five ARIMA Models</p>" "" "<p class=\"indent\">" " Model # 1 : (0 1 0)(0 1 1) (<abbr title=\"Bayesian information criterion 2\">BIC2</abbr> = -4.007) <br> " ...
#> $ wdir : chr "/var/folders/lk/w50zlm7n5sl0nbp83vn3wgb00000gn/T//RtmpRuE4xv/x13114ad13fa2378"
#> $ iofile : chr "/var/folders/lk/w50zlm7n5sl0nbp83vn3wgb00000gn/T//RtmpRuE4xv/x13114ad13fa2378/iofile"
#> $ call : language seas(x = AirPassengers, transform.function = "log", forecast.maxlead = 36, forecast.save = "fct")
#> $ list :List of 4
#> ..$ x : Time-Series [1:144] from 1949 to 1961: 112 118 132 129 121 135 148 148 136 119 ...
#> ..$ transform.function: chr "log"
#> ..$ forecast.maxlead : num 36
#> ..$ forecast.save : chr "fct"
#> $ x : Time-Series [1:144] from 1949 to 1961: 112 118 132 129 121 135 148 148 136 119 ...
#> $ spc :List of 9
#> ..$ series :List of 4
#> .. ..$ title : chr "\"iofile\""
#> .. ..$ file : chr "\"/var/folders/lk/w50zlm7n5sl0nbp83vn3wgb00000gn/T//RtmpRuE4xv/x13114ad13fa2378/iofile.dta\""
#> .. ..$ format: chr "\"datevalue\""
#> .. ..$ period: num 12
#> ..$ transform :List of 2
#> .. ..$ function: chr "log"
#> .. ..$ print : chr "aictransform"
#> ..$ seats :List of 2
#> .. ..$ noadmiss: chr "yes"
#> .. ..$ save : chr [1:6] "s10" "s11" "s12" "s13" ...
#> ..$ regression:List of 1
#> .. ..$ aictest: chr [1:2] "td" "easter"
#> ..$ outlier : list()
#> ..$ automdl :List of 1
#> .. ..$ print: chr "bestfivemdl"
#> ..$ forecast :List of 2
#> .. ..$ maxlead: num 36
#> .. ..$ save : chr "fct"
#> ..$ estimate :List of 1
#> .. ..$ save: chr [1:3] "model" "estimates" "residuals"
#> ..$ spectrum :List of 1
#> .. ..$ print: chr "qs"
#> ..- attr(*, "class")= chr [1:2] "spclist" "list"
#> - attr(*, "class")= chr "seas"
tsibble::as_tsibble(seas_fcast$series$fct) %>% autoplot()
#> Plot variable not specified, automatically selected `.vars = value`AirPassengers %>%
tsibble::as_tsibble() %>%
model(
seats = X_13ARIMA_SEATS(value ~ transform(`function` = "log") + forecast(maxlead = 36,save = "fct"))
) %>%
components() -> out_mod
out_mod %>%
str()
#> dcmp_ts [144 × 7] (S3: dcmp_ts/tbl_ts/tbl_df/tbl/data.frame)
#> $ .model : chr [1:144] "seats" "seats" "seats" "seats" ...
#> $ index : mth [1:144] 1949 Jan, 1949 Feb, 1949 Mar, 1949 Apr, 1949 May, 1949 Jun...
#> $ value : num [1:144] 112 118 132 129 121 135 148 148 136 119 ...
#> $ trend : num [1:144] 123 124 126 127 127 ...
#> $ seasonal : num [1:144] 0.913 0.946 1.055 1.012 0.95 ...
#> $ irregular : num [1:144] 0.998 1.004 0.996 1.006 1.003 ...
#> $ season_adjust: num [1:144] 123 125 125 128 127 ...
#> - attr(*, "key")= tibble [1 × 2] (S3: tbl_df/tbl/data.frame)
#> ..$ .model: chr "seats"
#> ..$ .rows : list<int> [1:1]
#> .. ..$ : int [1:144] 1 2 3 4 5 6 7 8 9 10 ...
#> .. ..@ ptype: int(0)
#> ..- attr(*, ".drop")= logi TRUE
#> - attr(*, "index")= chr "index"
#> ..- attr(*, "ordered")= logi TRUE
#> - attr(*, "index2")= chr "index"
#> - attr(*, "interval")= interval [1:1] 1M
#> ..@ .regular: logi TRUE
#> - attr(*, "method")= chr "X-13ARIMA-SEATS"
#> - attr(*, "response")= chr "value"
#> - attr(*, "seasons")=List of 1
#> ..$ seasonal:List of 2
#> .. ..$ period: int 12
#> .. ..$ base : num 0
#> - attr(*, "aliases")=List of 2
#> ..$ season_adjust: language f(trend, irregular)
#> ..$ value : language f(trend, seasonal, irregular)Created on 2022-08-06 by the reprex package (v2.0.1)
Metadata
Metadata
Assignees
Labels
No labels
