seasonal: R Interface to X-13-ARIMA-SEATS
季節調整法
- CRAN: http://cran.r-project.org/web/packages/seasonal/index.html
- GitHub: https://github.com/christophsax/seasonal
- URL: http://www.seasonal.website
> library(seasonal)
> data("holiday")
> data("seasonal")
バージョン: 1.2.1
関数名 | 概略 |
---|---|
SPECS |
List of Available X-13ARIMA-SEATS Outputs |
checkX13 |
Check the installation of X-13ARIMA-SEATS |
cpi |
Consumer Price Index of Switzerland |
easter |
Dates of Chinese New Year, Indian Diwali and Easter |
exp |
Exports and Imports of China |
final |
Time Series of a Seasonal Adjustment Model |
genhol |
Generate Holiday Regression Variables |
identify.seas |
Manually Identify Outliers |
iip |
Industrial Production of India |
import.spc |
Import X-13 '.spc' Files (experimental) |
import.ts |
Import Time Series from X-13 Data Files (experimental) |
inspect |
Interactively Inspect a Seasonal Adjustment Model |
na.x13 |
Handle Missing Values by X-13 |
out |
Display X-13ARIMA-SEATS Output |
outlier |
Outlier Time series |
plot.seas |
Seasonal Adjustment Plots |
qs |
Diagnostical Statistics |
seas |
Seasonal Adjustment with X-13ARIMA-SEATS |
seasonal-package |
seasonal: R interface to X-13ARIMA-SEATS |
series |
Import X-13ARIMA-SEATS Output Tables |
static |
Static Call of a seas Object |
summary.seas |
Summary of a X13-ARIMA-SEATS seasonal adjustment |
SPECS
> SPECS %>% head() %>% kable(format = "markdown")
long | short | spec | is.save | is.series | requires |
---|---|---|---|---|---|
automdl.autochoice | ach | automdl | FALSE | FALSE | |
automdl.autochoicemdl | amd | automdl | FALSE | FALSE | |
automdl.autodefaulttests | adt | automdl | FALSE | FALSE | |
automdl.autofinaltests | aft | automdl | FALSE | FALSE | |
automdl.autoljungboxtest | alb | automdl | FALSE | FALSE | |
automdl.bestfivemdl | b5m | automdl | FALSE | FALSE |
cpi
> cpi %>% {
+ print(.)
+ class(.)
+ }
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov
1982
1983 72.1 72.2 72.3 72.6 72.6 72.9 72.8 73.0 73.1 73.3 73.7
1984 74.0 74.3 74.8 74.9 74.7 75.0 74.8 75.1 75.1 75.5 75.9
1985 76.6 77.3 77.7 77.6 77.6 77.5 77.3 77.3 77.6 77.8 78.3
1986 78.3 78.3 78.4 78.4 78.1 78.1 77.7 77.9 78.0 78.0 78.2
1987 78.8 79.1 79.2 79.3 78.8 79.1 79.1 79.4 79.2 79.6 79.9
1988 80.1 80.5 80.7 80.8 80.6 80.7 80.6 80.8 80.9 81.0 81.3
1989 81.9 82.3 82.5 82.9 83.0 83.1 83.0 83.2 83.6 83.9 84.9
1990 86.0 86.3 86.6 86.8 87.2 87.3 87.4 88.3 88.7 89.3 90.0
1991 90.8 91.7 91.7 91.9 92.7 93.1 93.1 93.6 93.8 93.8 95.0
1992 95.2 95.9 96.1 96.3 96.5 96.9 96.6 96.9 97.0 97.1 98.1
1993 98.5 99.1 99.6 99.9 100.0 100.0 99.9 100.4 100.3 100.4 100.3
1994 100.5 100.9 100.9 101.0 100.4 100.5 100.5 100.9 100.9 100.9 100.8
1995 101.5 102.5 102.5 102.6 102.4 102.6 102.5 102.9 103.0 102.8 102.8
1996 103.1 103.3 103.4 103.5 103.2 103.4 103.2 103.5 103.5 103.7 103.5
1997 103.9 104.1 104.0 104.1 103.8 103.9 103.7 104.0 104.0 104.0 103.9
1998 104.0 104.1 104.0 104.1 103.8 104.0 103.8 104.1 104.0 104.0 103.8
1999 104.0 104.4 104.5 104.7 104.4 104.6 104.6 105.1 105.3 105.3 105.2
2000 105.7 106.1 106.0 106.1 106.1 106.5 106.6 106.3 106.8 106.7 107.2
2001 107.1 106.9 107.1 107.4 108.0 108.2 108.0 107.4 107.5 107.4 107.5
2002 107.6 107.6 107.6 108.6 108.7 108.5 107.9 107.9 108.1 108.7 108.5
2003 108.5 108.6 109.1 109.3 109.1 109.1 108.2 108.5 108.6 109.2 109.1
2004 108.7 108.7 109.0 109.9 110.1 110.3 109.2 109.6 109.6 110.6 110.7
2005 110.0 110.3 110.5 111.4 111.3 111.1 110.5 110.6 111.1 112.1 111.8
2006 111.4 111.8 111.7 112.6 112.8 112.8 112.0 112.2 112.0 112.4 112.3
2007 111.6 111.8 111.9 113.1 113.4 113.5 112.8 112.7 112.8 113.8 114.3
2008 114.3 114.4 114.8 115.7 116.6 116.8 116.3 116.0 116.1 116.7 116.0
2009 114.4 114.7 114.3 115.3 115.5 115.7 114.9 115.1 115.1 115.8 116.0
2010 115.6 115.8 115.9 116.9 116.8 116.3 115.4 115.4 115.4 116.0 116.3
2011 115.9 116.3 117.1 117.2 117.2 116.9 116.0 115.6 115.9 115.9 115.7
2012 115.0 115.3 116.0 116.1 116.0 115.7 115.1 115.1 115.5 115.6 115.2
2013 114.7 115.0 115.3 115.3 115.4 115.6 115.1 115.1 115.4 115.3 115.3
Dec
1982 72.2
1983 73.8
1984 75.9
1985 78.4
1986 78.4
1987 79.9
1988 81.4
1989 85.5
1990 90.0
1991 94.7
1992 98.0
1993 100.4
1994 100.8
1995 102.8
1996 103.6
1997 104.0
1998 103.8
1999 105.6
2000 107.1
2001 107.5
2002 108.4
2003 109.1
2004 110.5
2005 111.6
2006 112.3
2007 114.6
2008 115.4
2009 115.7
2010 116.3
2011 115.5
2012 115.0
2013
[1] "ts"
easter
> data("holiday")
> cny
[1] "1931-02-17" "1932-02-06" "1933-01-26" "1934-02-14" "1935-02-04"
[6] "1936-01-24" "1937-02-11" "1938-01-31" "1939-02-19" "1940-02-08"
[11] "1941-01-27" "1942-02-15" "1943-02-04" "1944-01-25" "1945-02-13"
[16] "1946-02-01" "1947-01-22" "1948-02-10" "1949-01-29" "1950-02-17"
[21] "1951-02-06" "1952-01-27" "1953-02-14" "1954-02-03" "1955-01-24"
[26] "1956-02-12" "1957-01-31" "1958-02-18" "1959-02-08" "1960-01-28"
[31] "1961-02-15" "1962-02-05" "1963-01-25" "1964-02-13" "1965-02-02"
[36] "1966-01-21" "1967-02-09" "1968-01-30" "1969-02-17" "1970-02-06"
[41] "1971-01-27" "1972-02-15" "1973-02-03" "1974-01-23" "1975-02-11"
[46] "1976-01-31" "1977-02-18" "1978-02-07" "1979-01-28" "1980-02-16"
[51] "1981-02-05" "1982-01-25" "1983-02-13" "1984-02-02" "1985-02-20"
[56] "1986-02-09" "1987-01-29" "1988-02-17" "1989-02-06" "1990-01-27"
[61] "1991-02-15" "1992-02-04" "1993-01-23" "1994-02-10" "1995-01-31"
[66] "1996-02-19" "1997-02-07" "1998-01-28" "1999-02-16" "2000-02-05"
[71] "2001-01-24" "2002-02-12" "2003-02-01" "2004-01-22" "2005-02-09"
[76] "2006-01-29" "2007-02-18" "2008-02-07" "2009-01-26" "2010-02-14"
[81] "2011-02-03" "2012-01-23" "2013-02-10" "2014-01-31" "2015-02-18"
[86] "2016-02-08" "2017-01-28" "2018-02-15" "2019-02-05" "2020-01-25"
[91] "2021-02-12" "2022-02-01" "2023-01-22" "2024-02-10" "2025-01-29"
[96] "2026-02-17" "2027-02-06" "2028-01-26" "2029-02-13" "2030-02-03"
> diwali
[1] "1900-10-23" "1901-11-11" "1902-10-31" "1903-10-20" "1904-11-07"
[6] "1905-10-28" "1906-10-17" "1907-11-05" "1908-10-25" "1909-11-13"
[11] "1910-11-02" "1911-10-22" "1912-11-09" "1913-10-29" "1914-10-19"
[16] "1915-11-07" "1916-10-26" "1917-11-14" "1918-11-03" "1919-10-23"
[21] "1920-11-10" "1921-10-30" "1922-10-20" "1923-11-08" "1924-10-28"
[26] "1925-10-17" "1926-11-05" "1927-10-25" "1928-11-12" "1929-11-01"
[31] "1930-10-21" "1931-11-09" "1932-10-29" "1933-10-19" "1934-11-07"
[36] "1935-10-27" "1936-11-14" "1937-11-03" "1938-10-23" "1939-11-11"
[41] "1940-10-30" "1941-10-20" "1942-11-08" "1943-10-29" "1944-10-17"
[46] "1945-11-04" "1946-10-24" "1947-11-12" "1948-11-01" "1949-10-21"
[51] "1950-11-09" "1951-10-30" "1952-10-18" "1953-11-06" "1954-10-26"
[56] "1955-11-14" "1956-11-02" "1957-10-23" "1958-11-11" "1959-10-31"
[61] "1960-10-20" "1961-11-08" "1962-10-28" "1963-10-17" "1964-11-04"
[66] "1965-10-24" "1966-11-12" "1967-11-02" "1968-10-21" "1969-11-09"
[71] "1970-10-30" "1971-10-19" "1972-11-06" "1973-10-26" "1974-11-14"
[76] "1975-11-03" "1976-10-23" "1977-11-11" "1978-10-31" "1979-10-21"
[81] "1980-11-07" "1981-10-27" "1982-11-15" "1983-11-04" "1984-10-24"
[86] "1985-11-12" "1986-11-01" "1987-10-22" "1988-11-09" "1989-10-29"
[91] "1990-10-18" "1991-11-06" "1992-10-25" "1993-11-13" "1994-11-03"
[96] "1995-10-23" "1996-11-10" "1997-10-30" "1998-10-19" "1999-11-07"
[101] "2000-10-26" "2001-11-14" "2002-11-04" "2003-10-25" "2004-11-12"
[106] "2005-11-01" "2006-10-21" "2007-11-09" "2008-10-28" "2009-10-17"
[111] "2010-11-05" "2011-10-26" "2012-11-13" "2013-11-02" "2014-10-22"
[116] "2015-11-11" "2016-10-30" "2017-10-19" "2018-11-07" "2019-10-27"
[121] "2020-11-14" "2021-11-04" "2022-10-24" "2023-11-12" "2024-11-01"
[126] "2025-10-21" "2026-11-08" "2027-10-29" "2028-10-17" "2029-11-05"
[131] "2030-10-26"
> easter
[1] "1931-04-05" "1932-03-27" "1933-04-16" "1934-04-01" "1935-04-21"
[6] "1936-04-12" "1937-03-28" "1938-04-17" "1939-04-09" "1940-03-24"
[11] "1941-04-13" "1942-04-05" "1943-04-25" "1944-04-09" "1945-04-01"
[16] "1946-04-21" "1947-04-06" "1948-03-28" "1949-04-17" "1950-04-09"
[21] "1951-03-25" "1952-04-13" "1953-04-05" "1954-04-18" "1955-04-10"
[26] "1956-04-01" "1957-04-21" "1958-04-06" "1959-03-29" "1960-04-17"
[31] "1961-04-02" "1962-04-22" "1963-04-14" "1964-03-29" "1965-04-18"
[36] "1966-04-10" "1967-03-26" "1968-04-14" "1969-04-06" "1970-03-29"
[41] "1971-04-11" "1972-04-02" "1973-04-22" "1974-04-14" "1975-03-30"
[46] "1976-04-18" "1977-04-10" "1978-03-26" "1979-04-15" "1980-04-06"
[51] "1981-04-19" "1982-04-11" "1983-04-03" "1984-04-22" "1985-04-07"
[56] "1986-03-30" "1987-04-19" "1988-04-03" "1989-03-26" "1990-04-15"
[61] "1991-03-31" "1992-04-19" "1993-04-11" "1994-04-03" "1995-04-16"
[66] "1996-04-07" "1997-03-30" "1998-04-12" "1999-04-04" "2000-04-23"
[71] "2001-04-15" "2002-03-31" "2003-04-20" "2004-04-11" "2005-03-27"
[76] "2006-04-16" "2007-04-08" "2008-03-23" "2009-04-12" "2010-04-04"
[81] "2011-04-24" "2012-04-08" "2013-03-31" "2014-04-20" "2015-04-05"
[86] "2016-03-27" "2017-04-16" "2018-04-01" "2019-04-21" "2020-04-12"
[91] "2021-04-04" "2022-04-17" "2023-04-09" "2024-03-31" "2025-04-20"
[96] "2026-04-05" "2027-03-28" "2028-04-16" "2029-04-01" "2030-04-21"
inspect
> # Shinyが起動
> seas(AirPassengers) %>% inspect()
outlier
時系列データの外れ値検出
> seas(AirPassengers) %>% outlier()
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
1949 NA NA NA NA NA NA NA NA NA NA NA NA
1950 NA NA NA NA NA NA NA NA NA NA NA NA
1951 NA NA NA NA AO NA NA NA NA NA NA NA
1952 NA NA NA NA NA NA NA NA NA NA NA NA
1953 NA NA NA NA NA NA NA NA NA NA NA NA
1954 NA NA NA NA NA NA NA NA NA NA NA NA
1955 NA NA NA NA NA NA NA NA NA NA NA NA
1956 NA NA NA NA NA NA NA NA NA NA NA NA
1957 NA NA NA NA NA NA NA NA NA NA NA NA
1958 NA NA NA NA NA NA NA NA NA NA NA NA
1959 NA NA NA NA NA NA NA NA NA NA NA NA
1960 NA NA NA NA NA NA NA NA NA NA NA NA
seas
Arguments
- x
- xreg
- xtrans
- seats.noadmiss
- transform.function
- regression.aictest
- outlier
- automdl
- na.action
- out
- dir
- ...
- list
> seas(AirPassengers) %>% {
+ m <<- .
+ final(.) %>% print()
+ summary(.) %>% print()
+ # plot(., trend = TRUE)
+ }
Jan Feb Mar Apr May Jun Jul
1949 122.7133 124.7657 125.0734 127.5286 127.3584 126.1729 125.1457
1950 126.9652 133.9356 134.0148 132.9366 133.2807 139.1178 142.9399
1951 160.0289 160.6949 165.2095 165.3571 182.2769 163.9040 168.6223
1952 188.1778 190.2422 182.6815 182.7733 189.9504 199.0013 195.4762
1953 214.9681 219.4743 227.0110 235.6320 231.6708 221.9571 221.1423
1954 222.8428 215.8288 232.1046 229.5814 235.9381 238.6981 245.3815
1955 263.2717 269.4386 267.8543 271.6152 274.9857 282.5125 288.8002
1956 311.6350 312.2992 313.8468 323.5312 326.4293 329.7704 327.8913
1957 349.8119 353.0661 359.7925 360.1808 364.7847 367.1797 369.2604
1958 378.0331 375.5824 370.9383 362.8547 369.7736 382.4193 386.5488
1959 397.5069 406.2698 416.8007 417.8449 420.8383 419.4645 429.9997
1960 456.2693 452.9980 447.8696 471.4062 475.5142 475.0558 477.3729
Aug Sep Oct Nov Dec
1949 126.7024 128.8169 129.1127 131.6409 130.4162
1950 145.0604 148.4848 145.6924 144.5891 153.0516
1951 169.8626 172.4565 178.2798 183.9488 181.2071
1952 201.6016 200.7790 209.6572 212.0677 216.6910
1953 224.8974 226.8532 229.2295 224.6545 225.5820
1954 242.5199 246.9733 246.9832 256.0337 257.4320
1955 287.3755 296.9456 295.7621 299.2314 310.4833
1956 331.2443 330.7961 336.1438 342.1775 340.5172
1957 372.0201 378.9032 378.3931 380.3348 378.8534
1958 393.5585 382.9308 390.9163 383.5082 385.2432
1959 433.9810 439.0853 437.8677 450.7845 461.3548
1960 479.9277 481.6406 489.6361 489.7574 487.5447
Call:
seas(x = AirPassengers)
Coefficients:
Estimate Std. Error z value Pr(>|z|)
Weekday -0.0029497 0.0005232 -5.638 0.000000017214
Easter[1] 0.0177674 0.0071580 2.482 0.0131
AO1951.May 0.1001558 0.0204387 4.900 0.000000956848
MA-Nonseasonal-01 0.1156204 0.0858588 1.347 0.1781
MA-Seasonal-12 0.4973600 0.0774677 6.420 0.000000000136
SEATS adj. ARIMA: (0 1 1)(0 1 1) Obs.: 144 Transform: log
AICc: 947.3, BIC: 963.9 QS (no seasonality in final): 0
Box-Ljung (no autocorr.): 26.65 Shapiro (normality): 0.9908
> series(m, "forecast.forecasts")
specs have been added to the model: forecast
forecast lowerci upperci
Jan 1961 444.2964 418.1670 472.0585
Feb 1961 413.5093 381.4051 448.3158
Mar 1961 465.5498 422.4688 513.0240
Apr 1961 497.5508 445.3449 555.8766
May 1961 498.3558 440.6152 563.6630
Jun 1961 575.2956 503.0633 657.8994
Jul 1961 670.7166 580.5151 774.9337
Aug 1961 654.9312 561.3962 764.0501
Sep 1961 556.7305 472.9611 655.3369
Oct 1961 490.9876 413.5452 582.9322
Nov 1961 422.5169 352.9779 505.7555
Dec 1961 478.1585 396.3657 576.8297
Jan 1962 481.0627 391.6394 590.9040
Feb 1962 452.3742 362.7822 564.0917
Mar 1962 514.5911 406.8467 650.8694
Apr 1962 538.7240 420.2625 690.5767
May 1962 545.1952 419.9158 707.8509
Jun 1962 635.8976 483.9242 835.5973
Jul 1962 726.2196 546.2771 965.4347
Aug 1962 716.4868 532.9609 963.2101
Sep 1962 615.3769 452.8749 836.1884
Oct 1962 531.6177 387.1698 729.9571
Nov 1962 462.2284 333.2868 641.0547
Dec 1962 523.0996 373.5303 732.5597
Jan 1963 526.2768 369.1401 750.3038
Feb 1963 494.8919 341.6832 716.7984
Mar 1963 568.7985 386.7674 836.5021
Apr 1963 583.3043 390.8428 870.5389
May 1963 596.4370 394.0242 902.8305
Jun 1963 702.8835 458.0716 1078.5327
Jul 1963 786.3155 505.6679 1222.7235
Aug 1963 791.9620 502.8166 1247.3808
Sep 1963 666.3004 417.7790 1062.6581
Oct 1963 581.5833 360.2171 938.9870
Nov 1963 510.9198 312.7342 834.6995
Dec 1963 566.3870 342.6866 936.1157
static
> seas(AirPassengers) %>% static()
seas(x = AirPassengers, regression.variables = c("td1coef", "easter[1]",
"ao1951.May"), arima.model = "(0 1 1)(0 1 1)", regression.aictest = NULL,
outlier = NULL, transform.function = "log")