Nile Dataset
Time series to consistently measure long term trends (frequency of 15)
nilets = ts(Nile, start=1, frequency=15)
summary(nilets)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 456.0 798.5 893.5 919.4 1032.5 1370.0
plot(nilets)

HoltWinters
nilehw = HoltWinters(nilets, gamma = TRUE)
nilehw
## Holt-Winters exponential smoothing with trend and additive seasonal component.
##
## Call:
## HoltWinters(x = nilets, gamma = TRUE)
##
## Smoothing parameters:
## alpha: 0.5283868
## beta : 0
## gamma: TRUE
##
## Coefficients:
## [,1]
## a 709.7339298
## b 0.2141176
## s1 68.5680674
## s2 -9.7003451
## s3 39.8647095
## s4 35.1995909
## s5 -93.6047796
## s6 91.8663353
## s7 -27.0296839
## s8 -40.4542698
## s9 65.8586745
## s10 -122.1936577
## s11 -215.9876008
## s12 -78.9697424
## s13 -105.9779697
## s14 22.9494361
## s15 30.2660702
summary(nilehw)
## Length Class Mode
## fitted 340 mts numeric
## x 100 ts numeric
## alpha 1 -none- numeric
## beta 1 -none- numeric
## gamma 1 -none- logical
## coefficients 17 -none- numeric
## seasonal 1 -none- character
## SSE 1 -none- numeric
## call 3 -none- call
plot(nilehw)

Holt Winters model to predict trends of next 10 years
nilep = predict(nilehw, n.ahead=10)
ts.plot(nilets, nilep)

AirPassengers Dataset (Part2)
AirPassengersts = ts(AirPassengers, start=1, frequency=25)
summary(AirPassengersts)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 104.0 180.0 265.5 280.3 360.5 622.0
plot(AirPassengersts)

HoltWinters
AirPassengershw = HoltWinters(AirPassengersts, gamma = TRUE)
summary(AirPassengershw)
## Length Class Mode
## fitted 476 mts numeric
## x 144 ts numeric
## alpha 1 -none- numeric
## beta 1 -none- numeric
## gamma 1 -none- logical
## coefficients 27 -none- numeric
## seasonal 1 -none- character
## SSE 1 -none- numeric
## call 3 -none- call
plot(AirPassengershw)

Predicting the trend in next 10 years
AirPassengersp = predict(AirPassengershw, n.ahead=10)
ts.plot(AirPassengersts, AirPassengersp)

EuStockMarkets Dataset (8 year frequnecy, considering the economic booms and busts cycle - Part 3)
eus = EuStockMarkets[,4.]
EuStockMarketsts = ts(eus, start=1, frequency=8)
summary(EuStockMarketsts)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 2281 2843 3247 3566 3994 6179
plot(EuStockMarketsts)

EuStockMarketshw = HoltWinters(EuStockMarketsts, gamma = FALSE)
summary(EuStockMarketshw)
## Length Class Mode
## fitted 5574 mts numeric
## x 1860 ts numeric
## alpha 1 -none- numeric
## beta 1 -none- numeric
## gamma 1 -none- logical
## coefficients 2 -none- numeric
## seasonal 1 -none- character
## SSE 1 -none- numeric
## call 3 -none- call
plot(EuStockMarketshw)

Predict next 8 years
EuStockMarketsp = predict(EuStockMarketshw, n.ahead=8)
ts.plot(EuStockMarketsts, EuStockMarketsp)
