Dynamic Linear Model for Time Series Data
\[ \begin{aligned} Y_{t}&=F_{t}\theta_{t}+v_{t},~~~~~~~v_{t}\sim N_{m}(0,V_{t}), \\ \theta_{t}&=G_{t}\theta_{t-1}+\omega_{t},~~~\omega_{t}\sim N_{p}(0,W_{t}). \end{aligned} \]
decompose()
를 이용하여 데이터를 추세와 계절성, 불규칙 성분으로 나눌 수 있다.\[ \begin{aligned} Y_{t}&=\mu_{t}+v_{t},~~~~~~~v_{t}\sim N_{m}(0,V), \\ \mu_{t}&=\mu_{t-1}+\omega_{t},~~~\omega_{t}\sim N_{p}(0,W). \end{aligned} \]
dlm
package에 dlmModPoly(1)
은 local level model이다.\[ \begin{aligned} Y_{t}&=\mu_{t}+v_{t},~~~~~~~v_{t}\sim N_{m}(0,V), \\ \mu_{t}&=\mu_{t-1}+\beta_{t-1}+\omega_{t,1},~~~\omega_{t,1}\sim N_{p}(0,\sigma^2_{\mu}),\\ \beta_{t}&=\beta_{t-1}+\omega_{t,2},~~~\omega_{t,2}\sim N_{p}(0,\sigma^2_{\beta}). \end{aligned} \]
dlm
package에 dlmModPoly(2)
은 local linear trend model이다.library(dlm)
model1 <- function(p){
mod <- dlmModPoly(2) + # Local Trend Linear
dlmModSeas(12) # 주기 12
V(mod) <- exp(p[1])
diag(W(mod))[1:3] <- exp(p[2:4])
return(mod)
}
dlm
package에 dlmMLE()
을 이용하여 MLE를 얻을 수 있다.mle1 <- dlmMLE(train.ts, parm=c(0.1,0.1,1,1), build=model1 ) # Estimation parameter through MLE. Parameter=Variance of error
ifelse(mle1$convergence==0, print("converge"), print("did not converge") ) # Check Convergence
[1] "converge"
[1] "converge"
modelfit1 <- model1(mle1$par) # Fitting the DLM
V(modelfit1)
[,1]
[1,] 1413.91
W(modelfit1)
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,] 1143.988 0.0000000 0.00000 0 0 0 0 0 0 0
[2,] 0.000 0.2040261 0.00000 0 0 0 0 0 0 0
[3,] 0.000 0.0000000 14.47867 0 0 0 0 0 0 0
[4,] 0.000 0.0000000 0.00000 0 0 0 0 0 0 0
[5,] 0.000 0.0000000 0.00000 0 0 0 0 0 0 0
[6,] 0.000 0.0000000 0.00000 0 0 0 0 0 0 0
[7,] 0.000 0.0000000 0.00000 0 0 0 0 0 0 0
[8,] 0.000 0.0000000 0.00000 0 0 0 0 0 0 0
[9,] 0.000 0.0000000 0.00000 0 0 0 0 0 0 0
[10,] 0.000 0.0000000 0.00000 0 0 0 0 0 0 0
[11,] 0.000 0.0000000 0.00000 0 0 0 0 0 0 0
[12,] 0.000 0.0000000 0.00000 0 0 0 0 0 0 0
[13,] 0.000 0.0000000 0.00000 0 0 0 0 0 0 0
[,11] [,12] [,13]
[1,] 0 0 0
[2,] 0 0 0
[3,] 0 0 0
[4,] 0 0 0
[5,] 0 0 0
[6,] 0 0 0
[7,] 0 0 0
[8,] 0 0 0
[9,] 0 0 0
[10,] 0 0 0
[11,] 0 0 0
[12,] 0 0 0
[13,] 0 0 0
dlm
package의 dlmFilter()
를 이용하여 kalman filtering을 수행할 수 있다.List of 9
$ y : Time-Series [1:123] from 1991 to 2001: 1709 1621 1973 1812 1975 ...
$ mod:List of 10
..- attr(*, "class")= chr "dlm"
$ m : Time-Series [1:124, 1:13] from 1991 to 2001: 0 263 1477 2060 2237 ...
$ U.C:List of 124
$ D.C: num [1:124, 1:13] 3162.3 26.6 23.4 21.4 19.3 ...
$ a : Time-Series [1:123, 1:13] from 1991 to 2001: 0 394 2049 2636 2683 ...
$ U.R:List of 123
$ D.R: num [1:123, 1:13] 10916 8163 5192 4498 4165 ...
$ f : Time-Series [1:123] from 1991 to 2001: 0 263 1954 2542 2578 ...
- attr(*, "class")= chr "dlmFiltered"
filtering$y
Jan Feb Mar Apr May Jun Jul
1991 1708.917 1620.586 1972.715 1811.665 1974.964 1862.356 1939.860
1992 1614.827 1557.088 1891.223 1955.981 1884.714 1623.042 1903.309
1993 1705.259 1618.535 1836.709 1957.043 1917.185 1882.398 1933.009
1994 1563.365 1573.959 1902.639 1833.888 1831.049 1775.755 1867.508
1995 1548.415 1496.925 1798.316 1732.895 1772.345 1761.207 1791.655
1996 1381.758 1360.852 1558.575 1608.420 1696.696 1693.183 1835.516
1997 1396.588 1371.690 1707.522 1654.604 1762.903 1775.800 1934.219
1998 1570.330 1412.691 1754.641 1824.932 1843.289 1825.964 1968.172
1999 1599.427 1548.804 1832.333 1839.720 1846.498 1864.852 1965.743
2000 1541.660 1616.928 1919.538 1971.493 1992.301 2009.763 2053.996
2001 1683.148 1663.404 2007.928
Aug Sep Oct Nov Dec
1991 2013.264 1595.657 1724.924 1675.667 1813.863
1992 1996.712 1703.897 1810.000 1861.601 1875.122
1993 1996.167 1672.841 1752.827 1720.377 1734.292
1994 1906.608 1685.632 1778.546 1775.995 1783.350
1995 1874.820 1571.309 1646.948 1672.631 1656.845
1996 1942.573 1551.401 1686.508 1576.204 1700.433
1997 2008.055 1615.924 1773.910 1732.368 1796.626
1998 1921.645 1669.597 1791.474 1816.714 1846.754
1999 1949.002 1607.373 1803.664 1850.309 1836.435
2000 2097.471 1823.706 1976.997 1981.408 2000.153
2001
filtering$m
[,1] [,2] [,3] [,4]
Dec 1990 0.0000 0.00000000 0.0000000 0.0000000
Jan 1991 262.9201 131.45255272 1445.9782703 -131.4525527
Feb 1991 1476.8170 571.74869261 143.7352725 803.8625714
Mar 1991 2060.3500 576.13321930 -87.6359341 136.3373907
Apr 1991 2237.2100 446.14979550 -425.4996685 181.5776531
May 1991 2385.8677 362.60860175 -410.8614818 -211.6142199
Jun 1991 2401.0946 278.08632437 -538.6793347 -148.0882208
Jul 1991 2424.6579 223.86256634 -484.7468721 -338.4502888
Aug 1991 2455.6739 187.47536594 -442.3652688 -328.3461270
Sep 1991 2322.8861 133.37877892 -727.1449006 -176.3051709
Oct 1991 2262.8372 103.85035440 -537.8560730 -563.3153490
Nov 1991 2199.5074 80.59240254 -523.7855314 -393.9988782
Dec 1991 2187.4420 68.76012370 -373.5454858 -442.9986408
Jan 1992 1758.4610 -7.79796175 -143.4933161 47.4633017
Feb 1992 1764.1211 -6.52855213 -212.3778196 -146.0151113
Mar 1992 1754.4566 -6.74330687 138.1708580 -211.4931427
Apr 1992 1850.1970 -0.71397510 59.7619129 106.0490927
May 1992 1784.2186 -4.31300134 129.6817089 80.8835588
Jun 1992 1682.8321 -9.52788355 -16.4587139 161.4112532
Jul 1992 1726.6984 -6.68851443 152.7877762 -33.9613840
Aug 1992 1752.0489 -4.99112401 230.3685279 142.2780734
Sep 1992 1818.3872 -1.21683610 -146.3164463 206.9681827
Oct 1992 1836.3837 -0.20048676 -34.9567937 -152.6195303
Nov 1992 1890.9173 2.69491388 -53.7386506 -52.9127630
Dec 1992 1858.6399 0.84468898 32.0863375 -42.2652516
Jan 1993 1853.2098 0.46507386 -145.2878076 34.2870337
Feb 1993 1844.8289 0.07146788 -221.5446790 -143.8436169
Mar 1993 1779.4310 -2.40382931 93.2331456 -208.9065938
Apr 1993 1832.8733 -0.43847445 93.5328089 81.8687946
May 1993 1813.8261 -1.07437031 113.5513215 97.3828603
Jun 1993 1881.3442 1.24290741 -36.4930956 99.2892044
Jul 1993 1846.7681 0.03774376 105.8452432 -29.0358588
Aug 1993 1821.4646 -0.81391069 188.5719385 111.1222394
Sep 1993 1825.7177 -0.64362476 -155.6499781 187.5167950
Oct 1993 1808.6432 -1.19601945 -46.8235668 -152.2283494
Nov 1993 1783.1737 -2.01246514 -49.5124028 -41.7682310
Dec 1993 1740.1727 -3.39252386 16.5478228 -40.9726284
Jan 1994 1724.6768 -3.84210018 -154.8227923 19.2139087
Feb 1994 1761.5921 -2.61091076 -211.5445695 -160.3479027
Mar 1994 1791.5335 -1.72462862 91.8331585 -216.4244087
Apr 1994 1761.8825 -2.45216408 88.5250677 96.1653771
May 1994 1738.3925 -2.99073653 105.0911583 91.8235633
Jun 1994 1767.7061 -2.16900680 -11.0395478 100.0110208
Jul 1994 1756.8877 -2.38860650 115.7308994 -9.6784956
Aug 1994 1731.1753 -2.98070317 189.2139325 119.4011885
Sep 1994 1782.1713 -1.60972790 -128.4318968 180.7202967
Oct 1994 1797.7186 -1.17363164 -29.3095243 -131.1318462
Nov 1994 1807.0900 -0.90538924 -37.3250324 -30.9692923
Dec 1994 1786.0676 -1.41802003 9.1652180 -34.1563741
Jan 1995 1744.2986 -2.52236342 -172.3045139 15.8038028
Feb 1995 1727.0069 -2.87163367 -221.0397644 -170.5657882
Mar 1995 1715.1770 -3.06865354 88.6502148 -219.9110253
Apr 1995 1678.8704 -3.77808015 74.4605997 92.9419737
May 1995 1676.6656 -3.74488235 94.7126076 74.2559500
Jun 1995 1728.0172 -2.58668595 -0.6640731 87.5320763
Jul 1995 1699.7502 -3.12611529 107.6837589 2.6836394
Aug 1995 1694.3534 -3.17383166 181.8617503 107.9797335
Sep 1995 1694.4186 -3.10570744 -125.0997161 181.4395697
Oct 1995 1679.6253 -3.35176305 -25.4964015 -123.5761780
Nov 1995 1688.6987 -3.08992098 -23.7013532 -27.1165158
Dec 1995 1660.1596 -3.62745462 12.3172866 -20.3797159
Jan 1996 1600.2927 -4.87900910 -184.2147227 19.9122788
Feb 1996 1589.5958 -4.99548293 -225.0934080 -183.5967000
Mar 1996 1524.4643 -6.13727336 71.9561763 -218.3885713
Apr 1996 1531.3518 -5.89520732 68.8749257 70.4770204
May 1996 1570.7460 -5.06002885 97.4696759 63.7040787
Jun 1996 1631.9787 -3.84028550 19.5195821 89.8917901
Jul 1996 1678.1645 -2.91990304 125.8952139 13.8009724
Aug 1996 1715.8364 -2.17252892 201.2123849 121.2558218
Sep 1996 1686.7106 -2.66930436 -118.3616131 204.2927963
Oct 1996 1693.8193 -2.48888869 -13.4594157 -119.4792464
Nov 1996 1635.8979 -3.51282856 -24.8419169 -7.1214266
Dec 1996 1658.9220 -3.02136177 24.8299907 -27.8797420
Jan 1997 1616.4701 -3.78013311 -195.2017373 29.4669429
Feb 1997 1606.5541 -3.88939285 -230.9539355 -194.5966361
Mar 1997 1628.1683 -3.45290398 63.0675907 -233.5599598
Apr 1997 1611.5050 -3.67547497 51.5320620 64.4368656
May 1997 1645.6997 -3.04087550 93.0336323 47.5912144
Jun 1997 1706.9367 -1.96513254 27.8417756 86.3399772
Jul 1997 1759.6055 -1.05048085 139.7463137 22.1531545
Aug 1997 1779.0382 -0.70724177 215.9442994 137.6139993
Sep 1997 1750.3748 -1.17623032 -116.6093318 218.8543612
Oct 1997 1765.4836 -0.90272078 -1.9662123 -118.3047303
Nov 1997 1760.8562 -0.96535183 -26.1113393 -1.5783042
Dec 1997 1765.2376 -0.87519812 27.9771395 -26.6689333
Jan 1998 1767.3825 -0.82282458 -198.9736169 27.6553811
Feb 1998 1703.8718 -1.84944592 -250.8120176 -193.1143641
Mar 1998 1700.8521 -1.86804190 54.5436204 -250.6997003
Apr 1998 1746.7049 -1.11855857 47.4584612 49.9112177
May 1998 1753.9805 -0.98722553 83.8972192 46.6412012
Jun 1998 1780.4087 -0.55856121 27.8821334 81.2269859
Jul 1998 1805.9195 -0.15071179 145.4468477 25.3436210
Aug 1998 1748.6509 -1.04521064 209.8155931 151.0073730
Sep 1998 1768.8039 -0.71285595 -112.8724300 207.7520438
Oct 1998 1781.2666 -0.50604801 1.7141435 -114.1551882
Nov 1998 1813.9979 0.01628816 -18.7083317 -1.5230835
Dec 1998 1815.3460 0.03727573 30.5496682 -18.8382362
Jan 1999 1803.8484 -0.14827519 -197.0032384 31.6941316
Feb 1999 1803.2476 -0.15525221 -254.1500154 -196.9625458
Mar 1999 1792.6595 -0.31243207 46.4491255 -253.1928678
Apr 1999 1793.7894 -0.29089409 44.9940423 46.3155818
May 1999 1778.4517 -0.51497418 77.8151376 46.3903161
Jun 1999 1811.3484 -0.01751819 31.8119758 74.7142254
Jul 1999 1814.6498 0.03193061 148.9383869 31.5040438
Aug 1999 1775.1704 -0.55734745 199.4840194 152.6033045
Sep 1999 1746.3727 -0.97899458 -120.6649685 202.1033105
Oct 1999 1778.4140 -0.48543394 3.8126936 -123.7280644
Nov 1999 1827.7355 0.25991971 -9.7602375 -0.8094865
Dec 1999 1814.5611 0.05835557 30.5935124 -8.5116831
Jan 2000 1771.9747 -0.59118735 -202.6785842 34.6115216
Feb 2000 1825.5935 0.20888106 -244.0187607 -207.4193822
Mar 2000 1851.7465 0.58501496 50.8567600 -246.3225776
Apr 2000 1892.1105 1.15780202 53.4219439 47.2978635
May 2000 1905.1803 1.32899841 79.3473500 52.3543654
Jun 2000 1944.2326 1.87115667 40.9136560 75.9665701
Jul 2000 1921.1216 1.51184903 149.1771108 43.1517699
Aug 2000 1908.6864 1.31105755 197.8861984 150.4262707
Sep 2000 1931.7311 1.62427601 -122.2080930 195.9397676
Oct 2000 1957.9722 1.97941456 2.9608197 -124.4130790
Nov 2000 1977.0708 2.22666702 -6.8336449 1.4267632
Dec 2000 1974.0040 2.15003000 29.6025600 -6.3585998
Jan 2001 1930.3543 1.47962479 -217.3605600 33.7582506
Feb 2001 1921.2473 1.32825739 -250.9119895 -216.4531090
Mar 2001 1944.8125 1.64182974 48.5460765 -252.8405287
[,5] [,6] [,7] [,8]
Dec 1990 0.0000000 0.000000 0.00000000 0.0000000
Jan 1991 -131.4525527 -131.452553 -131.45255273 -131.4525527
Feb 1991 -94.7597499 -94.759750 -94.75974986 -94.7597499
Mar 1991 800.8480553 -94.394389 -94.39438913 -94.3943891
Apr 1991 275.5813347 810.140843 -105.22507829 -105.2250783
May 1991 311.9248219 322.405937 773.44384982 -112.1856199
Jun 1991 -33.3683947 405.664417 331.65084011 698.1852928
Jul 1991 -2.0931330 58.409962 443.23706707 315.0226075
Aug 1991 -218.4494553 81.521871 105.64905804 454.1060145
Sep 1991 -116.4121646 -60.616852 185.27170444 155.3285240
Oct 1991 -42.0270642 -11.669849 14.60194879 230.9758917
Nov 1991 -442.7405264 55.279412 62.37964827 65.4031746
Dec 1991 -325.0603306 -385.642316 100.54393965 95.8157928
Jan 1992 -98.6020120 -57.235707 -194.35829953 215.3099913
Feb 1992 40.8705546 -103.926056 -61.29248492 -197.1491089
Mar 1992 -145.3567435 41.818319 -103.19232815 -60.7724279
Apr 1992 -237.1497185 -165.108399 21.37675913 -117.6430374
May 1992 123.2993611 -223.437146 -154.92889609 29.7323457
Jun 1992 106.9955560 144.289366 -207.57517267 -144.1894948
Jul 1992 146.9690689 95.341370 135.42639868 -213.6468930
Aug 1992 -42.6410561 139.955917 89.99665645 131.7501162
Sep 1992 122.9473350 -58.266241 128.04054514 81.7910717
Oct 1992 201.7610055 118.737999 -61.47658858 125.8291790
Nov 1992 -167.4534338 189.769806 109.59277161 -67.7758652
Dec 1992 -43.4344308 -159.791675 195.61290282 113.6172194
Jan 1993 -40.4690632 -42.012350 -158.74412402 196.2858566
Feb 1993 36.2940741 -38.841310 -40.76920332 -157.8854058
Mar 1993 -134.2036299 46.683934 -30.83862711 -35.1672009
Apr 1993 -217.8346827 -141.282165 40.40609951 -35.2224015
May 1993 84.9271281 -215.377532 -139.42714208 41.7962088
Jun 1993 86.0111145 75.743768 -222.36235759 -144.2116971
Jul 1993 105.2421858 90.826388 79.41606825 -219.8352602
Aug 1993 -24.8220966 108.652040 93.42861465 81.2090965
Sep 1993 110.2796885 -25.503908 108.13171253 93.0700849
Oct 1993 190.2488360 112.490281 -23.81717606 109.2935639
Nov 1993 -148.1921384 193.514302 114.98143813 -22.1018351
Dec 1993 -34.9507437 -142.677588 197.71989390 117.8755223
Jan 1994 -38.8572790 -33.263493 -141.42026829 198.5464306
Feb 1994 13.1965470 -43.751835 -37.00232320 -144.0011517
Mar 1994 -163.9474158 9.672028 -46.46323975 -38.8894725
Apr 1994 -213.1687103 -161.338701 11.86872633 -44.9363111
May 1994 98.6633829 -211.152255 -159.80595250 12.9817173
Jun 1994 87.9668675 95.540502 -213.53554846 -161.4462836
Jul 1994 101.0449453 88.804757 96.18081360 -213.0939245
Aug 1994 -6.8902606 103.304629 90.53173114 97.3720847
Sep 1994 112.9495915 -12.117894 99.31058510 87.7782140
Oct 1994 178.6697556 111.288438 -13.38659977 98.4365348
Nov 1994 -132.3922629 177.648886 110.50899646 -13.9232545
Dec 1994 -28.5633751 -130.444287 179.13532685 111.5313103
Jan 1995 -29.1287471 -24.534983 -127.42239231 181.1452760
Feb 1995 17.4163643 -27.813551 -23.52975164 -126.7290584
Mar 1995 -169.7774547 18.151947 -27.24740136 -23.1369437
Apr 1995 -216.8724916 -167.328301 20.16228078 -25.8529983
May 1995 92.7962013 -216.990513 -167.41844005 20.0978714
Jun 1995 69.1322915 88.639528 -220.17234797 -169.6153783
Jul 1995 89.9215340 71.071484 90.12479767 -219.1460132
Aug 1995 2.8948634 90.092923 71.20271512 90.2154266
Sep 1995 107.6785099 2.650527 89.90593588 71.0737104
Oct 1995 182.5263988 108.559809 3.32462612 90.3705479
Nov 1995 -124.7317568 181.589603 107.84357407 2.8313848
Dec 1995 -24.7475767 -122.812276 183.05598042 108.8518573
Jan 1996 -14.9640909 -20.395321 -119.53133297 185.2543196
Feb 1996 20.4149684 -14.553261 -20.08093477 -119.3145938
Mar 1996 -179.2156127 24.383372 -11.49432405 -17.9622130
Apr 1996 -219.3654275 -180.005623 23.74427150 -11.9372098
May 1996 67.0448021 -222.148592 -182.14020151 22.2335011
Jun 1996 58.6677902 62.955397 -225.28882188 -184.3141806
Jul 1996 86.0910574 55.581525 60.58533015 -226.9297030
Aug 1996 10.7184169 83.588879 53.66114182 59.2572798
Sep 1996 123.3019088 12.378541 84.86209301 54.5404362
Oct 1996 203.5506057 122.699962 11.91718368 84.5438699
Nov 1996 -115.2708934 206.962595 125.31362028 13.7180732
Dec 1996 -9.1384147 -116.905179 205.71196190 124.4535589
Jan 1997 -24.7965235 -6.656793 -115.02636118 206.9775538
Feb 1997 29.9046666 -24.438486 -6.38230259 -114.8371300
Mar 1997 -196.1788483 28.501645 -25.52239731 -7.1324970
Apr 1997 -232.7214307 -195.499988 29.04605885 -25.1451711
May 1997 62.0130855 -234.686671 -197.01333829 27.9813464
Jun 1997 43.4707318 58.669243 -237.26313571 -198.8014376
Jul 1997 82.8388488 40.630101 56.48123320 -238.7811160
Aug 1997 20.8413564 81.775071 39.81140007 55.9141292
Sep 1997 139.4035809 22.291800 82.89038449 40.5826689
Oct 1997 217.8120205 138.559173 21.64299260 82.4423771
Nov 1997 -118.0662704 218.005120 138.70744502 21.7452478
Dec 1997 -1.9210989 -118.343655 217.79238391 138.5610663
Jan 1998 -26.8672495 -2.080690 -118.46497670 217.7103054
Feb 1998 31.4583230 -23.759426 0.30763720 -116.8177526
Mar 1998 -193.0512063 31.513359 -23.71679004 0.3371474
Apr 1998 -253.3231041 -195.172199 29.82124451 -24.8898606
May 1998 49.4466639 -253.698971 -195.46279428 29.6175438
Jun 1998 45.1225410 48.217318 -254.64963055 -196.1241814
Jul 1998 79.7838136 43.954784 47.31485870 -255.2771641
Aug 1998 28.5031039 82.338699 45.92720648 48.6837730
Sep 1998 149.8353932 27.555991 81.60824790 45.4212413
Oct 1998 207.0237109 149.247125 27.10269134 81.2947855
Nov 1998 -115.9930608 205.539972 148.10467114 26.3138143
Dec 1998 -1.5968495 -116.052564 205.49421714 148.0731582
Jan 1999 -18.1862229 -1.073332 -115.65296611 205.7656037
Feb 1999 31.7179987 -18.166779 -1.05834699 -115.6426217
Mar 1999 -196.4642987 32.145228 -17.83476680 -0.8283912
Apr 1999 -253.2627938 -196.520608 32.10043537 -17.8658520
May 1999 47.0490502 -252.672020 -196.06206339 32.4212232
Jun 1999 44.7609979 45.736437 -253.69087706 -196.7726779
Jul 1999 74.5525226 44.630803 45.63546762 -253.7612645
Aug 1999 33.4273102 76.099862 45.82937073 46.4691705
Sep 1999 153.9771536 34.531835 76.95445644 46.4225120
Oct 1999 200.4971468 152.686639 33.53430356 76.2633988
Nov 1999 -126.1515745 198.550939 151.18356033 32.4947187
Dec 1999 -0.1546078 -125.626143 198.95613479 151.4630209
Jan 2000 -6.3964049 1.535947 -124.33054760 199.8392710
Feb 2000 32.0819424 -8.445518 -0.04814384 -125.4256028
Mar 2000 -208.5312884 31.143872 -9.17692346 -0.5553712
Apr 2000 -248.0486043 -209.911785 30.04728493 -9.9391015
May 2000 46.7786645 -248.463819 -210.23528349 29.8211343
Jun 2000 50.7102216 45.463838 -249.48820515 -210.9516286
Jul 2000 77.0541915 51.579349 46.14026365 -249.0153550
Aug 2000 43.7583418 77.538489 51.95576174 46.4027565
Sep 2000 149.4816407 43.004728 76.95348060 51.5487812
Oct 2000 194.8699770 148.628741 42.34334526 76.4943021
Nov 2000 -125.1573254 194.276965 148.16932358 42.0249610
Dec 2000 1.6573475 -124.973771 194.41894247 148.2674209
Jan 2001 -4.3335969 3.264038 -123.73760644 195.2646395
Feb 2001 34.2016742 -3.977427 3.54026379 -123.5463077
Mar 2001 -217.3186598 33.483899 -4.53890199 3.1501818
[,9] [,10] [,11] [,12]
Dec 1990 0.0000000 0.0000000 0.00000000 0.0000000
Jan 1991 -131.4525527 -131.4525527 -131.45255273 -131.4525527
Feb 1991 -94.7597499 -94.7597499 -94.75974986 -94.7597499
Mar 1991 -94.3943891 -94.3943891 -94.39438913 -94.3943891
Apr 1991 -105.2250783 -105.2250783 -105.22507829 -105.2250783
May 1991 -112.1856199 -112.1856199 -112.18561992 -112.1856199
Jun 1991 -119.2275345 -119.2275345 -119.22753446 -119.2275345
Jul 1991 627.3447833 -123.7449297 -123.74492967 -123.7449297
Aug 1991 289.5230032 565.4653140 -126.77621671 -126.7762167
Sep 1991 449.7213278 231.0741899 452.93030281 -131.2826077
Oct 1991 171.5236196 436.4094763 188.25415752 380.5872505
Nov 1991 258.5348927 175.8437822 417.49152572 146.0961581
Dec 1991 87.0148834 268.3247593 173.81304639 403.6400734
Jan 1992 134.0777650 48.7779027 153.58519362 -17.4414950
Feb 1992 213.7839964 133.8155754 49.77865403 155.8481662
Mar 1992 -196.8423813 213.8777118 133.69657155 49.4471995
Apr 1992 -69.2443866 -199.3470155 217.32965939 143.0950403
May 1992 -112.8534623 -68.0132790 -201.66723626 211.4648427
Jun 1992 36.3710850 -111.3688044 -71.67190660 -210.4589409
Jul 1992 -147.4730578 35.6581913 -109.28179812 -66.7906577
Aug 1992 -215.6558570 -147.8164654 36.93427645 -106.3354065
Sep 1992 127.2518234 -216.4502638 -144.91056561 43.5125721
Oct 1992 80.5780137 127.0361546 -215.66953133 -143.1342879
Nov 1992 122.3739364 79.9641877 129.26092955 -210.6089574
Dec 1992 -65.5688419 122.7652072 78.54150430 126.0260829
Jan 1993 113.9157074 -65.6446235 122.31535048 77.7177154
Feb 1993 196.7606425 114.0071655 -65.93586012 121.6420417
Mar 1993 -154.6795423 197.5758135 112.43735016 -69.8849379
Apr 1993 -37.6556132 -155.2775472 198.86300175 115.6044841
May 1993 -34.4438183 -37.4876038 -155.71833129 197.8152209
Jun 1993 39.0253800 -34.9922430 -35.81917436 -151.8397349
Jul 1993 -142.8288817 39.2932651 -35.87678827 -37.8528503
Aug 1993 -218.8510695 -142.6523572 38.66371529 -37.3182947
Sep 1993 81.0122923 -218.8863801 -142.52644576 38.9519560
Oct 1993 93.7072888 81.1255995 -219.29601409 -143.4581094
Nov 1993 110.2334308 93.8727883 80.51814061 -220.6749119
Dec 1993 -20.5186849 110.5075094 92.84016489 78.1813705
Jan 1994 118.2713178 -20.5532353 110.04311110 91.9463687
Feb 1994 197.1223836 118.0017478 -19.67115907 112.0738737
Mar 1994 -145.0651607 196.8792948 118.57696420 -18.2803990
Apr 1994 -38.0346268 -144.8804143 196.39630329 117.4287286
May 1994 -44.3187476 -37.9119708 -145.25086298 195.5346642
Jun 1994 12.0541060 -44.4924632 -37.33400587 -143.9241709
Jul 1994 -161.2034313 12.0989711 -44.64837900 -37.6899564
Aug 1994 -212.4386378 -161.0834062 11.67824268 -45.6084367
Sep 1994 95.8597522 -212.7118072 -160.11998007 13.8969606
Oct 1994 87.2990315 95.7747980 -212.40352089 -159.4193865
Nov 1994 98.1427983 87.2478225 95.96551129 -211.9715803
Dec 1994 -13.3653244 98.2370838 86.87960789 95.1361134
Jan 1995 112.5284727 -13.3798763 97.21254886 84.8468315
Feb 1995 181.5266625 112.5985833 -13.62008512 96.6630862
Mar 1995 -126.5096050 181.5732390 112.47293871 -13.9172171
Apr 1995 -22.3626041 -126.3535326 181.11358198 111.4003881
May 1995 -25.8885426 -22.3692944 -126.33148954 181.1642224
Jun 1995 18.8715262 -26.1100367 -21.58928860 -124.5547566
Jul 1995 -169.0492084 18.9730688 -26.47477437 -22.4181629
Aug 1995 -219.0960804 -169.0399434 18.94090847 -26.5480001
Sep 1995 90.1445394 -219.1089350 -168.99488723 19.0451061
Oct 1995 71.3283444 90.1895001 -219.27301582 -169.3674333
Nov 1995 90.1008244 71.2818189 90.36550300 -218.8753160
Dec 1995 3.3804923 90.1913986 70.91521077 89.5434055
Jan 1996 109.9648381 3.4090631 89.13786496 68.7821946
Feb 1996 185.3732046 109.9860538 3.33295185 88.9648428
Mar 1996 -118.1383971 185.6091620 109.28572639 1.7011395
Apr 1996 -18.2068070 -118.1851796 185.75930265 109.6317147
May 1996 -12.7678206 -18.3569217 -117.65786807 186.9602600
Jun 1996 21.0300564 -12.9791516 -17.57977160 -115.8977620
Jul 1996 -185.2214627 20.8708681 -12.39250034 -16.2514302
Aug 1996 -227.6624466 -185.3585663 21.34427615 -11.3164473
Sep 1996 59.7406808 -227.5745862 -185.66555893 20.6321970
Oct 1996 54.3660683 59.7100395 -227.46197814 -185.4101250
Nov 1996 85.5278893 54.5339188 59.06443076 -228.9172864
Dec 1996 13.2505588 85.4526045 54.84959704 59.7692694
Jan 1997 125.1027822 13.2836066 84.87093848 53.6551974
Feb 1997 207.0810992 125.1207465 13.21630962 84.7188237
Mar 1997 -115.2516518 207.0016875 125.37496503 13.8021290
Apr 1997 -6.9249947 -115.2136200 206.87104075 125.0767215
May 1997 -25.7289324 -7.0270146 -114.83613098 207.7249126
Jun 1997 26.9971928 -25.8976666 -6.38350492 -113.3856679
Jul 1997 -199.6422874 26.8522575 -25.35171245 -5.1512987
Aug 1997 -239.0944339 -199.7012014 27.05535040 -24.8907974
Sep 1997 56.3383770 -239.0172525 -199.97074072 26.4289552
Oct 1997 40.3372045 56.2954748 -238.85828332 -199.6105265
Nov 1997 82.4982149 40.3466182 56.25862432 -238.9411366
Dec 1997 21.6658043 82.4857208 40.40085195 56.3792048
Jan 1998 138.5185705 21.6629175 82.52234660 40.4768221
Feb 1998 218.6098636 138.6705502 21.07013611 81.1895425
Mar 1998 -116.8015044 218.6128560 138.66034561 21.0468305
Apr 1998 -0.3062154 -116.9151999 219.02636595 139.5970434
May 1998 -25.0013131 -0.3251321 -116.84200156 219.1909686
Jun 1998 29.2549930 -25.0621519 -0.08546867 -116.3041503
Jul 1998 -196.4722965 29.1958906 -24.83506653 0.4254619
Aug 1998 -254.5198575 -196.3296212 28.70324522 -25.9513352
Sep 1998 48.4052788 -254.5705049 -196.15239783 29.1154368
Oct 1998 45.2494804 48.3754395 -254.45888691 -195.8998025
Nov 1998 80.8642034 45.1777725 48.66139755 -253.8177640
Dec 1998 26.2967330 80.8615783 45.18955758 48.6874892
Jan 1999 148.2146465 26.3080485 80.74302228 44.9418729
Feb 1999 205.7712441 148.2155759 26.30428397 80.7346012
Mar 1999 -115.5163484 205.7937067 148.13466702 26.1209282
Apr 1999 -0.8454023 -115.5192592 205.80483378 148.1597018
May 1999 -17.6906101 -0.8164320 -115.63593729 205.5438720
Jun 1999 32.0327737 -17.7545103 -0.55707794 -115.0563540
Jul 1999 -196.8117714 32.0262248 -17.72887508 -0.4995855
Aug 1999 -253.2994385 -196.7248290 31.72460840 -18.4110492
Sep 1999 46.7958972 -253.2401184 -196.93332047 31.2398504
Oct 1999 46.0437541 46.7305383 -252.99298733 -196.3749741
Nov 1999 75.6961231 45.9504865 47.10980797 -252.1453626
Dec 1999 32.6460565 75.7188627 45.84499981 46.8772829
Jan 2000 151.9259870 32.6871459 75.33892850 45.0473346
Feb 2000 199.2428647 151.8300033 33.08994822 76.2354309
Mar 2000 -125.7035789 199.1949379 152.01123688 33.4977599
Apr 2000 -0.9718169 -125.7727890 199.47157127 152.6296932
May 2000 -10.0625078 -0.9917279 -125.68959775 199.6566585
Jun 2000 29.4302580 -10.1256069 -0.72830477 -125.1034734
Jul 2000 -210.6887355 29.4737619 -10.29899131 -1.1157967
Aug 2000 -248.8697548 -210.6614131 29.37825514 -10.5145180
Sep 2000 46.1783754 -248.9103699 -210.51768081 29.7119397
Oct 2000 51.2970044 46.1352520 -248.74532348 -210.1455943
Nov 2000 76.3205767 51.2688233 46.25222563 -248.4848555
Dec 2000 42.0780527 76.3283814 51.23145125 46.1702258
Jan 2001 148.7127943 42.1204798 75.96850262 50.4736000
Feb 2001 195.3687507 148.7291778 42.04938073 75.8110839
Mar 2001 -123.7597886 195.3329827 148.87052638 42.3652830
[,13]
Dec 1990 0.000000
Jan 1991 -131.452553
Feb 1991 -94.759750
Mar 1991 -94.394389
Apr 1991 -105.225078
May 1991 -112.185620
Jun 1991 -119.227534
Jul 1991 -123.744930
Aug 1991 -126.776217
Sep 1991 -131.282608
Oct 1991 -133.742297
Nov 1991 315.175358
Dec 1991 120.422521
Jan 1992 135.849408
Feb 1992 -13.916876
Mar 1992 155.304505
Apr 1992 64.782810
May 1992 133.691954
Jun 1992 197.549682
Jul 1992 -202.788787
Aug 1992 -62.177173
Sep 1992 -96.050238
Oct 1992 46.284294
Nov 1992 -135.240026
Dec 1992 -215.654242
Jan 1993 124.828412
Feb 1993 76.662976
Mar 1993 115.319774
Apr 1993 -64.843436
May 1993 113.951615
Jun 1993 203.896876
Jul 1993 -155.018817
Aug 1993 -40.103717
Sep 1993 -36.868223
Oct 1993 37.493403
Nov 1993 -145.606890
Dec 1993 -224.312624
Jan 1994 76.858722
Feb 1994 95.121762
Mar 1994 114.276430
Apr 1994 -20.090525
May 1994 116.078463
Jun 1994 197.606126
Jul 1994 -144.479095
Aug 1994 -39.186491
Sep 1994 -42.147331
Oct 1994 14.995682
Nov 1994 -158.747195
Dec 1994 -213.259779
Jan 1995 92.098975
Feb 1995 83.990251
Mar 1995 96.195882
Apr 1995 -15.597280
May 1995 111.479369
Jun 1995 183.928670
Jul 1995 -125.843566
Aug 1995 -22.532078
Sep 1995 -26.385684
Oct 1995 18.460498
Nov 1995 -168.749766
Dec 1995 -220.148311
Jan 1996 86.340436
Feb 1996 68.513504
Mar 1996 86.415111
Apr 1996 2.239995
May 1996 111.495911
Jun 1996 189.688072
Jul 1996 -113.839238
Aug 1996 -14.582253
Sep 1996 -12.423125
Oct 1996 21.032710
Nov 1996 -187.663546
Dec 1996 -227.830374
Jan 1997 57.972666
Feb 1997 53.420149
Mar 1997 85.628124
Apr 1997 13.340531
May 1997 126.394785
Jun 1997 209.961627
Jul 1997 -111.484809
Aug 1997 -4.439308
Sep 1997 -25.860754
Oct 1997 26.992327
Nov 1997 -199.738254
Dec 1997 -238.756227
Jan 1998 56.493349
Feb 1998 38.430549
Mar 1998 81.153644
Apr 1998 22.485877
May 1998 139.849380
Jun 1998 220.015017
Jul 1998 -115.520782
Aug 1998 -1.288880
Sep 1998 -25.316452
Oct 1998 29.508692
Nov 1998 -194.917437
Dec 1998 -253.778043
Jan 1999 48.316751
Feb 1999 44.929048
Mar 1999 80.454733
Apr 1999 26.159047
May 1999 147.763057
Jun 1999 206.424587
Jul 1999 -114.968903
Aug 1999 -1.539244
Sep 1999 -19.152341
Oct 1999 32.103230
Nov 1999 -195.086515
Dec 1999 -252.496142
Jan 2000 45.690860
Feb 2000 46.399209
Mar 2000 76.851223
Apr 2000 34.429441
May 2000 152.908108
Jun 2000 200.538349
Jul 2000 -125.687083
Aug 2000 -1.441111
Sep 2000 -10.008935
Oct 2000 30.282087
Nov 2000 -209.753593
Dec 2000 -248.607200
Jan 2001 45.052858
Feb 2001 50.238996
Mar 2001 76.282143
filtering$a
[,1] [,2] [,3] [,4]
Jan 1991 0.0000 0.00000000 0.0000000 0.0000000
Feb 1991 394.3727 131.45255272 -131.4527431 1445.9782703
Mar 1991 2048.5657 571.74869261 -94.7600952 143.7352725
Apr 1991 2636.4832 576.13321930 -94.3943989 -87.6359341
May 1991 2683.3597 446.14979550 -105.2246146 -425.4996685
Jun 1991 2748.4763 362.60860175 -112.1851875 -410.8614818
Jul 1991 2679.1810 278.08632437 -119.2269271 -538.6793347
Aug 1991 2648.5205 223.86256634 -123.7444070 -484.7468721
Sep 1991 2643.1493 187.47536594 -126.7757598 -442.3652688
Oct 1991 2456.2649 133.37877892 -131.2817450 -727.1449006
Nov 1991 2366.6876 103.85035440 -133.7417119 -537.8560730
Dec 1991 2280.0998 80.59240254 -135.6790162 -523.7855314
Jan 1992 2256.2021 68.76012370 277.6717566 -373.5454858
Feb 1992 1750.6630 -7.79796175 -223.9327324 -143.4933161
Mar 1992 1757.5925 -6.52855213 140.5805109 -212.3778196
Apr 1992 1747.7133 -6.74330687 -14.6581422 138.1708580
May 1992 1849.4830 -0.71397510 176.0972833 59.7619129
Jun 1992 1779.9056 -4.31300134 52.1462483 129.6817089
Jul 1992 1673.3042 -9.52788355 115.1060916 -16.4587139
Aug 1992 1720.0099 -6.68851443 207.7597723 152.7877762
Sep 1992 1747.0578 -4.99112401 -196.6576101 230.3685279
Oct 1992 1817.1703 -1.21683610 -48.5177751 -146.3164463
Nov 1992 1836.1833 -0.20048676 -92.3699141 -34.9567937
Dec 1992 1893.6123 2.69491388 56.7680644 -53.7386506
Jan 1993 1859.4846 0.84468898 -141.9348129 32.0863375
Feb 1993 1853.6749 0.46507386 -217.1921076 -145.2878076
Mar 1993 1844.9004 0.07146788 123.4531748 -221.5446790
Apr 1993 1777.0272 -2.40382931 68.4305151 93.2331456
May 1993 1832.4348 -0.43847445 121.8406562 93.5328089
Jun 1993 1812.7517 -1.07437031 -66.9699279 113.5513215
Jul 1993 1882.5871 1.24290741 121.7519596 -36.4930956
Aug 1993 1846.8058 0.03774376 199.8253062 105.8452432
Sep 1993 1820.6507 -0.81391069 -157.9001088 188.5719385
Oct 1993 1825.0741 -0.64362476 -39.5275942 -155.6499781
Nov 1993 1807.4472 -1.19601945 -38.7357560 -46.8235668
Dec 1993 1781.1612 -2.01246514 34.7363091 -49.5124028
Jan 1994 1736.7802 -3.39252386 -150.2400144 16.5478228
Feb 1994 1720.8347 -3.84210018 -225.9627914 -154.8227923
Mar 1994 1758.9812 -2.61091076 80.8026267 -211.5445695
Apr 1994 1789.8089 -1.72462862 97.8322208 91.8331585
May 1994 1759.4304 -2.45216408 112.0650849 88.5250677
Jun 1994 1735.4017 -2.99073653 -21.7331602 105.0911583
Jul 1994 1765.5371 -2.16900680 118.5933976 -11.0395478
Aug 1994 1754.4991 -2.38860650 196.9328962 115.7308994
Sep 1994 1728.1946 -2.98070317 -146.2945763 189.2139325
Oct 1994 1780.5616 -1.60972790 -34.9864910 -128.4318968
Nov 1994 1796.5449 -1.17363164 -40.8133615 -29.3095243
Dec 1994 1806.1846 -0.90538924 15.8146037 -37.3250324
Jan 1995 1784.6496 -1.41802003 -160.2955207 9.1652180
Feb 1995 1741.7763 -2.52236342 -216.8653940 -172.3045139
Mar 1995 1724.1353 -2.87163367 91.1030512 -221.0397644
Apr 1995 1712.1083 -3.06865354 83.4554252 88.6502148
May 1995 1675.0923 -3.77808015 94.2883831 74.4605997
Jun 1995 1672.9207 -3.74488235 -15.5079425 94.7126076
Jul 1995 1725.4305 -2.58668595 114.6017896 -0.6640731
Aug 1995 1696.6240 -3.12611529 182.4734421 107.6837589
Sep 1995 1691.1796 -3.17383166 -125.9722185 181.8617503
Oct 1995 1691.3129 -3.10570744 -22.3486759 -125.0997161
Nov 1995 1676.2735 -3.35176305 -27.0466963 -25.4964015
Dec 1995 1685.6088 -3.08992098 19.1619990 -23.7013532
Jan 1996 1656.5322 -3.62745462 -170.1677517 12.3172866
Feb 1996 1595.4137 -4.87900910 -223.6955284 -184.2147227
Mar 1996 1584.6003 -4.99548293 86.0533721 -225.0934080
Apr 1996 1518.3271 -6.13727336 65.8484316 71.9561763
May 1996 1525.4566 -5.89520732 86.9730172 68.8749257
Jun 1996 1565.6860 -5.06002885 4.1631743 97.4696759
Jul 1996 1628.1384 -3.84028550 114.3069999 19.5195821
Aug 1996 1675.2446 -2.91990304 191.8093674 125.8952139
Sep 1996 1713.6639 -2.17252892 -112.1184876 201.2123849
Oct 1996 1684.0413 -2.66930436 -15.7237701 -118.3616131
Nov 1996 1691.3304 -2.48888869 -12.0096736 -13.4594157
Dec 1996 1632.3851 -3.51282856 18.6945414 -24.8419169
Jan 1997 1655.9006 -3.02136177 -186.5638309 24.8299907
Feb 1997 1612.6899 -3.78013311 -229.6482725 -195.2017373
Mar 1997 1602.6647 -3.88939285 57.7466952 -230.9539355
Apr 1997 1624.7154 -3.45290398 54.2692126 63.0675907
May 1997 1607.8295 -3.67547497 85.2019240 51.5320620
Jun 1997 1642.6589 -3.04087550 14.5531116 93.0336323
Jul 1997 1704.9715 -1.96513254 128.4508658 27.8417756
Aug 1997 1758.5550 -1.05048085 211.7093149 139.7463137
Sep 1997 1778.3310 -0.70724177 -110.8298653 215.9442994
Oct 1997 1749.1986 -1.17623032 -5.3320484 -116.6093318
Nov 1997 1764.5809 -0.90272078 -25.3418169 -1.9662123
Dec 1997 1759.8908 -0.96535183 26.8740339 -26.1113393
Jan 1998 1764.3624 -0.87519812 -199.5722571 27.9771395
Feb 1998 1766.5597 -0.82282458 -238.6531589 -198.9736169
Mar 1998 1702.0223 -1.84944592 54.7669588 -250.8120176
Apr 1998 1698.9841 -1.86804190 38.4013980 54.5436204
May 1998 1745.5864 -1.11855857 82.3063687 47.4584612
Jun 1998 1752.9932 -0.98722553 22.6872353 83.8972192
Jul 1998 1779.8502 -0.55856121 140.5065948 27.8821334
Aug 1998 1805.7688 -0.15071179 220.6400315 145.4468477
Sep 1998 1747.6057 -1.04521064 -116.8893002 209.8155931
Oct 1998 1768.0911 -0.71285595 -0.7818482 -112.8724300
Nov 1998 1780.7605 -0.50604801 -25.0021906 1.7141435
Dec 1998 1814.0141 0.01628816 30.2978465 -18.7083317
Jan 1999 1815.3833 0.03727573 -194.8867093 30.5496682
Feb 1999 1803.7001 -0.14827519 -254.0683176 -197.0032384
Mar 1999 1803.0923 -0.15525221 48.3075571 -254.1500154
Apr 1999 1792.3470 -0.31243207 44.7382843 46.4491255
May 1999 1793.4985 -0.29089409 80.4802735 44.9940423
Jun 1999 1777.9367 -0.51497418 25.8944068 77.8151376
Jul 1999 1811.3309 -0.01751819 148.3505007 31.8119758
Aug 1999 1814.6818 0.03193061 206.4829504 148.9383869
Sep 1999 1774.6131 -0.55734745 -115.6630843 199.4840194
Oct 1999 1745.3937 -0.97899458 -2.0342671 -120.6649685
Nov 1999 1777.9285 -0.48543394 -18.5756784 3.8126936
Dec 1999 1827.9954 0.25991971 32.9675404 -9.7602375
Jan 2000 1814.6195 0.05835557 -195.3112941 30.5935124
Feb 2000 1771.3835 -0.59118735 -253.2714584 -202.6785842
Mar 2000 1825.8024 0.20888106 46.4780093 -244.0187607
Apr 2000 1852.3315 0.58501496 46.7339503 50.8567600
May 2000 1893.2683 1.15780202 77.3462992 53.4219439
Jun 2000 1906.5093 1.32899841 34.5766551 79.3473500
Jul 2000 1946.1038 1.87115667 153.3743262 40.9136560
Aug 2000 1922.6335 1.51184903 200.2295147 149.1771108
Sep 2000 1909.9975 1.31105755 -125.8592764 197.8861984
Oct 2000 1933.3554 1.62427601 -1.1736341 -122.2080930
Nov 2000 1959.9516 1.97941456 -9.7075321 2.9608197
Dec 2000 1979.2975 2.22666702 30.4897802 -6.8336449
Jan 2001 1976.1540 2.15003000 -209.8148112 29.6025600
Feb 2001 1931.8339 1.47962479 -249.1833989 -217.3605600
Mar 2001 1922.5755 1.32825739 44.9495064 -250.9119895
[,5] [,6] [,7] [,8]
Jan 1991 0.0000000 0.0000000 0.000000 0.00000000
Feb 1991 -131.4525527 -131.4525527 -131.452553 -131.45255273
Mar 1991 803.8625714 -94.7597499 -94.759750 -94.75974986
Apr 1991 136.3373907 800.8480553 -94.394389 -94.39438913
May 1991 181.5776531 275.5813347 810.140843 -105.22507829
Jun 1991 -211.6142199 311.9248219 322.405937 773.44384982
Jul 1991 -148.0882208 -33.3683947 405.664417 331.65084011
Aug 1991 -338.4502888 -2.0931330 58.409962 443.23706707
Sep 1991 -328.3461270 -218.4494553 81.521871 105.64905804
Oct 1991 -176.3051709 -116.4121646 -60.616852 185.27170444
Nov 1991 -563.3153490 -42.0270642 -11.669849 14.60194879
Dec 1991 -393.9988782 -442.7405264 55.279412 62.37964827
Jan 1992 -442.9986408 -325.0603306 -385.642316 100.54393965
Feb 1992 47.4633017 -98.6020120 -57.235707 -194.35829953
Mar 1992 -146.0151113 40.8705546 -103.926056 -61.29248492
Apr 1992 -211.4931427 -145.3567435 41.818319 -103.19232815
May 1992 106.0490927 -237.1497185 -165.108399 21.37675913
Jun 1992 80.8835588 123.2993611 -223.437146 -154.92889609
Jul 1992 161.4112532 106.9955560 144.289366 -207.57517267
Aug 1992 -33.9613840 146.9690689 95.341370 135.42639868
Sep 1992 142.2780734 -42.6410561 139.955917 89.99665645
Oct 1992 206.9681827 122.9473350 -58.266241 128.04054514
Nov 1992 -152.6195303 201.7610055 118.737999 -61.47658858
Dec 1992 -52.9127630 -167.4534338 189.769806 109.59277161
Jan 1993 -42.2652516 -43.4344308 -159.791675 195.61290282
Feb 1993 34.2870337 -40.4690632 -42.012350 -158.74412402
Mar 1993 -143.8436169 36.2940741 -38.841310 -40.76920332
Apr 1993 -208.9065938 -134.2036299 46.683934 -30.83862711
May 1993 81.8687946 -217.8346827 -141.282165 40.40609951
Jun 1993 97.3828603 84.9271281 -215.377532 -139.42714208
Jul 1993 99.2892044 86.0111145 75.743768 -222.36235759
Aug 1993 -29.0358588 105.2421858 90.826388 79.41606825
Sep 1993 111.1222394 -24.8220966 108.652040 93.42861465
Oct 1993 187.5167950 110.2796885 -25.503908 108.13171253
Nov 1993 -152.2283494 190.2488360 112.490281 -23.81717606
Dec 1993 -41.7682310 -148.1921384 193.514302 114.98143813
Jan 1994 -40.9726284 -34.9507437 -142.677588 197.71989390
Feb 1994 19.2139087 -38.8572790 -33.263493 -141.42026829
Mar 1994 -160.3479027 13.1965470 -43.751835 -37.00232320
Apr 1994 -216.4244087 -163.9474158 9.672028 -46.46323975
May 1994 96.1653771 -213.1687103 -161.338701 11.86872633
Jun 1994 91.8235633 98.6633829 -211.152255 -159.80595250
Jul 1994 100.0110208 87.9668675 95.540502 -213.53554846
Aug 1994 -9.6784956 101.0449453 88.804757 96.18081360
Sep 1994 119.4011885 -6.8902606 103.304629 90.53173114
Oct 1994 180.7202967 112.9495915 -12.117894 99.31058510
Nov 1994 -131.1318462 178.6697556 111.288438 -13.38659977
Dec 1994 -30.9692923 -132.3922629 177.648886 110.50899646
Jan 1995 -34.1563741 -28.5633751 -130.444287 179.13532685
Feb 1995 15.8038028 -29.1287471 -24.534983 -127.42239231
Mar 1995 -170.5657882 17.4163643 -27.813551 -23.52975164
Apr 1995 -219.9110253 -169.7774547 18.151947 -27.24740136
May 1995 92.9419737 -216.8724916 -167.328301 20.16228078
Jun 1995 74.2559500 92.7962013 -216.990513 -167.41844005
Jul 1995 87.5320763 69.1322915 88.639528 -220.17234797
Aug 1995 2.6836394 89.9215340 71.071484 90.12479767
Sep 1995 107.9797335 2.8948634 90.092923 71.20271512
Oct 1995 181.4395697 107.6785099 2.650527 89.90593588
Nov 1995 -123.5761780 182.5263988 108.559809 3.32462612
Dec 1995 -27.1165158 -124.7317568 181.589603 107.84357407
Jan 1996 -20.3797159 -24.7475767 -122.812276 183.05598042
Feb 1996 19.9122788 -14.9640909 -20.395321 -119.53133297
Mar 1996 -183.5967000 20.4149684 -14.553261 -20.08093477
Apr 1996 -218.3885713 -179.2156127 24.383372 -11.49432405
May 1996 70.4770204 -219.3654275 -180.005623 23.74427150
Jun 1996 63.7040787 67.0448021 -222.148592 -182.14020151
Jul 1996 89.8917901 58.6677902 62.955397 -225.28882188
Aug 1996 13.8009724 86.0910574 55.581525 60.58533015
Sep 1996 121.2558218 10.7184169 83.588879 53.66114182
Oct 1996 204.2927963 123.3019088 12.378541 84.86209301
Nov 1996 -119.4792464 203.5506057 122.699962 11.91718368
Dec 1996 -7.1214266 -115.2708934 206.962595 125.31362028
Jan 1997 -27.8797420 -9.1384147 -116.905179 205.71196190
Feb 1997 29.4669429 -24.7965235 -6.656793 -115.02636118
Mar 1997 -194.5966361 29.9046666 -24.438486 -6.38230259
Apr 1997 -233.5599598 -196.1788483 28.501645 -25.52239731
May 1997 64.4368656 -232.7214307 -195.499988 29.04605885
Jun 1997 47.5912144 62.0130855 -234.686671 -197.01333829
Jul 1997 86.3399772 43.4707318 58.669243 -237.26313571
Aug 1997 22.1531545 82.8388488 40.630101 56.48123320
Sep 1997 137.6139993 20.8413564 81.775071 39.81140007
Oct 1997 218.8543612 139.4035809 22.291800 82.89038449
Nov 1997 -118.3047303 217.8120205 138.559173 21.64299260
Dec 1997 -1.5783042 -118.0662704 218.005120 138.70744502
Jan 1998 -26.6689333 -1.9210989 -118.343655 217.79238391
Feb 1998 27.6553811 -26.8672495 -2.080690 -118.46497670
Mar 1998 -193.1143641 31.4583230 -23.759426 0.30763720
Apr 1998 -250.6997003 -193.0512063 31.513359 -23.71679004
May 1998 49.9112177 -253.3231041 -195.172199 29.82124451
Jun 1998 46.6412012 49.4466639 -253.698971 -195.46279428
Jul 1998 81.2269859 45.1225410 48.217318 -254.64963055
Aug 1998 25.3436210 79.7838136 43.954784 47.31485870
Sep 1998 151.0073730 28.5031039 82.338699 45.92720648
Oct 1998 207.7520438 149.8353932 27.555991 81.60824790
Nov 1998 -114.1551882 207.0237109 149.247125 27.10269134
Dec 1998 -1.5230835 -115.9930608 205.539972 148.10467114
Jan 1999 -18.8382362 -1.5968495 -116.052564 205.49421714
Feb 1999 31.6941316 -18.1862229 -1.073332 -115.65296611
Mar 1999 -196.9625458 31.7179987 -18.166779 -1.05834699
Apr 1999 -253.1928678 -196.4642987 32.145228 -17.83476680
May 1999 46.3155818 -253.2627938 -196.520608 32.10043537
Jun 1999 46.3903161 47.0490502 -252.672020 -196.06206339
Jul 1999 74.7142254 44.7609979 45.736437 -253.69087706
Aug 1999 31.5040438 74.5525226 44.630803 45.63546762
Sep 1999 152.6033045 33.4273102 76.099862 45.82937073
Oct 1999 202.1033105 153.9771536 34.531835 76.95445644
Nov 1999 -123.7280644 200.4971468 152.686639 33.53430356
Dec 1999 -0.8094865 -126.1515745 198.550939 151.18356033
Jan 2000 -8.5116831 -0.1546078 -125.626143 198.95613479
Feb 2000 34.6115216 -6.3964049 1.535947 -124.33054760
Mar 2000 -207.4193822 32.0819424 -8.445518 -0.04814384
Apr 2000 -246.3225776 -208.5312884 31.143872 -9.17692346
May 2000 47.2978635 -248.0486043 -209.911785 30.04728493
Jun 2000 52.3543654 46.7786645 -248.463819 -210.23528349
Jul 2000 75.9665701 50.7102216 45.463838 -249.48820515
Aug 2000 43.1517699 77.0541915 51.579349 46.14026365
Sep 2000 150.4262707 43.7583418 77.538489 51.95576174
Oct 2000 195.9397676 149.4816407 43.004728 76.95348060
Nov 2000 -124.4130790 194.8699770 148.628741 42.34334526
Dec 2000 1.4267632 -125.1573254 194.276965 148.16932358
Jan 2001 -6.3585998 1.6573475 -124.973771 194.41894247
Feb 2001 33.7582506 -4.3335969 3.264038 -123.73760644
Mar 2001 -216.4531090 34.2016742 -3.977427 3.54026379
[,9] [,10] [,11] [,12]
Jan 1991 0.0000000 0.0000000 0.0000000 0.00000000
Feb 1991 -131.4525527 -131.4525527 -131.4525527 -131.45255273
Mar 1991 -94.7597499 -94.7597499 -94.7597499 -94.75974986
Apr 1991 -94.3943891 -94.3943891 -94.3943891 -94.39438913
May 1991 -105.2250783 -105.2250783 -105.2250783 -105.22507829
Jun 1991 -112.1856199 -112.1856199 -112.1856199 -112.18561992
Jul 1991 698.1852928 -119.2275345 -119.2275345 -119.22753446
Aug 1991 315.0226075 627.3447833 -123.7449297 -123.74492967
Sep 1991 454.1060145 289.5230032 565.4653140 -126.77621671
Oct 1991 155.3285240 449.7213278 231.0741899 452.93030281
Nov 1991 230.9758917 171.5236196 436.4094763 188.25415752
Dec 1991 65.4031746 258.5348927 175.8437822 417.49152572
Jan 1992 95.8157928 87.0148834 268.3247593 173.81304639
Feb 1992 215.3099913 134.0777650 48.7779027 153.58519362
Mar 1992 -197.1491089 213.7839964 133.8155754 49.77865403
Apr 1992 -60.7724279 -196.8423813 213.8777118 133.69657155
May 1992 -117.6430374 -69.2443866 -199.3470155 217.32965939
Jun 1992 29.7323457 -112.8534623 -68.0132790 -201.66723626
Jul 1992 -144.1894948 36.3710850 -111.3688044 -71.67190660
Aug 1992 -213.6468930 -147.4730578 35.6581913 -109.28179812
Sep 1992 131.7501162 -215.6558570 -147.8164654 36.93427645
Oct 1992 81.7910717 127.2518234 -216.4502638 -144.91056561
Nov 1992 125.8291790 80.5780137 127.0361546 -215.66953133
Dec 1992 -67.7758652 122.3739364 79.9641877 129.26092955
Jan 1993 113.6172194 -65.5688419 122.7652072 78.54150430
Feb 1993 196.2858566 113.9157074 -65.6446235 122.31535048
Mar 1993 -157.8854058 196.7606425 114.0071655 -65.93586012
Apr 1993 -35.1672009 -154.6795423 197.5758135 112.43735016
May 1993 -35.2224015 -37.6556132 -155.2775472 198.86300175
Jun 1993 41.7962088 -34.4438183 -37.4876038 -155.71833129
Jul 1993 -144.2116971 39.0253800 -34.9922430 -35.81917436
Aug 1993 -219.8352602 -142.8288817 39.2932651 -35.87678827
Sep 1993 81.2090965 -218.8510695 -142.6523572 38.66371529
Oct 1993 93.0700849 81.0122923 -218.8863801 -142.52644576
Nov 1993 109.2935639 93.7072888 81.1255995 -219.29601409
Dec 1993 -22.1018351 110.2334308 93.8727883 80.51814061
Jan 1994 117.8755223 -20.5186849 110.5075094 92.84016489
Feb 1994 198.5464306 118.2713178 -20.5532353 110.04311110
Mar 1994 -144.0011517 197.1223836 118.0017478 -19.67115907
Apr 1994 -38.8894725 -145.0651607 196.8792948 118.57696420
May 1994 -44.9363111 -38.0346268 -144.8804143 196.39630329
Jun 1994 12.9817173 -44.3187476 -37.9119708 -145.25086298
Jul 1994 -161.4462836 12.0541060 -44.4924632 -37.33400587
Aug 1994 -213.0939245 -161.2034313 12.0989711 -44.64837900
Sep 1994 97.3720847 -212.4386378 -161.0834062 11.67824268
Oct 1994 87.7782140 95.8597522 -212.7118072 -160.11998007
Nov 1994 98.4365348 87.2990315 95.7747980 -212.40352089
Dec 1994 -13.9232545 98.1427983 87.2478225 95.96551129
Jan 1995 111.5313103 -13.3653244 98.2370838 86.87960789
Feb 1995 181.1452760 112.5284727 -13.3798763 97.21254886
Mar 1995 -126.7290584 181.5266625 112.5985833 -13.62008512
Apr 1995 -23.1369437 -126.5096050 181.5732390 112.47293871
May 1995 -25.8529983 -22.3626041 -126.3535326 181.11358198
Jun 1995 20.0978714 -25.8885426 -22.3692944 -126.33148954
Jul 1995 -169.6153783 18.8715262 -26.1100367 -21.58928860
Aug 1995 -219.1460132 -169.0492084 18.9730688 -26.47477437
Sep 1995 90.2154266 -219.0960804 -169.0399434 18.94090847
Oct 1995 71.0737104 90.1445394 -219.1089350 -168.99488723
Nov 1995 90.3705479 71.3283444 90.1895001 -219.27301582
Dec 1995 2.8313848 90.1008244 71.2818189 90.36550300
Jan 1996 108.8518573 3.3804923 90.1913986 70.91521077
Feb 1996 185.2543196 109.9648381 3.4090631 89.13786496
Mar 1996 -119.3145938 185.3732046 109.9860538 3.33295185
Apr 1996 -17.9622130 -118.1383971 185.6091620 109.28572639
May 1996 -11.9372098 -18.2068070 -118.1851796 185.75930265
Jun 1996 22.2335011 -12.7678206 -18.3569217 -117.65786807
Jul 1996 -184.3141806 21.0300564 -12.9791516 -17.57977160
Aug 1996 -226.9297030 -185.2214627 20.8708681 -12.39250034
Sep 1996 59.2572798 -227.6624466 -185.3585663 21.34427615
Oct 1996 54.5404362 59.7406808 -227.5745862 -185.66555893
Nov 1996 84.5438699 54.3660683 59.7100395 -227.46197814
Dec 1996 13.7180732 85.5278893 54.5339188 59.06443076
Jan 1997 124.4535589 13.2505588 85.4526045 54.84959704
Feb 1997 206.9775538 125.1027822 13.2836066 84.87093848
Mar 1997 -114.8371300 207.0810992 125.1207465 13.21630962
Apr 1997 -7.1324970 -115.2516518 207.0016875 125.37496503
May 1997 -25.1451711 -6.9249947 -115.2136200 206.87104075
Jun 1997 27.9813464 -25.7289324 -7.0270146 -114.83613098
Jul 1997 -198.8014376 26.9971928 -25.8976666 -6.38350492
Aug 1997 -238.7811160 -199.6422874 26.8522575 -25.35171245
Sep 1997 55.9141292 -239.0944339 -199.7012014 27.05535040
Oct 1997 40.5826689 56.3383770 -239.0172525 -199.97074072
Nov 1997 82.4423771 40.3372045 56.2954748 -238.85828332
Dec 1997 21.7452478 82.4982149 40.3466182 56.25862432
Jan 1998 138.5610663 21.6658043 82.4857208 40.40085195
Feb 1998 217.7103054 138.5185705 21.6629175 82.52234660
Mar 1998 -116.8177526 218.6098636 138.6705502 21.07013611
Apr 1998 0.3371474 -116.8015044 218.6128560 138.66034561
May 1998 -24.8898606 -0.3062154 -116.9151999 219.02636595
Jun 1998 29.6175438 -25.0013131 -0.3251321 -116.84200156
Jul 1998 -196.1241814 29.2549930 -25.0621519 -0.08546867
Aug 1998 -255.2771641 -196.4722965 29.1958906 -24.83506653
Sep 1998 48.6837730 -254.5198575 -196.3296212 28.70324522
Oct 1998 45.4212413 48.4052788 -254.5705049 -196.15239783
Nov 1998 81.2947855 45.2494804 48.3754395 -254.45888691
Dec 1998 26.3138143 80.8642034 45.1777725 48.66139755
Jan 1999 148.0731582 26.2967330 80.8615783 45.18955758
Feb 1999 205.7656037 148.2146465 26.3080485 80.74302228
Mar 1999 -115.6426217 205.7712441 148.2155759 26.30428397
Apr 1999 -0.8283912 -115.5163484 205.7937067 148.13466702
May 1999 -17.8658520 -0.8454023 -115.5192592 205.80483378
Jun 1999 32.4212232 -17.6906101 -0.8164320 -115.63593729
Jul 1999 -196.7726779 32.0327737 -17.7545103 -0.55707794
Aug 1999 -253.7612645 -196.8117714 32.0262248 -17.72887508
Sep 1999 46.4691705 -253.2994385 -196.7248290 31.72460840
Oct 1999 46.4225120 46.7958972 -253.2401184 -196.93332047
Nov 1999 76.2633988 46.0437541 46.7305383 -252.99298733
Dec 1999 32.4947187 75.6961231 45.9504865 47.10980797
Jan 2000 151.4630209 32.6460565 75.7188627 45.84499981
Feb 2000 199.8392710 151.9259870 32.6871459 75.33892850
Mar 2000 -125.4256028 199.2428647 151.8300033 33.08994822
Apr 2000 -0.5553712 -125.7035789 199.1949379 152.01123688
May 2000 -9.9391015 -0.9718169 -125.7727890 199.47157127
Jun 2000 29.8211343 -10.0625078 -0.9917279 -125.68959775
Jul 2000 -210.9516286 29.4302580 -10.1256069 -0.72830477
Aug 2000 -249.0153550 -210.6887355 29.4737619 -10.29899131
Sep 2000 46.4027565 -248.8697548 -210.6614131 29.37825514
Oct 2000 51.5487812 46.1783754 -248.9103699 -210.51768081
Nov 2000 76.4943021 51.2970044 46.1352520 -248.74532348
Dec 2000 42.0249610 76.3205767 51.2688233 46.25222563
Jan 2001 148.2674209 42.0780527 76.3283814 51.23145125
Feb 2001 195.2646395 148.7127943 42.1204798 75.96850262
Mar 2001 -123.5463077 195.3687507 148.7291778 42.04938073
[,13]
Jan 1991 0.0000000
Feb 1991 -131.4525527
Mar 1991 -94.7597499
Apr 1991 -94.3943891
May 1991 -105.2250783
Jun 1991 -112.1856199
Jul 1991 -119.2275345
Aug 1991 -123.7449297
Sep 1991 -126.7762167
Oct 1991 -131.2826077
Nov 1991 380.5872505
Dec 1991 146.0961581
Jan 1992 403.6400734
Feb 1992 -17.4414950
Mar 1992 155.8481662
Apr 1992 49.4471995
May 1992 143.0950403
Jun 1992 211.4648427
Jul 1992 -210.4589409
Aug 1992 -66.7906577
Sep 1992 -106.3354065
Oct 1992 43.5125721
Nov 1992 -143.1342879
Dec 1992 -210.6089574
Jan 1993 126.0260829
Feb 1993 77.7177154
Mar 1993 121.6420417
Apr 1993 -69.8849379
May 1993 115.6044841
Jun 1993 197.8152209
Jul 1993 -151.8397349
Aug 1993 -37.8528503
Sep 1993 -37.3182947
Oct 1993 38.9519560
Nov 1993 -143.4581094
Dec 1993 -220.6749119
Jan 1994 78.1813705
Feb 1994 91.9463687
Mar 1994 112.0738737
Apr 1994 -18.2803990
May 1994 117.4287286
Jun 1994 195.5346642
Jul 1994 -143.9241709
Aug 1994 -37.6899564
Sep 1994 -45.6084367
Oct 1994 13.8969606
Nov 1994 -159.4193865
Dec 1994 -211.9715803
Jan 1995 95.1361134
Feb 1995 84.8468315
Mar 1995 96.6630862
Apr 1995 -13.9172171
May 1995 111.4003881
Jun 1995 181.1642224
Jul 1995 -124.5547566
Aug 1995 -22.4181629
Sep 1995 -26.5480001
Oct 1995 19.0451061
Nov 1995 -169.3674333
Dec 1995 -218.8753160
Jan 1996 89.5434055
Feb 1996 68.7821946
Mar 1996 88.9648428
Apr 1996 1.7011395
May 1996 109.6317147
Jun 1996 186.9602600
Jul 1996 -115.8977620
Aug 1996 -16.2514302
Sep 1996 -11.3164473
Oct 1996 20.6321970
Nov 1996 -185.4101250
Dec 1996 -228.9172864
Jan 1997 59.7692694
Feb 1997 53.6551974
Mar 1997 84.7188237
Apr 1997 13.8021290
May 1997 125.0767215
Jun 1997 207.7249126
Jul 1997 -113.3856679
Aug 1997 -5.1512987
Sep 1997 -24.8907974
Oct 1997 26.4289552
Nov 1997 -199.6105265
Dec 1997 -238.9411366
Jan 1998 56.3792048
Feb 1998 40.4768221
Mar 1998 81.1895425
Apr 1998 21.0468305
May 1998 139.5970434
Jun 1998 219.1909686
Jul 1998 -116.3041503
Aug 1998 0.4254619
Sep 1998 -25.9513352
Oct 1998 29.1154368
Nov 1998 -195.8998025
Dec 1998 -253.8177640
Jan 1999 48.6874892
Feb 1999 44.9418729
Mar 1999 80.7346012
Apr 1999 26.1209282
May 1999 148.1597018
Jun 1999 205.5438720
Jul 1999 -115.0563540
Aug 1999 -0.4995855
Sep 1999 -18.4110492
Oct 1999 31.2398504
Nov 1999 -196.3749741
Dec 1999 -252.1453626
Jan 2000 46.8772829
Feb 2000 45.0473346
Mar 2000 76.2354309
Apr 2000 33.4977599
May 2000 152.6296932
Jun 2000 199.6566585
Jul 2000 -125.1034734
Aug 2000 -1.1157967
Sep 2000 -10.5145180
Oct 2000 29.7119397
Nov 2000 -210.1455943
Dec 2000 -248.4848555
Jan 2001 46.1702258
Feb 2001 50.4736000
Mar 2001 75.8110839
filtering$f
Jan Feb Mar Apr May Jun Jul
1991 0.000 262.920 1953.806 2542.089 2578.135 2636.291 2559.954
1992 2533.874 1526.730 1898.173 1733.055 2025.580 1832.052 1788.410
1993 1717.550 1636.483 1968.354 1845.458 1954.275 1745.782 2004.339
1994 1586.540 1494.872 1839.784 1887.641 1871.495 1713.669 1884.130
1995 1624.354 1524.911 1815.238 1795.564 1769.381 1657.413 1840.032
1996 1486.364 1371.718 1670.654 1584.176 1612.430 1569.849 1742.445
1997 1469.337 1383.042 1660.411 1678.985 1693.031 1657.212 1833.422
1998 1564.790 1527.906 1756.789 1737.385 1827.893 1775.680 1920.357
1999 1620.497 1549.632 1851.400 1837.085 1873.979 1803.831 1959.681
2000 1619.308 1518.112 1872.280 1899.065 1970.615 1941.086 2099.478
2001 1766.339 1682.651 1967.525
Aug Sep Oct Nov Dec
1991 2524.776 2516.373 2324.983 2232.946 2144.421
1992 1927.770 1550.400 1768.653 1743.813 1950.380
1993 2046.631 1662.751 1785.547 1768.711 1815.898
1994 1951.432 1581.900 1745.575 1755.732 1821.999
1995 1879.097 1565.207 1668.964 1649.227 1704.771
1996 1867.054 1601.545 1668.318 1679.321 1651.080
1997 1970.264 1667.501 1743.867 1739.239 1786.765
1998 2026.409 1630.716 1767.309 1755.758 1844.312
1999 2021.165 1658.950 1743.359 1759.353 1860.963
2000 2122.863 1784.138 1932.182 1950.244 2009.787
2001
dlm
package의 dlmSmooth()
를 이용하여 kalman smoothing을 수행할 수 있다.smoothing <- dlmSmooth(filtering) #dlmSmooth(Filted DLM) or dlmSmooth(train.ts, modelfit1)
str(smoothing,1)
List of 3
$ s : Time-Series [1:124, 1:13] from 1991 to 2001: 1900 1899 1885 1878 1835 ...
$ U.S:List of 124
$ D.S: num [1:124, 1:13] 46.6 32.5 29.1 28.3 28 ...
# Plot estimation for smoothing
# Fittited model
theta <- modelfit1$GG%*%t(smoothing$s[1:length(train.ts),]) #s0-s[t] : Total t+1
fitted_smooth <- modelfit1$FF%*%theta
par(mfrow=c(1,1))
plot(train.ts, ylab="Ridership", lwd=2)
time <- as.vector(time(train.ts))
lines(time, fitted_smooth ,lty=2, lwd=2, col="blue")
legend("bottomleft", legend=c("Data", "Fitted smoothing data"), col=c("black", "blue"), lty=1:2, lwd=2)
tsdiag(filtering, main = "Diagnostics for Regression Model")
dlm
package의 dlmForecast()
를 이용하여 예측을 수행할 수 있다.forecast <- dlmForecast(filtering, nAhead = nValid) # Forecast(filtering model)
str(forecast,1)
List of 4
$ a: Time-Series [1:36, 1:13] from 2001 to 2004: 1946 1948 1950 1951 1953 ...
..- attr(*, "dimnames")=List of 2
$ R:List of 36
$ f: Time-Series [1:36, 1] from 2001 to 2004: 1997 2024 1992 2100 2148 ...
..- attr(*, "dimnames")=List of 2
$ Q:List of 36
plot(train.ts,xlim=c(1991,2006.25), ylim=c(1300,2600), ylab="Ridership")
lines(dropFirst(filtering$f) ,lty=2, lwd=2, col="blue")
lines(valid.ts)
lines(forecast$f, lty=2,lwd=2, col="blue")
legend("topright", legend=c("Data", "Fitted filtering"), lty=1:2, col=c("black", "blue"))
# 95% confidence interval for prediction
timelo <- seq(tail(time,1) + 1/12, by = 1/12, length = nValid)
polygon(x=c(timelo, rev(timelo)), y = c(forecast$f + qnorm(0.975)*sqrt(unlist(forecast$Q)),
rev(forecast$f - qnorm(0.975)*sqrt(unlist(forecast$Q)))), col=scales::alpha("blue", alpha=0.2))
lines(timelo, forecast$f, col = "blue", lwd = 3, lty=2)
# Compare regression based on time-series
library(ggplot2)
library(forecast)
library(zoo)
# Regression model with Trend and Seasonality
train.lm.trend.season <- tslm(train.ts ~ trend + I(trend^2) + season)
train.lm.trend.season.pred <- forecast(train.lm.trend.season, h=nValid, level=0)
# Data.frame
x <- index(ridership.ts)
df <- rbind(
data.frame(x=dropFirst(x), y=dropFirst(as.numeric(ridership.ts)), series= "original"),
data.frame(x=x[2:123], y=dropFirst(filtering$f), series="filtered"),
data.frame(x=x[2:123], y=dropFirst(as.numeric(fitted_smooth)), series="smoothed"),
data.frame(x=x[124:159], y=train.lm.trend.season.pred$mean, series="regression forecast" ),
data.frame(x=x[124:159], y=c(forecast$f), series="dynamic forecast" )
)
# Plot
ggplot(df, aes(x=x, y=y, color=series, size=series))+ geom_line() +
scale_color_manual(values = c("dimgrey", "red", "blue", "skyblue", "magenta")) +
scale_size_manual(values=c(1.5,rep(0.5,2), rep(1,2))) +
theme_classic()+
scale_x_continuous(breaks = seq(min(x)+1, max(x), by = 2)) +
geom_vline(xintercept =x[124], linetype=2, size=1, col="black") +
annotate('text', x = x[146], y = 2500, label = 'Forecast', color = 'black', size=5) +
theme(legend.title = element_blank()) +
xlab("Time")+ylab("Ridership")
Text and figures are licensed under Creative Commons Attribution CC BY 4.0. The figures that have been reused from other sources don't fall under this license and can be recognized by a note in their caption: "Figure from ...".