christophsax / seasonal

R interface to X-13ARIMA-SEATS
www.seasonal.website
120 stars 27 forks source link

Issues with reevaluation within the series function #289

Open bcmonsell opened 2 years ago

bcmonsell commented 2 years ago

Recently, I've experienced problems with using the series function when I haven't saved the series in the original seas object.

For example, I specify

m_air_1 <- seasonal::seas(AirPassengers, arima.model = '(0 1 1)(0 1 1)', x11='') air1_b1 <- seasonal::series(m_air_1, "b1") I get the following error message:

Error in reeval_dots(x = x, series.short = series.short, verbose = verbose) : not unique.

But this works

m_air_2 <- seasonal::seas(AirPassengers, series.save = "b1", arima.model = '(0 1 1)(0 1 1)', x11='') air2_b1 <- seasonal::series(m_air_2, "b1")

christophsax commented 2 years ago

For some reason, I used to think that the short names were unique, but apparently they are not. b1 refers to series.adjoriginal and composite.adjcompositesrs. Since they are used internally, the following fails too (once fixed, this will be probably the way to resolve the ambiguity):

library(seasonal)
m_air_1 <- seasonal::seas(AirPassengers, arima.model = '(0 1 1)(0 1 1)', x11='') 
seasonal::series(m_air_1, "series.adjoriginal") 
#> Error in reeval_dots(x = x, series.short = series.short, verbose = verbose): not unique.

This only was introduced in the latest release with the new composite series.

For now, you can, of course, do:

m_air_1 <- seasonal::seas(AirPassengers, arima.model = '(0 1 1)(0 1 1)', x11='', series.save = "b1") 
seasonal::series(m_air_1, "b1") 
#>           Jan      Feb      Mar      Apr      May      Jun      Jul      Aug
#> 1949 110.6863 119.0536 133.8041 127.8250 120.8217 135.7988 146.2640 149.3155
#> 1950 114.8305 127.1250 142.9272 132.3964 126.1110 149.8816 168.0060 171.5110
#> 1951 146.2888 151.3393 175.4348 164.4106 156.9910 177.2142 198.7067 200.7688
#> 1952 172.5199 175.8628 191.6398 181.2125 182.7303 217.0376 232.0443 239.1615
#> 1953 195.7111 197.7500 236.7685 235.2759 226.3140 244.4378 266.3465 268.8096
#> 1954 201.6072 189.6786 238.2119 227.2665 231.2553 265.5620 301.5549 292.5682
#> 1955 239.1615 235.0804 270.6493 266.5497 269.6021 316.8638 359.7305 350.0843
#> 1956 283.5815 270.6333 312.4316 315.7087 320.8265 372.3489 412.3913 408.5998
#> 1957 317.7998 303.6875 353.4910 348.4085 358.1554 415.8218 469.1331 466.3118
#> 1958 343.0220 320.8393 359.4487 348.4085 362.4650 433.0796 495.3642 499.0766
#> 1959 359.4694 345.0536 400.1490 403.5720 415.0736 474.7927 552.8708 552.4433
#> 1960 412.1088 382.0131 424.7268 456.8008 471.3044 538.1655 614.7043 611.3863
#>           Sep      Oct      Nov      Dec
#> 1949 136.8047 117.6042 104.6153 117.8261
#> 1950 157.3025 132.8040 114.6745 138.3579
#> 1951 181.3062 163.4399 146.8639 164.0529
#> 1952 210.2366 192.6977 169.4819 195.7243
#> 1953 238.4023 210.6890 179.2053 202.7866
#> 1954 260.5325 226.3140 204.2011 231.0354
#> 1955 313.8460 270.7861 238.4023 277.5903
#> 1956 349.8027 308.7198 272.6035 302.4108
#> 1957 402.2164 350.0843 303.6535 335.5048
#> 1958 406.3904 362.1909 305.4615 339.9954
#> 1959 465.7395 406.4002 360.4019 408.5998
#> 1960 511.0057 455.5927 392.3076 431.3633

I will address this together with: https://github.com/christophsax/seasonal/issues/250.

The goal should be to have a more systematic extraction of this information from the manual. Ideally, we would also like to have the description of each series somewhere in the ?series documentation.

bcmonsell commented 2 years ago

Within an X-13 context, there isn't a uniqueness issue since the composite and series specs can never appear in the same spec file.

Adding the series tables to the composite spec allows X-13 users to access those tables when doing composite adjustment.

bcmonsell commented 2 years ago

Also, looking at the documentation for the series function, the only table this applies to is the B1 table.