Nile
## Time Series:
## Start = 1871
## End = 1970
## Frequency = 1
## [1] 1120 1160 963 1210 1160 1160 813 1230 1370 1140 995 935 1110 994
## [15] 1020 960 1180 799 958 1140 1100 1210 1150 1250 1260 1220 1030 1100
## [29] 774 840 874 694 940 833 701 916 692 1020 1050 969 831 726
## [43] 456 824 702 1120 1100 832 764 821 768 845 864 862 698 845
## [57] 744 796 1040 759 781 865 845 944 984 897 822 1010 771 676
## [71] 649 846 812 742 801 1040 860 874 848 890 744 749 838 1050
## [85] 918 986 797 923 975 815 1020 906 901 1170 912 746 919 718
## [99] 714 740
nile <- data.frame(Nile)
nile
## Nile
## 1 1120
## 2 1160
## 3 963
## 4 1210
## 5 1160
## 6 1160
## 7 813
## 8 1230
## 9 1370
## 10 1140
## 11 995
## 12 935
## 13 1110
## 14 994
## 15 1020
## 16 960
## 17 1180
## 18 799
## 19 958
## 20 1140
## 21 1100
## 22 1210
## 23 1150
## 24 1250
## 25 1260
## 26 1220
## 27 1030
## 28 1100
## 29 774
## 30 840
## 31 874
## 32 694
## 33 940
## 34 833
## 35 701
## 36 916
## 37 692
## 38 1020
## 39 1050
## 40 969
## 41 831
## 42 726
## 43 456
## 44 824
## 45 702
## 46 1120
## 47 1100
## 48 832
## 49 764
## 50 821
## 51 768
## 52 845
## 53 864
## 54 862
## 55 698
## 56 845
## 57 744
## 58 796
## 59 1040
## 60 759
## 61 781
## 62 865
## 63 845
## 64 944
## 65 984
## 66 897
## 67 822
## 68 1010
## 69 771
## 70 676
## 71 649
## 72 846
## 73 812
## 74 742
## 75 801
## 76 1040
## 77 860
## 78 874
## 79 848
## 80 890
## 81 744
## 82 749
## 83 838
## 84 1050
## 85 918
## 86 986
## 87 797
## 88 923
## 89 975
## 90 815
## 91 1020
## 92 906
## 93 901
## 94 1170
## 95 912
## 96 746
## 97 919
## 98 718
## 99 714
## 100 740
-Repeat the ts(),
nile.ts <- ts(nile, start=1, frequency=10)
summary(nile.ts)
## Nile
## Min. : 456.0
## 1st Qu.: 798.5
## Median : 893.5
## Mean : 919.4
## 3rd Qu.:1032.5
## Max. :1370.0
-Repeat HoltWinters()
nile.hltWtrs <- HoltWinters(nile.ts, gamma=FALSE)
nile.hltWtrs
## Holt-Winters exponential smoothing with trend and without seasonal component.
##
## Call:
## HoltWinters(x = nile.ts, gamma = FALSE)
##
## Smoothing parameters:
## alpha: 0.4190643
## beta : 0.05987705
## gamma: FALSE
##
## Coefficients:
## [,1]
## a 756.913740
## b -7.424597
-Repeat the predict()
nile.prdct <- predict(nile.hltWtrs, n.ahead = 10)
nile.prdct
## Time Series:
## Start = c(11, 1)
## End = c(11, 10)
## Frequency = 10
## fit
## [1,] 749.4891
## [2,] 742.0645
## [3,] 734.6400
## [4,] 727.2154
## [5,] 719.7908
## [6,] 712.3662
## [7,] 704.9416
## [8,] 697.5170
## [9,] 690.0924
## [10,] 682.6678
-Repeat the plot()
ts.plot(nile.ts,nile.prdct)
plot(nile.ts)
plot(nile.hltWtrs)
-Repeat the same functions with different values of alpha, beta, and gamma of your choosing on. AirPassengers Repeat the ts()
ap.ts <- ts(AirPassengers, start=1, frequency=10)
ap.ts
## Time Series:
## Start = c(1, 1)
## End = c(15, 4)
## Frequency = 10
## [1] 112 118 132 129 121 135 148 148 136 119 104 118 115 126 141 135 125
## [18] 149 170 170 158 133 114 140 145 150 178 163 172 178 199 199 184 162
## [35] 146 166 171 180 193 181 183 218 230 242 209 191 172 194 196 196 236
## [52] 235 229 243 264 272 237 211 180 201 204 188 235 227 234 264 302 293
## [69] 259 229 203 229 242 233 267 269 270 315 364 347 312 274 237 278 284
## [86] 277 317 313 318 374 413 405 355 306 271 306 315 301 356 348 355 422
## [103] 465 467 404 347 305 336 340 318 362 348 363 435 491 505 404 359 310
## [120] 337 360 342 406 396 420 472 548 559 463 407 362 405 417 391 419 461
## [137] 472 535 622 606 508 461 390 432
-Repeat HoltWinters()
ap.hltWtrs <- HoltWinters(ap.ts, alpha = 0.5,beta = 0.5, gamma = 0.5)
ap.hltWtrs
## Holt-Winters exponential smoothing with trend and additive seasonal component.
##
## Call:
## HoltWinters(x = ap.ts, alpha = 0.5, beta = 0.5, gamma = 0.5)
##
## Smoothing parameters:
## alpha: 0.5
## beta : 0.5
## gamma: 0.5
##
## Coefficients:
## [,1]
## a 338.9700725
## b -63.7244028
## s1 19.7077757
## s2 -0.5764355
## s3 -36.7311454
## s4 -42.0547400
## s5 -45.5343836
## s6 -45.7962881
## s7 -35.8723082
## s8 13.2699144
## s9 42.7911919
## s10 66.9341373
-Repeat the predict()
ap.prdct <- predict(ap.hltWtrs, n.head=10)
ap.prdct
## Time Series:
## Start = c(15, 5)
## End = c(15, 5)
## Frequency = 10
## fit
## [1,] 294.9534
-Repeat the plot()
ts.plot(ap.ts,ap.prdct)
plot(ap.ts)
plot(ap.hltWtrs)
plot(ap.prdct)
-Repeat the same functions with different values of alpha, beta, and gamma of your choosing on. EuStockMarkets When using the EuStockMarkets, choose one column
es <- EuStockMarkets[,2]
-Repeat the ts()
es.ts <- ts(es, start=1, frequency=10)
-Repeat HoltWinters()
es.hltWtrs <- HoltWinters(es.ts, alpha = 0.3,beta = 0.2, gamma = 0.01)
es.hltWtrs
## Holt-Winters exponential smoothing with trend and additive seasonal component.
##
## Call:
## HoltWinters(x = es.ts, alpha = 0.3, beta = 0.2, gamma = 0.01)
##
## Smoothing parameters:
## alpha: 0.3
## beta : 0.2
## gamma: 0.01
##
## Coefficients:
## [,1]
## a 7545.3729323
## b -58.7161493
## s1 0.8350917
## s2 4.8421540
## s3 0.5373249
## s4 -1.4020256
## s5 1.3752334
## s6 -5.0260308
## s7 -5.8744244
## s8 3.3358325
## s9 -6.9745805
## s10 0.9914411
-Repeat the predict()
es.prdct <- predict(es.hltWtrs, n.ahead = 10)
es.prdct
## Time Series:
## Start = c(187, 1)
## End = c(187, 10)
## Frequency = 10
## fit
## [1,] 7487.492
## [2,] 7432.783
## [3,] 7369.762
## [4,] 7309.106
## [5,] 7253.167
## [6,] 7188.050
## [7,] 7128.485
## [8,] 7078.980
## [9,] 7009.953
## [10,] 6959.203
-Repeat the plot()
ts.plot(es.ts,es.prdct)
plot(es.ts)
plot(es.hltWtrs)
plot(es.prdct)