Exponential Smoothing

Task 3 Time Series Analysis Practicum

Khusnia Nurul Khikmah (G1501211049)

2/7/2022

Question

The data used in this third practice is the time series data selected in the first practice assignment. Perform first and second-order exponential smoothing with \(\alpha\) (0.25, 0.5, 0.75, and optimum \(\alpha\)) on the data. Then compare the results of the smoothing accuracy of each method. Give the conclusion!

Upload the practicum 3 assignment. The compressed folder naming rule is NIM_Name_Prakt3 (7Z or ZIP). The folder consists of data files, R scripts, and the results.

Answer

This R program is also attached in Exponential Smoothing

Data

The data used is Daily Delhi climate data taken from Kaggle. This data has several variables: mean temperature, humidity, wind speed, and mean pressure. However, in this assignment, the variable used is wind speed only.

Read data

DailyDelhiClimateTest <- read.csv("D:/S2/IPB/STA542 Analisis Deret Waktu/1/Res/DailyDelhiClimateTest.csv", header=TRUE)
head(DailyDelhiClimateTest)
##         date meantemp humidity wind_speed meanpressure
## 1 2017-01-01 15.91304 85.86957   2.743478       59.000
## 2 2017-01-02 18.50000 77.22222   2.894444     1018.278
## 3 2017-01-03 17.11111 81.88889   4.016667     1018.333
## 4 2017-01-04 18.70000 70.05000   4.545000     1015.700
## 5 2017-01-05 18.38889 74.94444   3.300000     1014.333
## 6 2017-01-06 19.31818 79.31818   8.681818     1011.773

Data visualization

Before the visualization is carried out, the selected wind speed data will be formed into a time-series object with the ts function first. The data used consisted of 114 observations measured in 114 days. The visualization of the data is presented in the following plot.

DailyDelhiClimateTest.ts <- ts(DailyDelhiClimateTest$wind_speed, start=1) #form a time-series object
DailyDelhiClimateTest.ts
## Time Series:
## Start = 1 
## End = 114 
## Frequency = 1 
##   [1]  2.743478  2.894444  4.016667  4.545000  3.300000  8.681818 10.041667
##   [8]  1.950000  6.542857  9.361111  9.772222  6.626316  6.435294  5.276000
##  [15]  3.630435 10.380000  8.038889  6.029167 10.338095 11.226316 13.695652
##  [22]  5.868000  6.752941  3.391304  8.756000  8.467857 14.358333  9.690909
##  [29] 10.294444  4.322222  4.625000  5.100000  3.027273  1.854545  9.820000
##  [36]  8.100000  9.044444  7.637500  4.080000  7.875000  9.066667  3.950000
##  [43]  1.625000  6.377778  6.962500  5.557143 10.437500  9.280000  6.250000
##  [50]  6.054545  6.937500 12.341667  7.412500 14.350000 16.662500 11.928571
##  [57] 11.112500  5.100000  3.911111  6.415385  5.930000  7.412500  8.350000
##  [64]  9.962500  9.666667  6.025000 10.263636  8.342857 11.462500  5.566667
##  [71]  7.637500  9.055556  4.522222  7.175000  5.560000 11.490000  7.123077
##  [78]  9.161111 10.077778  9.262500 10.187500  3.487500 10.033333 10.425000
##  [85] 17.590000 13.650000  8.844444 13.200000 10.585714  6.950000  9.037500
##  [92]  9.262500  6.937500 14.320000 14.384615 13.577778  4.650000  8.337500
##  [99] 14.125000 19.314286 15.512500  9.487500  4.944444  1.387500  5.966667
## [106]  2.100000  5.366667  7.811111  9.025000  5.562500  6.962500  8.890000
## [113]  9.962500 12.157143
ts.plot(DailyDelhiClimateTest.ts, col="blue", ylab = "Wind speed", xlab = "Day")
title(main = "Time Series Plot of Wind speed", sub = "Source : Kaggle (https://www.kaggle.com/)", 
      cex.sub = 0.8)
points(DailyDelhiClimateTest.ts, pch = 20, col = "blue")

Split data

The data used will be divided into train data and test data. Train data will be used for smoothing with an exponential of 80% and train data of 20%. Splitting this data using the subset function. The data splitting ratio of 80:20 was chosen because the wind speed data from the Daily Delhi Climate has a reasonably narrow range, which is between 0 to 20 and when viewed from the average value of 8.1439241. This task focuses on exponential smoothing, and the 80:20 ratio is the best splitting ratio previously discussed in [Rácz, A. et al.].

options(digits = 8)

# Training set
train.DailyDelhiClimateTest.ts = subset(DailyDelhiClimateTest.ts, start=1,end=94)

# Testing set
test.DailyDelhiClimateTest.ts = subset(DailyDelhiClimateTest.ts, start=94,end=114)

Smoothing with an exponential smoothing

Smoothing with exponential smoothing will be done in two ways, first with the single exponential smoothing or first-order exponential smoothing and second by using double exponential smoothing or second-order exponential smoothing. This data smoothing with exponential smoothing uses wind speed data split or as many as 94 observations (data train).

Single exponential smoothing or first order exponential smoothing

Single exponential smoothing is a method appropriate for time series data that follows a stationary pattern or a method that assumes that the data fluctuates around the mean value that remains without a trend. This method can predict the future by smoothing the data and generating forecast data [Montgomery, et.al]. \[F_{t+1}=\alpha X_{t}+(1-\alpha )F_{t}\] where:

\(F_{t+1}\) is the new predictive value in period \(t+1\)

\(\alpha\) is the smoothing parameter, where \(\alpha\in \left [ 0,1 \right ]\)

\(X_{t}+(1-\alpha )\) is the actual value in the in period \(t\)

\(F_{t}\) is the new predictive value in period \(t\)

Single exponential smoothing \(\alpha = 0.25\)

For this third task, the first wind speed data was smoothed using \(\alpha = 0.25\). Smoothing the data with \(\alpha = 0.25\) is done in two ways: the Holtwinters function and the ses function, which is automatically provided by the forecast package.

Using Holtwinters function
data25.hw <- HoltWinters(train.DailyDelhiClimateTest.ts, alpha=0.25, beta=FALSE, gamma=FALSE)
str(data25.hw)
## List of 9
##  $ fitted      : Time-Series [1:93, 1:2] from 2 to 94: 2.74 2.78 3.09 3.45 3.42 ...
##   ..- attr(*, "dimnames")=List of 2
##   .. ..$ : NULL
##   .. ..$ : chr [1:2] "xhat" "level"
##  $ x           : Time-Series [1:94] from 1 to 94: 2.74 2.89 4.02 4.54 3.3 ...
##  $ alpha       : num 0.25
##  $ beta        : logi FALSE
##  $ gamma       : logi FALSE
##  $ coefficients: Named num 10.4
##   ..- attr(*, "names")= chr "a"
##  $ seasonal    : chr "additive"
##  $ SSE         : num 973
##  $ call        : language HoltWinters(x = train.DailyDelhiClimateTest.ts, alpha = 0.25, beta = FALSE,      gamma = FALSE)
##  - attr(*, "class")= chr "HoltWinters"
data25.hw$SSE
## [1] 972.51033
data25.hw$fitted
## Time Series:
## Start = 2 
## End = 94 
## Frequency = 1 
##          xhat      level
##  2  2.7434783  2.7434783
##  3  2.7812198  2.7812198
##  4  3.0900815  3.0900815
##  5  3.4538111  3.4538111
##  6  3.4153584  3.4153584
##  7  4.7319733  4.7319733
##  8  6.0593967  6.0593967
##  9  5.0320475  5.0320475
## 10  5.4097499  5.4097499
## 11  6.3975902  6.3975902
## 12  7.2412482  7.2412482
## 13  7.0875151  7.0875151
## 14  6.9244599  6.9244599
## 15  6.5123449  6.5123449
## 16  5.7918674  5.7918674
## 17  6.9389005  6.9389005
## 18  7.2138976  7.2138976
## 19  6.9177149  6.9177149
## 20  7.7728100  7.7728100
## 21  8.6361864  8.6361864
## 22  9.9010529  9.9010529
## 23  8.8927896  8.8927896
## 24  8.3578275  8.3578275
## 25  7.1161967  7.1161967
## 26  7.5261475  7.5261475
## 27  7.7615749  7.7615749
## 28  9.4107645  9.4107645
## 29  9.4808007  9.4808007
## 30  9.6842116  9.6842116
## 31  8.3437143  8.3437143
## 32  7.4140357  7.4140357
## 33  6.8355268  6.8355268
## 34  5.8834633  5.8834633
## 35  4.8762338  4.8762338
## 36  6.1121754  6.1121754
## 37  6.6091315  6.6091315
## 38  7.2179598  7.2179598
## 39  7.3228448  7.3228448
## 40  6.5121336  6.5121336
## 41  6.8528502  6.8528502
## 42  7.4063043  7.4063043
## 43  6.5422282  6.5422282
## 44  5.3129212  5.3129212
## 45  5.5791353  5.5791353
## 46  5.9249765  5.9249765
## 47  5.8330181  5.8330181
## 48  6.9841386  6.9841386
## 49  7.5581039  7.5581039
## 50  7.2310779  7.2310779
## 51  6.9369448  6.9369448
## 52  6.9370836  6.9370836
## 53  8.2882294  8.2882294
## 54  8.0692970  8.0692970
## 55  9.6394728  9.6394728
## 56 11.3952296 11.3952296
## 57 11.5285650 11.5285650
## 58 11.4245488 11.4245488
## 59  9.8434116  9.8434116
## 60  8.3603365  8.3603365
## 61  7.8740985  7.8740985
## 62  7.3880739  7.3880739
## 63  7.3941804  7.3941804
## 64  7.6331353  7.6331353
## 65  8.2154765  8.2154765
## 66  8.5782740  8.5782740
## 67  7.9399555  7.9399555
## 68  8.5208757  8.5208757
## 69  8.4763711  8.4763711
## 70  9.2229033  9.2229033
## 71  8.3088442  8.3088442
## 72  8.1410081  8.1410081
## 73  8.3696450  8.3696450
## 74  7.4077893  7.4077893
## 75  7.3495920  7.3495920
## 76  6.9021940  6.9021940
## 77  8.0491455  8.0491455
## 78  7.8176283  7.8176283
## 79  8.1534990  8.1534990
## 80  8.6345687  8.6345687
## 81  8.7915515  8.7915515
## 82  9.1405387  9.1405387
## 83  7.7272790  7.7272790
## 84  8.3037926  8.3037926
## 85  8.8340944  8.8340944
## 86 11.0230708 11.0230708
## 87 11.6798031 11.6798031
## 88 10.9709634 10.9709634
## 89 11.5282226 11.5282226
## 90 11.2925955 11.2925955
## 91 10.2069466 10.2069466
## 92  9.9145850  9.9145850
## 93  9.7515637  9.7515637
## 94  9.0480478  9.0480478
plot(data25.hw, col="blue", ylab = "Wind speed", xlab = "Day")
points(train.DailyDelhiClimateTest.ts, pch = 20, col = "blue")
legend("topleft",c("Actual data","Smoothed data"), lty=8, col=c("blue","red"), cex=0.7)

data25.hwforecast<-forecast(data25.hw, h=20)
data25.hwforecast
##     Point Forecast     Lo 80     Hi 80      Lo 95     Hi 95
##  95      10.366036 6.2208338 14.511238 4.02649631 16.705575
##  96      10.366036 6.0932593 14.638812 3.83138806 16.900684
##  97      10.366036 5.9693851 14.762687 3.64193875 17.090133
##  98      10.366036 5.8489066 14.883165 3.45768280 17.274389
##  99      10.366036 5.7315590 15.000513 3.27821517 17.453857
## 100      10.366036 5.6171103 15.114961 3.10318090 17.628891
## 101      10.366036 5.5053555 15.226716 2.93226681 17.799805
## 102      10.366036 5.3961131 15.335959 2.76519496 17.966877
## 103      10.366036 5.2892208 15.442851 2.60171731 18.130354
## 104      10.366036 5.1845332 15.547538 2.44161142 18.290460
## 105      10.366036 5.0819193 15.650152 2.28467689 18.447395
## 106      10.366036 4.9812604 15.750811 2.13073241 18.601339
## 107      10.366036 4.8824489 15.849623 1.97961332 18.752458
## 108      10.366036 4.7853867 15.946685 1.83116954 18.900902
## 109      10.366036 4.6899841 16.042088 1.68526382 19.046808
## 110      10.366036 4.5961587 16.135913 1.54177027 19.190301
## 111      10.366036 4.5038348 16.228237 1.40057305 19.331499
## 112      10.366036 4.4129426 16.319129 1.26156534 19.470506
## 113      10.366036 4.3234173 16.408654 1.12464833 19.607423
## 114      10.366036 4.2351993 16.496872 0.98973042 19.742341
plot(data25.hwforecast, col="blue", ylab = "Wind speed", xlab = "Day")

Forecast Accuracy Measure for \(\alpha = 0.25\) by using Holtwinters function
SSE25hw= data25.hw$SSE
MSE25hw= SSE25hw/length(train.DailyDelhiClimateTest.ts)
RMSE25hw = sqrt(MSE25hw)
AccuracyMeasur25hw <- c(SSE25hw, MSE25hw, RMSE25hw)
mod25hw <- c("SSE", "MSE","RMSE")
compmodel25hw <- cbind(mod25hw, AccuracyMeasur25hw)
Using ses function
data25ses <- ses(train.DailyDelhiClimateTest.ts, alpha=0.25, h=20)
summary(data25ses)
## 
## Forecast method: Simple exponential smoothing
## 
## Model Information:
## Simple exponential smoothing 
## 
## Call:
##  ses(y = train.DailyDelhiClimateTest.ts, h = 20, alpha = 0.25) 
## 
##   Smoothing parameters:
##     alpha = 0.25 
## 
##   Initial states:
##     l = 4.3262 
## 
##   sigma:  3.2417
## 
##       AIC      AICc       BIC 
## 650.15374 650.28561 655.24033 
## 
## Error measures:
##                      ME     RMSE       MAE        MPE      MAPE       MASE
## Training set 0.25701585 3.207015 2.5830273 -16.462678 42.632831 0.88209303
##                    ACF1
## Training set 0.16205301
## 
## Forecasts:
##     Point Forecast     Lo 80     Hi 80      Lo 95     Hi 95
##  95      10.366036 6.2116476 14.520424 4.01244727 16.719624
##  96      10.366036 6.0837904 14.648281 3.81690665 16.915165
##  97      10.366036 5.9596417 14.772430 3.62703750 17.105034
##  98      10.366036 5.8388962 14.893176 3.44237321 17.289698
##  99      10.366036 5.7212886 15.010783 3.26250787 17.469564
## 100      10.366036 5.6065862 15.125486 3.08708570 17.644986
## 101      10.366036 5.4945838 15.237488 2.91579285 17.816279
## 102      10.366036 5.3850993 15.346972 2.74835075 17.983721
## 103      10.366036 5.2779701 15.454102 2.58451082 18.147561
## 104      10.366036 5.1730505 15.559021 2.42405013 18.308022
## 105      10.366036 5.0702091 15.661863 2.26676781 18.465304
## 106      10.366036 4.9693272 15.762745 2.11248218 18.619590
## 107      10.366036 4.8702967 15.861775 1.96102819 18.771044
## 108      10.366036 4.7730195 15.959052 1.81225545 18.919816
## 109      10.366036 4.6774054 16.054666 1.66602639 19.066045
## 110      10.366036 4.5833721 16.148700 1.52221483 19.209857
## 111      10.366036 4.4908436 16.241228 1.38070471 19.351367
## 112      10.366036 4.3997499 16.332322 1.24138894 19.490683
## 113      10.366036 4.3100263 16.422045 1.10416851 19.627903
## 114      10.366036 4.2216127 16.510459 0.96895161 19.763120
plot(data25ses, col="blue", ylab = "Wind speed", xlab = "Day")
points(train.DailyDelhiClimateTest.ts, pch = 20, col = "blue")

accuracy(data25ses, test.DailyDelhiClimateTest.ts)
##                       ME      RMSE       MAE        MPE      MAPE       MASE
## Training set  0.25701585 3.2070150 2.5830273 -16.462678 42.632831 0.88209303
## Test set     -1.38977532 4.7745579 4.0772860 -75.239799 92.484007 1.39237615
##                    ACF1 Theil's U
## Training set 0.16205301        NA
## Test set     0.57409136 1.1744449

Single exponential smoothing \(\alpha = 0.50\)

The second single exponential smoothing is done on the wind speed data using \(\alpha = 0.50\). Smoothing the data with \(\alpha = 0.50\) is done in two ways: the Holtwinters function and the ses function, which is automatically provided by the forecast package.

Using Holtwinters function
data50.hw <- HoltWinters(train.DailyDelhiClimateTest.ts, alpha=0.50, beta=FALSE, gamma=FALSE)
str(data50.hw)
## List of 9
##  $ fitted      : Time-Series [1:93, 1:2] from 2 to 94: 2.74 2.82 3.42 3.98 3.64 ...
##   ..- attr(*, "dimnames")=List of 2
##   .. ..$ : NULL
##   .. ..$ : chr [1:2] "xhat" "level"
##  $ x           : Time-Series [1:94] from 1 to 94: 2.74 2.89 4.02 4.54 3.3 ...
##  $ alpha       : num 0.5
##  $ beta        : logi FALSE
##  $ gamma       : logi FALSE
##  $ coefficients: Named num 11.2
##   ..- attr(*, "names")= chr "a"
##  $ seasonal    : chr "additive"
##  $ SSE         : num 1007
##  $ call        : language HoltWinters(x = train.DailyDelhiClimateTest.ts, alpha = 0.5, beta = FALSE,      gamma = FALSE)
##  - attr(*, "class")= chr "HoltWinters"
data50.hw$SSE
## [1] 1006.796
data50.hw$fitted
## Time Series:
## Start = 2 
## End = 94 
## Frequency = 1 
##          xhat      level
##  2  2.7434783  2.7434783
##  3  2.8189614  2.8189614
##  4  3.4178140  3.4178140
##  5  3.9814070  3.9814070
##  6  3.6407035  3.6407035
##  7  6.1612608  6.1612608
##  8  8.1014638  8.1014638
##  9  5.0257319  5.0257319
## 10  5.7842945  5.7842945
## 11  7.5727028  7.5727028
## 12  8.6724625  8.6724625
## 13  7.6493892  7.6493892
## 14  7.0423416  7.0423416
## 15  6.1591708  6.1591708
## 16  4.8948028  4.8948028
## 17  7.6374014  7.6374014
## 18  7.8381451  7.8381451
## 19  6.9336559  6.9336559
## 20  8.6358756  8.6358756
## 21  9.9310957  9.9310957
## 22 11.8133739 11.8133739
## 23  8.8406870  8.8406870
## 24  7.7968141  7.7968141
## 25  5.5940592  5.5940592
## 26  7.1750296  7.1750296
## 27  7.8214434  7.8214434
## 28 11.0898884 11.0898884
## 29 10.3903987 10.3903987
## 30 10.3424216 10.3424216
## 31  7.3323219  7.3323219
## 32  5.9786610  5.9786610
## 33  5.5393305  5.5393305
## 34  4.2833016  4.2833016
## 35  3.0689235  3.0689235
## 36  6.4444618  6.4444618
## 37  7.2722309  7.2722309
## 38  8.1583377  8.1583377
## 39  7.8979188  7.8979188
## 40  5.9889594  5.9889594
## 41  6.9319797  6.9319797
## 42  7.9993232  7.9993232
## 43  5.9746616  5.9746616
## 44  3.7998308  3.7998308
## 45  5.0888043  5.0888043
## 46  6.0256521  6.0256521
## 47  5.7913975  5.7913975
## 48  8.1144488  8.1144488
## 49  8.6972244  8.6972244
## 50  7.4736122  7.4736122
## 51  6.7640788  6.7640788
## 52  6.8507894  6.8507894
## 53  9.5962280  9.5962280
## 54  8.5043640  8.5043640
## 55 11.4271820 11.4271820
## 56 14.0448410 14.0448410
## 57 12.9867062 12.9867062
## 58 12.0496031 12.0496031
## 59  8.5748016  8.5748016
## 60  6.2429563  6.2429563
## 61  6.3291705  6.3291705
## 62  6.1295852  6.1295852
## 63  6.7710426  6.7710426
## 64  7.5605213  7.5605213
## 65  8.7615107  8.7615107
## 66  9.2140887  9.2140887
## 67  7.6195443  7.6195443
## 68  8.9415903  8.9415903
## 69  8.6422237  8.6422237
## 70 10.0523619 10.0523619
## 71  7.8095143  7.8095143
## 72  7.7235071  7.7235071
## 73  8.3895313  8.3895313
## 74  6.4558768  6.4558768
## 75  6.8154384  6.8154384
## 76  6.1877192  6.1877192
## 77  8.8388596  8.8388596
## 78  7.9809683  7.9809683
## 79  8.5710397  8.5710397
## 80  9.3244087  9.3244087
## 81  9.2934544  9.2934544
## 82  9.7404772  9.7404772
## 83  6.6139886  6.6139886
## 84  8.3236610  8.3236610
## 85  9.3743305  9.3743305
## 86 13.4821652 13.4821652
## 87 13.5660826 13.5660826
## 88 11.2052635 11.2052635
## 89 12.2026318 12.2026318
## 90 11.3941730 11.3941730
## 91  9.1720865  9.1720865
## 92  9.1047933  9.1047933
## 93  9.1836466  9.1836466
## 94  8.0605733  8.0605733
plot(data50.hw, col="blue", ylab = "Wind speed", xlab = "Day")
points(train.DailyDelhiClimateTest.ts, pch = 20, col = "blue")
legend("topleft",c("Actual data","Smoothed data"), lty=8, col=c("blue","red"), cex=0.8)

data50.hwforecast<-forecast(data50.hw, h=20)
data50.hwforecast
##     Point Forecast     Lo 80     Hi 80        Lo 95     Hi 95
##  95      11.190287 6.9572695 15.423304  4.716445629 17.664128
##  96      11.190287 6.4576296 15.922944  3.952312349 18.428261
##  97      11.190287 6.0059206 16.374653  3.261483059 19.119090
##  98      11.190287 5.5905314 16.790042  2.626199963 19.754373
##  99      11.190287 5.2038964 17.176677  2.034892874 20.345680
## 100      11.190287 4.8407610 17.539812  1.479525114 20.901048
## 101      11.190287 4.4972989 17.883274  0.954245227 21.426328
## 102      11.190287 4.1706219 18.209951  0.454635835 21.925937
## 103      11.190287 3.8584859 18.522087 -0.022734924 22.403308
## 104      11.190287 3.5591065 18.821467 -0.480596232 22.861170
## 105      11.190287 3.2710368 19.109537 -0.921160895 23.301734
## 106      11.190287 2.9930842 19.387489 -1.346252588 23.726826
## 107      11.190287 2.7242524 19.656321 -1.757395400 24.137969
## 108      11.190287 2.4636983 19.916875 -2.155878525 24.536452
## 109      11.190287 2.2107013 20.169872 -2.542804018 24.923377
## 110      11.190287 1.9646397 20.415934 -2.919122753 25.299696
## 111      11.190287 1.7249726 20.655601 -3.285661958 25.666235
## 112      11.190287 1.4912260 20.889347 -3.643146618 26.023720
## 113      11.190287 1.2629815 21.117592 -3.992216336 26.372790
## 114      11.190287 1.0398682 21.340705 -4.333438784 26.714012
plot(data50.hwforecast, col="blue", ylab = "Wind speed", xlab = "Day")

Forecast Accuracy Measure for \(\alpha = 0.50\) by using Holtwinters function
SSE50hw= data50.hw$SSE
MSE50hw= SSE50hw/length(train.DailyDelhiClimateTest.ts)
RMSE50hw = sqrt(MSE50hw)
AccuracyMeasur50hw <- c(SSE50hw, MSE50hw, RMSE50hw)
mod50hw <- c("SSE", "MSE","RMSE")
compmodel50hw <- cbind(mod50hw, AccuracyMeasur50hw)
Using ses function
data50ses <- ses(train.DailyDelhiClimateTest.ts, alpha=0.50, h=20)
summary(data50ses)
## 
## Forecast method: Simple exponential smoothing
## 
## Model Information:
## Simple exponential smoothing 
## 
## Call:
##  ses(y = train.DailyDelhiClimateTest.ts, h = 20, alpha = 0.5) 
## 
##   Smoothing parameters:
##     alpha = 0.5 
## 
##   Initial states:
##     l = 3.2277 
## 
##   sigma:  3.3076
## 
##       AIC      AICc       BIC 
## 653.93545 654.06731 659.02203 
## 
## Error measures:
##                      ME      RMSE       MAE        MPE      MAPE       MASE
## Training set 0.16941624 3.2721787 2.6228044 -15.694672 42.536967 0.89567676
##                       ACF1
## Training set -0.0046452768
## 
## Forecasts:
##     Point Forecast     Lo 80     Hi 80        Lo 95     Hi 95
##  95      11.190287 6.9514848 15.429089  4.707598637 17.672975
##  96      11.190287 6.4511621 15.929411  3.942421112 18.438152
##  97      11.190287 5.9988358 16.381737  3.250647752 19.129926
##  98      11.190287 5.5828789 16.797694  2.614496493 19.766077
##  99      11.190287 5.1957156 17.184858  2.022381338 20.358192
## 100      11.190287 4.8320839 17.548489  1.466254627 20.914319
## 101      11.190287 4.4881524 17.892421  0.940256905 21.440316
## 102      11.190287 4.1610290 18.219544  0.439964759 21.940609
## 103      11.190287 3.8484665 18.532107 -0.038058364 22.418632
## 104      11.190287 3.5486779 18.831895 -0.496545373 22.877119
## 105      11.190287 3.2602145 19.120359 -0.937712101 23.318285
## 106      11.190287 2.9818822 19.398691 -1.363384713 23.743958
## 107      11.190287 2.7126829 19.667890 -1.775089383 24.155663
## 108      11.190287 2.4517728 19.928801 -2.174117066 24.554690
## 109      11.190287 2.1984300 20.182143 -2.561571321 24.942145
## 110      11.190287 1.9520322 20.428541 -2.938404324 25.318978
## 111      11.190287 1.7120376 20.668536 -3.305444433 25.686018
## 112      11.190287 1.4779715 20.902602 -3.663417623 26.043991
## 113      11.190287 1.2494151 21.131158 -4.012964371 26.393538
## 114      11.190287 1.0259969 21.354576 -4.354653124 26.735226
plot(data50ses, col="blue", ylab = "Wind speed", xlab = "Day")
points(train.DailyDelhiClimateTest.ts, pch = 20, col = "blue")

accuracy(data50ses, test.DailyDelhiClimateTest.ts)
##                       ME      RMSE       MAE        MPE       MAPE       MASE
## Training set  0.16941624 3.2721787 2.6228044 -15.694672  42.536967 0.89567676
## Test set     -2.21402613 5.0761048 4.4069863 -89.173915 103.018415 1.50496743
##                       ACF1 Theil's U
## Training set -0.0046452768        NA
## Test set      0.5740913558 1.3592052

Single exponential smoothing \(\alpha = 0.75\)

The third single exponential smoothing is done on wind speed data using \(\alpha = 0.75\). Smoothing the data with \(\alpha = 0.75\) is done in two ways: the Holtwinters function and the ses function, which is automatically provided by the forecast package.

Using Holtwinters function
data75.hw <- HoltWinters(train.DailyDelhiClimateTest.ts, alpha=0.75, beta=FALSE, gamma=FALSE)
str(data75.hw)
## List of 9
##  $ fitted      : Time-Series [1:93, 1:2] from 2 to 94: 2.74 2.86 3.73 4.34 3.56 ...
##   ..- attr(*, "dimnames")=List of 2
##   .. ..$ : NULL
##   .. ..$ : chr [1:2] "xhat" "level"
##  $ x           : Time-Series [1:94] from 1 to 94: 2.74 2.89 4.02 4.54 3.3 ...
##  $ alpha       : num 0.75
##  $ beta        : logi FALSE
##  $ gamma       : logi FALSE
##  $ coefficients: Named num 12.6
##   ..- attr(*, "names")= chr "a"
##  $ seasonal    : chr "additive"
##  $ SSE         : num 1087
##  $ call        : language HoltWinters(x = train.DailyDelhiClimateTest.ts, alpha = 0.75, beta = FALSE,      gamma = FALSE)
##  - attr(*, "class")= chr "HoltWinters"
data75.hw$SSE
## [1] 1087.2691
data75.hw$fitted
## Time Series:
## Start = 2 
## End = 94 
## Frequency = 1 
##          xhat      level
##  2  2.7434783  2.7434783
##  3  2.8567029  2.8567029
##  4  3.7266757  3.7266757
##  5  4.3404189  4.3404189
##  6  3.5601047  3.5601047
##  7  7.4013898  7.4013898
##  8  9.3815975  9.3815975
##  9  3.8078994  3.8078994
## 10  5.8591177  5.8591177
## 11  8.4856128  8.4856128
## 12  9.4505699  9.4505699
## 13  7.3323793  7.3323793
## 14  6.6595654  6.6595654
## 15  5.6218914  5.6218914
## 16  4.1282989  4.1282989
## 17  8.8170747  8.8170747
## 18  8.2334353  8.2334353
## 19  6.5802338  6.5802338
## 20  9.3986299  9.3986299
## 21 10.7693943 10.7693943
## 22 12.9640877 12.9640877
## 23  7.6420219  7.6420219
## 24  6.9752114  6.9752114
## 25  4.2872811  4.2872811
## 26  7.6388203  7.6388203
## 27  8.2605979  8.2605979
## 28 12.8338995 12.8338995
## 29 10.4766567 10.4766567
## 30 10.3399975 10.3399975
## 31  5.8266660  5.8266660
## 32  4.9254165  4.9254165
## 33  5.0563541  5.0563541
## 34  3.5345431  3.5345431
## 35  2.2745449  2.2745449
## 36  7.9336362  7.9336362
## 37  8.0584091  8.0584091
## 38  8.7979356  8.7979356
## 39  7.9276089  7.9276089
## 40  5.0419022  5.0419022
## 41  7.1667256  7.1667256
## 42  8.5916814  8.5916814
## 43  5.1104203  5.1104203
## 44  2.4963551  2.4963551
## 45  5.4074221  5.4074221
## 46  6.5737305  6.5737305
## 47  5.8112898  5.8112898
## 48  9.2809474  9.2809474
## 49  9.2802369  9.2802369
## 50  7.0075592  7.0075592
## 51  6.2927989  6.2927989
## 52  6.7763247  6.7763247
## 53 10.9503312 10.9503312
## 54  8.2969578  8.2969578
## 55 12.8367394 12.8367394
## 56 15.7060599 15.7060599
## 57 12.8729435 12.8729435
## 58 11.5526109 11.5526109
## 59  6.7131527  6.7131527
## 60  4.6116215  4.6116215
## 61  5.9644438  5.9644438
## 62  5.9386110  5.9386110
## 63  7.0440277  7.0440277
## 64  8.0235069  8.0235069
## 65  9.4777517  9.4777517
## 66  9.6194379  9.6194379
## 67  6.9236095  6.9236095
## 68  9.4286296  9.4286296
## 69  8.6143003  8.6143003
## 70 10.7504501 10.7504501
## 71  6.8626125  6.8626125
## 72  7.4437781  7.4437781
## 73  8.6526112  8.6526112
## 74  5.5548195  5.5548195
## 75  6.7699549  6.7699549
## 76  5.8624887  5.8624887
## 77 10.0831222 10.0831222
## 78  7.8630882  7.8630882
## 79  8.8366054  8.8366054
## 80  9.7674847  9.7674847
## 81  9.3887462  9.3887462
## 82  9.9878115  9.9878115
## 83  5.1125779  5.1125779
## 84  8.8031445  8.8031445
## 85 10.0195361 10.0195361
## 86 15.6973840 15.6973840
## 87 14.1618460 14.1618460
## 88 10.1737948 10.1737948
## 89 12.4434487 12.4434487
## 90 11.0501479 11.0501479
## 91  7.9750370  7.9750370
## 92  8.7718842  8.7718842
## 93  9.1398461  9.1398461
## 94  7.4880865  7.4880865
plot(data75.hw, col="blue", ylab = "Wind speed", xlab = "Day")
points(train.DailyDelhiClimateTest.ts, pch = 20, col = "blue")
legend("topleft",c("Actual data","Smoothed data"), lty=8, col=c("blue","red"), cex=0.8)

data75.hwforecast<-forecast(data75.hw, h=20)
data75.hwforecast
##     Point Forecast        Lo 80     Hi 80        Lo 95     Hi 95
##  95      12.612022  8.210137869 17.013905   5.87992136 19.344122
##  96      12.612022  7.109666929 18.114376   4.19689630 21.027147
##  97      12.612022  6.195228516 19.028815   2.79838343 22.425660
##  98      12.612022  5.395751092 19.828292   1.57568822 23.648355
##  99      12.612022  4.676412826 20.547630   0.47555528 24.748488
## 100      12.612022  4.017068826 21.206974  -0.53282435 25.756868
## 101      12.612022  3.404821170 21.819222  -1.46917634 26.693220
## 102      12.612022  2.830821963 22.393221  -2.34703237 27.571076
## 103      12.612022  2.288689148 22.935354  -3.17615296 28.400196
## 104      12.612022  1.773639825 23.450403  -3.96385293 29.187896
## 105      12.612022  1.281979849 23.942063  -4.71578197 29.939825
## 106      12.612022  0.810785535 24.413258  -5.43641149 30.660455
## 107      12.612022  0.357695864 24.866347  -6.12935234 31.353396
## 108      12.612022 -0.079228371 25.303272  -6.79757030 32.021614
## 109      12.612022 -0.501603086 25.725646  -7.44353668 32.667580
## 110      12.612022 -0.910791680 26.134835  -8.06933663 33.293380
## 111      12.612022 -1.307957049 26.532000  -8.67674865 33.900792
## 112      12.612022 -1.694100592 26.918144  -9.26730423 34.491347
## 113      12.612022 -2.070091966 27.294135  -9.84233342 35.066377
## 114      12.612022 -2.436692144 27.660735 -10.40300001 35.627043
plot(data75.hwforecast, col="blue", ylab = "Wind speed", xlab = "Day")

Forecast Accuracy Measure for \(\alpha = 0.75\) by using Holtwinters function
SSE75hw= data75.hw$SSE
MSE75hw= SSE75hw/length(train.DailyDelhiClimateTest.ts)
RMSE75hw = sqrt(MSE75hw)
AccuracyMeasur75hw <- c(SSE75hw, MSE75hw, RMSE75hw)
mod75hw <- c("SSE", "MSE","RMSE")
compmodel75hw <- cbind(mod75hw, AccuracyMeasur75hw)
Using ses function
data75ses <- ses(train.DailyDelhiClimateTest.ts, alpha=0.75, h=20)
summary(data75ses)
## 
## Forecast method: Simple exponential smoothing
## 
## Model Information:
## Simple exponential smoothing 
## 
## Call:
##  ses(y = train.DailyDelhiClimateTest.ts, h = 20, alpha = 0.75) 
## 
##   Smoothing parameters:
##     alpha = 0.75 
## 
##   Initial states:
##     l = 2.8559 
## 
##   sigma:  3.4377
## 
##       AIC      AICc       BIC 
## 661.19265 661.32452 666.27924 
## 
## Error measures:
##                      ME      RMSE       MAE        MPE      MAPE       MASE
## Training set 0.13838408 3.4009615 2.7273634 -14.640898 43.042868 0.93138321
##                     ACF1
## Training set -0.18267363
## 
## Forecasts:
##     Point Forecast        Lo 80     Hi 80        Lo 95     Hi 95
##  95      12.612022  8.206393760 17.017649   5.87419524 19.349848
##  96      12.612022  7.104986793 18.119056   4.18973865 21.034305
##  97      12.612022  6.189770587 19.034273   2.79003625 22.434007
##  98      12.612022  5.389613152 19.834430   1.56630105 23.657742
##  99      12.612022  4.669663039 20.554380   0.46523237 24.758811
## 100      12.612022  4.009758221 21.214285  -0.54400496 25.768048
## 101      12.612022  3.396989806 21.827053  -1.48115338 26.705197
## 102      12.612022  2.822502373 22.401541  -2.35975608 27.583799
## 103      12.612022  2.279908436 22.944135  -3.18958190 28.413625
## 104      12.612022  1.764421028 23.459622  -3.97795186 29.201995
## 105      12.612022  1.272342861 23.951700  -4.73052047 29.954564
## 106      12.612022  0.800747763 24.423295  -5.45176294 30.675806
## 107      12.612022  0.347272708 24.876771  -6.14529318 31.369336
## 108      12.612022 -0.090023161 25.314066  -6.81407950 32.038123
## 109      12.612022 -0.512757136 25.736800  -7.46059533 32.684639
## 110      12.612022 -0.922293773 26.146337  -8.08692756 33.310971
## 111      12.612022 -1.319796958 26.543840  -8.69485622 33.918899
## 112      12.612022 -1.706268943 26.930312  -9.28591412 34.509957
## 113      12.612022 -2.082580124 27.306623  -9.86143241 35.085476
## 114      12.612022 -2.449492121 27.673535 -10.42257588 35.646619
plot(data75ses, col="blue", ylab = "Wind speed", xlab = "Day")
points(train.DailyDelhiClimateTest.ts, pch = 20, col = "blue")

accuracy(data75ses, test.DailyDelhiClimateTest.ts)
##                       ME      RMSE       MAE         MPE       MAPE       MASE
## Training set  0.13838408 3.4009615 2.7273634  -14.640898  43.042868 0.93138321
## Test set     -3.63576110 5.8381235 5.0211682 -113.208614 121.563186 1.71470798
##                     ACF1 Theil's U
## Training set -0.18267363        NA
## Test set      0.57409136 1.6889518

Single exponential smoothing \(\alpha = optimum\)

The fourth single exponential smoothing is done on wind speed data using \(\alpha = optimum\). Smoothing the data with \(\alpha = optimum\) is done in two ways: the Holtwinters function and the ses function, which is automatically provided by the forecast package. HoltWinters function by setting the value of \(\alpha\) as the optimum value or the value of \(\alpha\) that matches the data.

Using Holtwinters function
dataoptimum.hw <- HoltWinters(train.DailyDelhiClimateTest.ts, beta=FALSE, gamma=FALSE)
str(dataoptimum.hw)
## List of 9
##  $ fitted      : Time-Series [1:93, 1:2] from 2 to 94: 2.74 2.78 3.06 3.41 3.38 ...
##   ..- attr(*, "dimnames")=List of 2
##   .. ..$ : NULL
##   .. ..$ : chr [1:2] "xhat" "level"
##  $ x           : Time-Series [1:94] from 1 to 94: 2.74 2.89 4.02 4.54 3.3 ...
##  $ alpha       : num 0.231
##  $ beta        : logi FALSE
##  $ gamma       : logi FALSE
##  $ coefficients: Named num 10.3
##   ..- attr(*, "names")= chr "a"
##  $ seasonal    : chr "additive"
##  $ SSE         : num 972
##  $ call        : language HoltWinters(x = train.DailyDelhiClimateTest.ts, beta = FALSE, gamma = FALSE)
##  - attr(*, "class")= chr "HoltWinters"
dataoptimum.hw$SSE
## [1] 972.1572
dataoptimum.hw$fitted
## Time Series:
## Start = 2 
## End = 94 
## Frequency = 1 
##          xhat      level
##  2  2.7434783  2.7434783
##  3  2.7783097  2.7783097
##  4  3.0640273  3.0640273
##  5  3.4057220  3.4057220
##  6  3.3813295  3.3813295
##  7  4.6042751  4.6042751
##  8  5.8588073  5.8588073
##  9  4.9569549  4.9569549
## 10  5.3228593  5.3228593
## 11  6.2545776  6.2545776
## 12  7.0661797  7.0661797
## 13  6.9646929  6.9646929
## 14  6.8425483  6.8425483
## 15  6.4811093  6.4811093
## 16  5.8233927  5.8233927
## 17  6.8747076  6.8747076
## 18  7.1433112  7.1433112
## 19  6.8862522  6.8862522
## 20  7.6826724  7.6826724
## 21  8.5002730  8.5002730
## 22  9.6989674  9.6989674
## 23  8.8150744  8.8150744
## 24  8.3392925  8.3392925
## 25  7.1976770  7.1976770
## 26  7.5572182  7.5572182
## 27  7.7673237  7.7673237
## 28  9.2880224  9.2880224
## 29  9.3809777  9.3809777
## 30  9.5917356  9.5917356
## 31  8.3759368  8.3759368
## 32  7.5105087  7.5105087
## 33  6.9543485  6.9543485
## 34  6.0482811  6.0482811
## 35  5.0806891  5.0806891
## 36  6.1741580  6.1741580
## 37  6.6184944  6.6184944
## 38  7.1782173  7.1782173
## 39  7.2841844  7.2841844
## 40  6.5449048  6.5449048
## 41  6.8517886  6.8517886
## 42  7.3628123  7.3628123
## 43  6.5753974  6.5753974
## 44  5.4332260  5.4332260
## 45  5.6511560  5.6511560
## 46  5.9537134  5.9537134
## 47  5.8622154  5.8622154
## 48  6.9178396  6.9178396
## 49  7.4628447  7.4628447
## 50  7.1830134  7.1830134
## 51  6.9226497  6.9226497
## 52  6.9260760  6.9260760
## 53  8.1755782  8.1755782
## 54  7.9995184  7.9995184
## 55  9.4647217  9.4647217
## 56 11.1254159 11.1254159
## 57 11.3107225 11.3107225
## 58 11.2649880 11.2649880
## 59  9.8425824  9.8425824
## 60  8.4740545  8.4740545
## 61  7.9990717  7.9990717
## 62  7.5216889  7.5216889
## 63  7.4964965  7.4964965
## 64  7.6934195  7.6934195
## 65  8.2169490  8.2169490
## 66  8.5514324  8.5514324
## 67  7.9685259  7.9685259
## 68  8.4980611  8.4980611
## 69  8.4622519  8.4622519
## 70  9.1544787  9.1544787
## 71  8.3266873  8.3266873
## 72  8.1676758  8.1676758
## 73  8.3725303  8.3725303
## 74  7.4841750  7.4841750
## 75  7.4128411  7.4128411
## 76  6.9853478  6.9853478
## 77  8.0246754  8.0246754
## 78  7.8166557  7.8166557
## 79  8.1268528  8.1268528
## 80  8.5769764  8.5769764
## 81  8.7351426  8.7351426
## 82  9.0702351  9.0702351
## 83  7.7821687  7.7821687
## 84  8.3015646  8.3015646
## 85  8.7914903  8.7914903
## 86 10.8215104 10.8215104
## 87 11.4741085 11.4741085
## 88 10.8673841 10.8673841
## 89 11.4055726 11.4055726
## 90 11.2164123 11.2164123
## 91 10.2320521 10.2320521
## 92  9.9564413  9.9564413
## 93  9.7963329  9.7963329
## 94  9.1367339  9.1367339
plot(dataoptimum.hw, col="blue", ylab = "Wind speed", xlab = "Day")
points(train.DailyDelhiClimateTest.ts, pch = 20, col = "blue")
legend("topleft",c("Actual data","Smoothed data"), lty=8, col=c("blue","red"), cex=0.8)

dataoptimum.hwforecast<-forecast(dataoptimum.hw, h=20)
dataoptimum.hwforecast
##     Point Forecast     Lo 80     Hi 80     Lo 95     Hi 95
##  95      10.332634 6.1917201 14.473547 3.9996530 16.665614
##  96      10.332634 6.0829321 14.582335 3.8332761 16.831991
##  97      10.332634 5.9768603 14.688407 3.6710533 16.994214
##  98      10.332634 5.8733109 14.791956 3.5126881 17.152579
##  99      10.332634 5.7721120 14.893155 3.3579178 17.307349
## 100      10.332634 5.6731106 14.992156 3.2065081 17.458759
## 101      10.332634 5.5761693 15.089098 3.0582492 17.607018
## 102      10.332634 5.4811646 15.184102 2.9129521 17.752315
## 103      10.332634 5.3879850 15.277282 2.7704463 17.894821
## 104      10.332634 5.2965292 15.368738 2.6305766 18.034690
## 105      10.332634 5.2067049 15.458562 2.4932021 18.172065
## 106      10.332634 5.1184277 15.546839 2.3581938 18.307073
## 107      10.332634 5.0316203 15.633647 2.2254334 18.439834
## 108      10.332634 4.9462118 15.719055 2.0948124 18.570455
## 109      10.332634 4.8621366 15.803130 1.9662304 18.699037
## 110      10.332634 4.7793340 15.885933 1.8395949 18.825672
## 111      10.332634 4.6977481 15.967519 1.7148200 18.950447
## 112      10.332634 4.6173268 16.047940 1.5918261 19.073441
## 113      10.332634 4.5380214 16.127246 1.4705391 19.194728
## 114      10.332634 4.4597869 16.205480 1.3508897 19.314377
plot(dataoptimum.hwforecast, col="blue", ylab = "Wind speed", xlab = "Day")

Forecast Accuracy Measure for \(\alpha = optimum\) by using Holtwinters function
SSEoptimumhw= dataoptimum.hw$SSE
MSEoptimumhw= SSEoptimumhw/length(train.DailyDelhiClimateTest.ts)
RMSEoptimumhw = sqrt(MSEoptimumhw)
AccuracyMeasuroptimumhw <- c(SSEoptimumhw, MSEoptimumhw, RMSEoptimumhw)
modoptimumhw <- c("SSE", "MSE","RMSE")
compmodeloptimumhw <- cbind(modoptimumhw, AccuracyMeasuroptimumhw)
Using ses function
dataoptimumses <- ses(train.DailyDelhiClimateTest.ts, h=20)
summary(dataoptimumses)
## 
## Forecast method: Simple exponential smoothing
## 
## Model Information:
## Simple exponential smoothing 
## 
## Call:
##  ses(y = train.DailyDelhiClimateTest.ts, h = 20) 
## 
##   Smoothing parameters:
##     alpha = 0.1476 
## 
##   Initial states:
##     l = 5.2518 
## 
##   sigma:  3.2313
## 
##       AIC      AICc       BIC 
## 651.54838 651.81505 659.17827 
## 
## Error measures:
##                      ME      RMSE       MAE        MPE      MAPE       MASE
## Training set 0.35252393 3.1967051 2.5651765 -16.342171 42.477848 0.87599707
##                    ACF1
## Training set 0.22570428
## 
## Forecasts:
##     Point Forecast     Lo 80     Hi 80     Lo 95     Hi 95
##  95      10.142855 6.0018226 14.283888 3.8096922 16.476018
##  96      10.142855 5.9569581 14.328753 3.7410780 16.544633
##  97      10.142855 5.9125694 14.373141 3.6731913 16.612519
##  98      10.142855 5.8686417 14.417069 3.6060097 16.679701
##  99      10.142855 5.8251609 14.460550 3.5395115 16.746199
## 100      10.142855 5.7821136 14.503597 3.4736763 16.812034
## 101      10.142855 5.7394871 14.546224 3.4084847 16.877226
## 102      10.142855 5.6972693 14.588441 3.3439182 16.941792
## 103      10.142855 5.6554487 14.630262 3.2799591 17.005752
## 104      10.142855 5.6140142 14.671696 3.2165906 17.069120
## 105      10.142855 5.5729554 14.712755 3.1537966 17.131914
## 106      10.142855 5.5322623 14.753448 3.0915618 17.194149
## 107      10.142855 5.4919252 14.793786 3.0298714 17.255839
## 108      10.142855 5.4519349 14.833776 2.9687116 17.316999
## 109      10.142855 5.4122826 14.873428 2.9080687 17.377642
## 110      10.142855 5.3729600 14.912751 2.8479300 17.437781
## 111      10.142855 5.3339589 14.951752 2.7882830 17.497428
## 112      10.142855 5.2952716 14.990439 2.7291158 17.556595
## 113      10.142855 5.2568906 15.028820 2.6704172 17.615294
## 114      10.142855 5.2188088 15.066902 2.6121760 17.673535
plot(dataoptimumses, col="blue", ylab = "Wind speed", xlab = "Day")
points(train.DailyDelhiClimateTest.ts, pch = 20, col = "blue")

accuracy(dataoptimumses, test.DailyDelhiClimateTest.ts)
##                       ME      RMSE       MAE        MPE      MAPE       MASE
## Training set  0.35252393 3.1967051 2.5651765 -16.342171 42.477848 0.87599707
## Test set     -1.16659482 4.7144322 3.9880138 -71.466890 89.631630 1.36189006
##                    ACF1 Theil's U
## Training set 0.22570428        NA
## Test set     0.57409136  1.125629

Best Model in Simple exponential smoothing by using HoltWinters function

AccuracyMeasurSES <- cbind(AccuracyMeasur25hw, AccuracyMeasur50hw, AccuracyMeasur75hw, AccuracyMeasuroptimumhw)
modSES <- c("SSE", "MSE", "RMSE")
compmodelALLSES <- cbind(modSES, AccuracyMeasurSES)
colnames(compmodelALLSES) <- c("Accuracy Measure SES", "HW 0.25", "HW 0.5", "HW 0.75", "HW Optimum")
compmodelAllSES <- as.data.frame(cbind(compmodelALLSES))
compmodelAllSES
##   Accuracy Measure SES          HW 0.25           HW 0.5          HW 0.75
## 1                  SSE 972.510325275922 1006.79598674294 1087.26910678528
## 2                  MSE 10.3458545242119 10.7105956036483 11.5666926253754
## 3                 RMSE 3.21649724455221 3.27270463128714 3.40098406720399
##         HW Optimum
## 1 972.157203512489
## 2 10.3420979097073
## 3 3.21591323106009

Double exponential smoothing or second order exponential smoothing

Double exponential smoothing is the suitable method used for time series data, which is better used for data showing a trend [Yonar, H., et.al]. The trend itself is a smoothed estimate of the average growth at the end of each period. This method can predict the future by smoothing the data and generating forecast data [Montgomery, et.al]. \[S_{t}=\alpha X_{t}+\left ( 1-\alpha \right )S_{t-1}\] \[T_{t}=\beta \left ( S_{t}-S_{t-1}\right )+\left ( 1-\beta \right )T_{t-1}\] \[F_{t+m}=S_{t}+T_{t}m\] where:

\(S_{t}\) is the smoothing value for \(t\) period

\(X_{t}\) is the actual the actual value in the in period \(t\)

\(T_{t}\) is the trend smoothing

\(F_{t+m}\) is the new predictive value in period \(t+m\), where \(m\) is the future period

\(\alpha\) is the smoothing parameter, where \(\alpha\in \left [ 0,1 \right ]\)

\(\beta\) is the smoothing parameter for trend, where \(\beta\in \left [ 0,1 \right ]\)

Double exponential smoothing \(\alpha = 0.25\)

For this third task, the wind speed data is smoothed using \(\alpha = 0.25\). Smoothing the data with \(\alpha = 0.25\) is done in with Holtwinters function.

Using Holtwinters function
data25.des <- HoltWinters(train.DailyDelhiClimateTest.ts, alpha=0.25, beta=0.25, gamma=FALSE)
str(data25.des)
## List of 9
##  $ fitted      : Time-Series [1:92, 1:3] from 3 to 94: 3.05 3.5 4.04 4.08 5.75 ...
##   ..- attr(*, "dimnames")=List of 2
##   .. ..$ : NULL
##   .. ..$ : chr [1:3] "xhat" "level" "trend"
##  $ x           : Time-Series [1:94] from 1 to 94: 2.74 2.89 4.02 4.54 3.3 ...
##  $ alpha       : num 0.25
##  $ beta        : num 0.25
##  $ gamma       : logi FALSE
##  $ coefficients: Named num [1:2] 10.234 -0.106
##   ..- attr(*, "names")= chr [1:2] "a" "b"
##  $ seasonal    : chr "additive"
##  $ SSE         : num 1147
##  $ call        : language HoltWinters(x = train.DailyDelhiClimateTest.ts, alpha = 0.25, beta = 0.25,      gamma = FALSE)
##  - attr(*, "class")= chr "HoltWinters"
data25.des$SSE
## [1] 1147.2536
data25.des$fitted
## Time Series:
## Start = 3 
## End = 94 
## Frequency = 1 
##          xhat      level         trend
##  3  3.0454106  2.8944444  0.1509661836
##  4  3.4998943  3.2882246  0.2116696860
##  5  4.0381595  3.7611707  0.2769887908
##  6  4.0844735  3.8536197  0.2308538199
##  7  5.7519975  5.2338096  0.5181878644
##  8  7.6107070  6.8244148  0.7862921865
##  9  6.6280282  6.1955302  0.4324979998
## 10  7.0339103  6.6067355  0.4271748062
## 11  8.1883353  7.6157105  0.5726248587
## 12  9.2559248  8.5843071  0.6716177888
## 13  9.1057898  8.5985226  0.5072672225
## 14  8.7785271  8.4381659  0.3403612419
## 15  8.0243486  7.9028953  0.1214532965
## 16  6.7727039  6.9258702 -0.1531663197
## 17  7.7468176  7.6745279  0.0722896892
## 18  7.9103796  7.8198354  0.0905441459
## 19  7.4130447  7.4400763 -0.0270316596
## 20  8.3000913  8.1443073  0.1557840007
## 21  9.3703205  9.0316474  0.3386730304
## 22 11.0606597 10.4516534  0.6090062622
## 23 10.0469598  9.7624947  0.2844650339
## 24  9.3020440  9.2234551  0.0785888715
## 25  7.5335267  7.8243591 -0.2908323565
## 26  7.6247173  7.8391450 -0.2144277770
## 27  7.6737707  7.8355022 -0.1617315349
## 28  9.6009650  9.3449114  0.2560536296
## 29  9.8851262  9.6234510  0.2616751359
## 30 10.2747133  9.9874557  0.2872575292
## 31  8.7018173  8.7865905 -0.0847731602
## 32  7.3430388  7.6826130 -0.3395742437
## 33  6.3025149  6.7822791 -0.4797641661
## 34  4.7992376  5.4837044 -0.6844668020
## 35  3.1945545  4.0630645 -0.8685100584
## 36  4.3964961  4.8509159 -0.4544197129
## 37  5.0994214  5.3223721 -0.2229507218
## 38  6.1092904  6.0856771  0.0236132195
## 39  6.6104691  6.4913428  0.1191263214
## 40  5.9388238  5.9778518 -0.0390279972
## 41  6.5048509  6.4228679  0.0819830136
## 42  7.3874013  7.1453048  0.2420965001
## 43  6.5553099  6.5280510  0.0272589170
## 44  5.0418470  5.3227324 -0.2808854526
## 45  5.1784399  5.3758297 -0.1973897779
## 46  5.5385689  5.6244549 -0.0858860219
## 47  5.4584872  5.5432124 -0.0847251500
## 48  6.9297036  6.7032404  0.2264631473
## 49  7.8906344  7.5172777  0.3733566736
## 50  7.7512928  7.4804758  0.2708170261
## 51  7.4918763  7.3271060  0.1647703174
## 52  7.4834040  7.3532822  0.1301218000
## 53  9.1317329  8.6979697  0.4337632162
## 54  9.0282358  8.7019247  0.3263111606
## 55 11.0175983 10.3586769  0.6589214214
## 56 13.4405515 12.4288237  1.0117277782
## 57 13.9797855 13.0625565  0.9172290239
## 58 14.0009878 13.2629641  0.7380236799
## 59 11.9574528 11.7757409  0.1817119419
## 60  9.6246830  9.9458674 -0.3211844135
## 61  8.3005928  8.8223584 -0.5217655602
## 62  7.0380170  7.7079446 -0.6699276112
## 63  6.4851153  7.1316378 -0.6465224237
## 64  6.4213694  6.9513365 -0.5299671316
## 65  6.9980056  7.3066520 -0.3086464668
## 66  7.5233157  7.6651708 -0.1418551474
## 67  6.9132369  7.1487368 -0.2354998778
## 68  7.7247368  7.7508368 -0.0260999105
## 69  7.8917995  7.8792669  0.0125326081
## 70  9.0201760  8.7844746  0.2357013876
## 71  8.1766557  8.1567987  0.0198570522
## 72  8.0280266  8.0418668 -0.0138401818
## 73  8.3352892  8.2849089  0.0503803763
## 74  7.1940862  7.3820225 -0.1879363120
## 75  7.0001854  7.1893146 -0.1891291976
## 76  6.3609983  6.6401391 -0.2791407870
## 77  7.6846705  7.6432487  0.0414218202
## 78  7.5505944  7.5442721  0.0063222195
## 79  8.0602031  7.9532235  0.1069795170
## 80  8.7976747  8.5645967  0.2330779370
## 81  9.1760105  8.9138810  0.2621295198
## 82  9.7542305  9.4288829  0.3253476120
## 83  8.1212248  8.1875479 -0.0663230447
## 84  8.6524357  8.5992520  0.0531837364
## 85  9.2595458  9.0955768  0.1639690054
## 86 12.0267817 11.3421593  0.6846223943
## 87 13.2186598 12.4325863  0.7860735364
## 88 12.6377911 12.1251060  0.5126850746
## 89 13.3261664 12.7783433  0.5478231334
## 90 13.0175983 12.6410534  0.3765448745
## 91 11.4980187 11.5006987 -0.0026800172
## 92 10.7264266 10.8828890 -0.1564624349
## 93 10.1124871 10.3604449 -0.2479578460
## 94  8.8723458  9.3187403 -0.4463945389
plot(data25.des, col="blue", ylab = "Wind speed", xlab = "Day")
points(train.DailyDelhiClimateTest.ts, pch = 20, col = "blue")
legend("topleft",c("Actual data","Smoothed data"), lty=8, col=c("blue","red"), cex=0.8)

data25.desforecast<-forecast(data25.des, h=20)
data25.desforecast
##     Point Forecast         Lo 80     Hi 80        Lo 95     Hi 95
##  95     10.1283432   5.578354117 14.678332   3.16973540 17.086951
##  96     10.0224270   5.255444832 14.789409   2.73195689 17.312897
##  97      9.9165109   4.853370121 14.979652   2.17310530 17.659916
##  98      9.8105947   4.370193717 15.250996   1.49021938 18.130970
##  99      9.7046786   3.807767244 15.601590   0.68613094 18.723226
## 100      9.5987624   3.170393102 16.027132  -0.23258006 19.430105
## 101      9.4928463   2.463564140 16.522128  -1.25751305 20.243206
## 102      9.3869301   1.693041231 17.080819  -2.37985753 21.153718
## 103      9.2810140   0.864302825 17.697725  -3.59123492 22.153263
## 104      9.1750978  -0.017717067 18.367913  -4.88409932 23.234295
## 105      9.0691817  -0.948708373 19.087072  -6.25185903 24.390222
## 106      8.9632655  -1.924966204 19.851497  -7.68884792 25.615379
## 107      8.8573494  -2.943328176 20.658027  -9.19022953 26.904928
## 108      8.7514332  -4.001098287 21.503965 -10.75188069 28.254747
## 109      8.6455171  -5.095972494 22.387007 -12.37027767 29.661312
## 110      8.5396009  -6.225972380 23.305174 -14.04239474 31.121597
## 111      8.4336848  -7.389388750 24.256758 -15.76561791 32.632987
## 112      8.3277686  -8.584734897 25.240272 -17.53767346 34.193211
## 113      8.2218525  -9.810708388 26.254413 -19.35656949 35.800274
## 114      8.1159363 -11.066160042 27.298033 -21.22054848 37.452421
plot(data25.desforecast, col="blue", ylab = "Wind speed", xlab = "Day")

Forecast Accuracy Measure for \(\alpha = 0.25\) by using Holtwinters function
SSE25des= data25.des$SSE
MSE25des= SSE25des/length(train.DailyDelhiClimateTest.ts)
RMSE25des = sqrt(MSE25des)
AccuracyMeasur25des <- c(SSE25des, MSE25des, RMSE25des)
mod25des <- c("SSE", "MSE","RMSE")
compmodel25des <- cbind(mod25des, AccuracyMeasur25des)

Double exponential smoothing \(\alpha = 0.50\)

The second double exponential smoothing is done on the wind speed data using \(\alpha = 0.50\). Smoothing the data with \(\alpha = 0.50\) is done with the Holtwinters function.

Using Holtwinters function
data50.des <- HoltWinters(train.DailyDelhiClimateTest.ts, alpha=0.50, beta=0.50, gamma=FALSE)
str(data50.des)
## List of 9
##  $ fitted      : Time-Series [1:92, 1:3] from 3 to 94: 3.05 3.92 4.78 4.22 7.74 ...
##   ..- attr(*, "dimnames")=List of 2
##   .. ..$ : NULL
##   .. ..$ : chr [1:3] "xhat" "level" "trend"
##  $ x           : Time-Series [1:94] from 1 to 94: 2.74 2.89 4.02 4.54 3.3 ...
##  $ alpha       : num 0.5
##  $ beta        : num 0.5
##  $ gamma       : logi FALSE
##  $ coefficients: Named num [1:2] 10.36 1.17
##   ..- attr(*, "names")= chr [1:2] "a" "b"
##  $ seasonal    : chr "additive"
##  $ SSE         : num 1456
##  $ call        : language HoltWinters(x = train.DailyDelhiClimateTest.ts, alpha = 0.5, beta = 0.5,      gamma = FALSE)
##  - attr(*, "class")= chr "HoltWinters"
data50.des$SSE
## [1] 1455.5942
data50.des$fitted
## Time Series:
## Start = 3 
## End = 94 
## Frequency = 1 
##           xhat      level        trend
##  3  3.04541063  2.8944444  0.150966184
##  4  3.92481884  3.5310386  0.393780193
##  5  4.78373490  4.2349094  0.548825483
##  6  4.21975921  4.0418675  0.177891757
##  7  7.74419520  6.4507887  1.293406500
##  8 10.76070530  8.8929309  1.867774368
##  9  6.02045069  6.3553526 -0.334901957
## 10  6.07735357  6.2816539 -0.204300344
## 11  8.33587138  7.7192323  0.616639040
## 12 10.02977355  9.0540468  0.975726750
## 13  8.45290698  8.3280447  0.124862309
## 14  7.06455964  7.4441005 -0.379540906
## 15  5.34359900  6.1702798 -0.826680817
## 16  3.23204502  4.4870169 -1.254971872
## 17  7.33803938  6.8060225  0.532016872
## 18  8.39569338  7.6884641  0.707229249
## 19  7.32802760  7.2124300  0.115597569
## 20  9.70117590  8.8330614  0.868114480
## 21 11.71314530 10.4637458  1.249399453
## 22 14.44942491 12.7043987  1.745026173
## 23  9.75838240 10.1587125 -0.400330054
## 24  7.10397143  8.2556618 -1.151690360
## 25  3.16778076  5.2476379 -2.079857130
## 26  5.27908806  5.9618904 -0.682802320
## 27  6.98786255  6.8734726  0.114389951
## 28 12.63010559 10.6730979  1.957007647
## 29 12.38271586 11.1605073  1.222208522
## 30 12.03872082 11.3385802  0.700140668
## 31  6.95148754  8.1804715 -1.228983982
## 32  3.97763790  5.7882438 -1.810605867
## 33  3.00880361  4.5388190 -1.530015343
## 34  1.49264010  3.0180382 -1.525398063
## 35  0.23867105  1.6735928 -1.434921726
## 36  5.98974604  5.0293355  0.960410511
## 37  8.53284702  7.0448730  1.487974001
## 38 10.40451909  8.7886457  1.615873357
## 39  9.94512813  9.0210095  0.924118585
## 40  6.47040062  7.0125641 -0.542163448
## 41  6.98168671  7.1727003 -0.191013602
## 42  8.35440807  8.0241767  0.330231388
## 43  5.38133341  6.1522040 -0.770870631
## 44  1.79321272  3.5031667 -1.709953982
## 45  3.52168253  4.0854952 -0.563812718
## 46  5.53848291  5.2420913  0.296391649
## 47  5.84886952  5.5478129  0.301056635
## 48  9.59139901  8.1431848  1.448214255
## 49 10.80606401  9.4356995  1.370364501
## 50  8.75938050  8.5280320  0.231348499
## 51  6.96210272  7.4069630 -0.444860263
## 52  6.49879042  6.9498014 -0.451010942
## 53 10.42993666  9.4202285  1.009708121
## 54  9.17656729  8.9212183  0.255348955
## 55 13.31199078 11.7632836  1.548707134
## 56 17.37357983 14.9872454  2.386334440
## 57 15.67615797 14.6510756  1.025082340
## 58 13.27849683 13.3943290 -0.115832152
## 59  7.02879206  9.1892484 -2.160456360
## 60  2.53007499  5.4699516 -2.939876596
## 61  2.50418061  4.4727298 -1.968549189
## 62  3.10499596  4.2170903 -1.112094342
## 63  5.22352965  5.2587480 -0.035218333
## 64  7.53316408  6.7867648  0.746399255
## 65 10.10156527  8.7478320  1.353733235
## 66 11.12912455  9.8841160  1.245008583
## 67  8.54603972  8.5770623 -0.031022555
## 68  9.80321465  9.4048380  0.398376605
## 69  9.10632312  9.0730359  0.033287229
## 70 10.90674301 10.2844116  0.622331448
## 71  7.52401720  8.2367048 -0.712687638
## 72  6.89644166  7.5807586 -0.684316938
## 73  7.83146014  7.9759986 -0.144538465
## 74  5.20499324  6.1768412 -0.971847945
## 75  5.71065036  6.1899966 -0.479346255
## 76  5.11831634  5.6353252 -0.517008846
## 77  9.38007024  8.3041582  1.075912070
## 78  8.76323732  8.2515736  0.511663741
## 79  9.57330641  8.9621742  0.611132189
## 80 10.56279212  9.8255421  0.737250032
## 81 10.32482306  9.9126461  0.412177001
## 82 10.63400777 10.2561615  0.377846235
## 83  5.65197318  7.0607539 -1.408780706
## 84  7.52921259  7.8426533 -0.313440667
## 85  9.38761248  8.9771063  0.410506186
## 86 15.94990931 13.4888062  2.461103066
## 87 16.68608039 14.7999547  1.886125739
## 88 12.69097917 12.7652624 -0.074283248
## 89 12.99846155 12.9454896  0.052971960
## 90 11.24187306 11.7920879 -0.550214855
## 91  7.47275341  9.0959365 -1.623183120
## 92  7.02313023  8.2551267 -1.231996473
## 93  7.47066109  8.1428151 -0.672154031
## 94  6.39863624  7.2040805 -0.805444302
plot(data50.des, col="blue", ylab = "Wind speed", xlab = "Day")
points(train.DailyDelhiClimateTest.ts, pch = 20, col = "blue")
legend("topleft",c("Actual data","Smoothed data"), lty=8, col=c("blue","red"), cex=0.8)

data50.desforecast<-forecast(data50.des, h=20)
data50.desforecast
##     Point Forecast        Lo 80      Hi 80        Lo 95      Hi 95
##  95      11.534215   6.40904400  16.659386   3.69594249  19.372487
##  96      12.709111   6.30264795  19.115575   2.91127106  22.506952
##  97      13.884008   5.67973176  22.088284   1.33665025  26.431366
##  98      15.058905   4.64963366  25.468176  -0.86070155  30.978511
##  99      16.233801   3.29337947  29.174223  -3.55686605  36.024469
## 100      17.408698   1.66390979  33.153486  -6.67087759  41.488273
## 101      18.583595  -0.20384417  37.371033 -10.14931349  47.316503
## 102      19.758491  -2.28570171  41.802684 -13.95519255  53.472175
## 103      20.933388  -4.56401471  46.430790 -18.06152430  59.928300
## 104      22.108284  -7.02527970  51.241849 -22.44765699  66.664226
## 105      23.283181  -9.65875172  56.225114 -27.09715760  73.663520
## 106      24.458078 -12.45560656  61.371762 -31.99653067  80.912686
## 107      25.632974 -15.40841248  66.674361 -37.13441034  88.400359
## 108      26.807871 -18.51078298  72.126525 -42.50102928  96.116771
## 109      27.982768 -21.75713990  77.722675 -48.08785646 104.053392
## 110      29.157664 -25.14254629  83.457875 -53.88734144 112.202670
## 111      30.332561 -28.66258478  89.327707 -59.89272847 120.557850
## 112      31.507458 -32.31326690  95.328182 -66.09791767 129.112833
## 113      32.682354 -36.09096368 101.455672 -72.49735904 137.862068
## 114      33.857251 -39.99235161 107.706853 -79.08596970 146.800471
plot(data50.desforecast, col="blue", ylab = "Wind speed", xlab = "Day")

Forecast Accuracy Measure for \(\alpha = 0.50\) by using Holtwinters function
SSE50des= data50.des$SSE
MSE50des= SSE50des/length(train.DailyDelhiClimateTest.ts)
RMSE50des = sqrt(MSE50des)
AccuracyMeasur50des <- c(SSE50des, MSE50des, RMSE50des)
mod50des <- c("SSE", "MSE","RMSE")
compmodel50des <- cbind(mod50des, AccuracyMeasur50des)

Double exponential smoothing \(\alpha = 0.75\)

The third double exponential smoothing is done on the wind speed data using \(\alpha = 0.75\). Smoothing the data with \(\alpha = 0.75\) is done with the Holtwinters function.

Using Holtwinters function
data75.des <- HoltWinters(train.DailyDelhiClimateTest.ts, alpha=0.75, beta=0.75, gamma=FALSE)
str(data75.des)
## List of 9
##  $ fitted      : Time-Series [1:92, 1:3] from 3 to 94: 3.05 4.47 5.27 3.42 9.96 ...
##   ..- attr(*, "dimnames")=List of 2
##   .. ..$ : NULL
##   .. ..$ : chr [1:3] "xhat" "level" "trend"
##  $ x           : Time-Series [1:94] from 1 to 94: 2.74 2.89 4.02 4.54 3.3 ...
##  $ alpha       : num 0.75
##  $ beta        : num 0.75
##  $ gamma       : logi FALSE
##  $ coefficients: Named num [1:2] 12.41 3.43
##   ..- attr(*, "names")= chr [1:2] "a" "b"
##  $ seasonal    : chr "additive"
##  $ SSE         : num 1801
##  $ call        : language HoltWinters(x = train.DailyDelhiClimateTest.ts, alpha = 0.75, beta = 0.75,      gamma = FALSE)
##  - attr(*, "class")= chr "HoltWinters"
data75.des$SSE
## [1] 1800.8938
data75.des$fitted
## Time Series:
## Start = 3 
## End = 94 
## Frequency = 1 
##            xhat      level        trend
##  3  3.045410628  2.8944444  0.150966184
##  4  4.471150362  3.7738527  0.697297705
##  5  5.265375717  4.5265376  0.738838127
##  6  3.424658215  3.7913439 -0.366685714
##  7  9.957994957  7.3675282  2.590466767
##  8 12.658280843 10.0207487  2.637532104
##  9  1.241194340  4.6270702 -3.385875870
## 10  4.813750898  5.2174414 -0.403690544
## 11 10.378470634  8.2242711  2.154199576
## 12 11.736969169  9.9237843  1.813184844
## 13  6.842421453  7.9039791 -1.061557682
## 14  5.246509144  6.5370760 -1.290566808
## 15  3.994649085  5.2686273 -1.273978201
## 16  2.242639612  3.7214884 -1.478848746
## 17 11.444076375  8.3456599  3.098416472
## 18 10.073184272  8.8901858  1.182998511
## 19  5.948409676  7.0401711 -1.091761392
## 20 10.618110585  9.2406738  1.377436737
## 21 12.793816653 11.0742645  1.719552165
## 22 15.697027939 13.4701933  2.226834645
## 23  5.023263414  8.3252570 -3.301993570
## 24  3.991471907  6.3205217 -2.329049829
## 25  0.874702156  3.5413462 -2.666644081
## 26  8.552261495  6.7856755  1.766585956
## 27 10.208066739  8.4889582  1.719108508
## 28 17.374400152 13.3207667  4.053633467
## 29 11.343451602 11.6117819 -0.268330255
## 30  9.698299453 10.5566962 -0.858396780
## 31  1.783801307  5.6662415 -3.882440223
## 32  1.630434369  3.9147003 -2.284265958
## 33  3.899973302  4.2326086 -0.332635290
## 34  2.421918507  3.2454479 -0.823529364
## 35  0.853712012  1.9963887 -1.142676706
## 36 11.479288291  7.5784280  3.900860288
## 37 10.944832697  8.9448221  2.000010624
## 38 10.450583740  9.5195415  0.931042232
## 39  7.689453564  8.3407709 -0.651317371
## 40  2.300728390  4.9823634 -2.681635001
## 41  6.935324877  6.4814321  0.453892780
## 42 10.186603756  8.5338312  1.652772536
## 43  3.653833863  5.5091509 -1.855317076
## 44 -0.864327658  2.1322085 -2.996536124
## 45  5.644399603  4.5672514  1.077148184
## 46  8.451554558  6.6329749  1.818579657
## 47  6.471218858  6.2807458  0.190473076
## 48 11.867435933  9.4459297  2.421506218
## 49 10.892932489  9.9268590  0.966073506
## 50  5.765157103  7.4107331 -1.645576019
## 51  4.499403295  5.9821984 -1.482795071
## 52  6.216610149  6.3279758 -0.111365675
## 53 14.144381153 10.8104025  3.333978616
## 54  8.642765756  9.0954703 -0.452704533
## 55 15.680806169 12.9231914  2.757614730
## 56 19.726894052 16.4170765  3.309817510
## 57 12.801413119 13.8781521 -1.076738966
## 58  9.507975685 11.5347283 -2.026752595
## 59  1.695755004  6.2019939 -4.506238918
## 60  0.097170977  3.3572721 -3.260101107
## 61  5.129725270  4.8358312  0.293894064
## 62  6.473979917  5.7299313  0.744048600
## 63  8.449836126  7.1778700  1.271966146
## 64  9.590767357  8.3749590  1.215808326
## 65 11.294474777  9.8695668  1.424907937
## 66 10.582884570 10.0736187  0.509265875
## 67  5.109926947  7.1644711 -2.054544195
## 68  9.819626361  8.9752090  0.844417352
## 69  8.725784114  8.7120494  0.013734666
## 70 12.331458381 10.7783210  1.553137352
## 71  5.005806608  7.2578646 -2.252057987
## 72  6.207846198  6.9795767 -0.771730454
## 73  9.173734276  8.3436282  0.830106060
## 74  3.898730765  5.6851002 -1.786369471
## 75  6.412464665  6.3559327  0.056531974
## 76  5.350136766  5.7731162 -0.422979400
## 77 12.985727860  9.9550342  3.030693669
## 78  8.321692174  8.5887397 -0.267047483
## 79  9.156382046  8.9512564  0.205125669
## 80 10.570839613  9.8474288  0.723410768
## 81  9.577054639  9.5895849 -0.012530264
## 82 10.365733911 10.0348887  0.330845251
## 83  1.668897154  5.2070585 -3.538161324
## 84  9.109058316  7.9422243  1.166834027
## 85 12.003065803 10.0960146  1.907051225
## 86 21.242968161 16.1932665  5.049701710
## 87 16.326899160 15.5482420  0.778657120
## 88  7.284834465 10.7150581 -3.430223658
## 89 11.618265572 11.7212086 -0.102943045
## 90 10.160098964 10.8438521 -0.683753143
## 91  5.263090931  7.7525247 -2.489433810
## 92  7.727569024  8.0938977 -0.366328709
## 93  9.375837221  8.8787673  0.497069965
## 94  6.672589584  7.5470843 -0.874494722
plot(data75.des, col="blue", ylab = "Wind speed", xlab = "Day")
points(train.DailyDelhiClimateTest.ts, pch = 20, col = "blue")
legend("topleft",c("Actual data","Smoothed data"), lty=8, col=c("blue","red"), cex=0.8)

data75.desforecast<-forecast(data75.des, h=20)
data75.desforecast
##     Point Forecast       Lo 80      Hi 80         Lo 95      Hi 95
##  95      15.835321  10.1347944  21.535848    7.11711793  24.553524
##  96      19.262495   9.8563559  28.668633    4.87704676  33.647943
##  97      22.689668   8.4517187  36.927618    0.91460342  44.464733
##  98      26.116842   6.2223410  46.011343   -4.30917166  56.542856
##  99      29.544016   3.3093972  55.778634  -10.57837084  69.666402
## 100      32.971189  -0.2052359  66.147614  -17.76777448  83.710153
## 101      36.398363  -4.2663023  77.063028  -25.79287575  98.589601
## 102      39.825536  -8.8328493  88.483922  -34.59104284 114.242116
## 103      43.252710 -13.8726748 100.378095  -44.11302697 130.618447
## 104      46.679884 -19.3594391 112.719207  -54.31854493 147.678312
## 105      50.107057 -25.2709902 125.485105  -65.17371827 165.387833
## 106      53.534231 -31.5883110 138.656773  -76.64946288 183.717925
## 107      56.961405 -38.2948149 152.217624  -88.72041159 202.643221
## 108      60.388578 -45.3758512 166.153008 -101.36415812 222.141315
## 109      63.815752 -52.8183449 180.449849 -114.56070625 242.192210
## 110      67.242926 -60.6105268 195.096378 -128.29205621 262.777907
## 111      70.670099 -68.7417246 210.081923 -142.54188627 283.882085
## 112      74.097273 -77.2021999 225.396746 -157.29530269 305.489848
## 113      77.524447 -85.9830170 241.031910 -172.53863977 327.587533
## 114      80.951620 -95.0759374 256.979178 -188.25929765 350.162538
plot(data75.desforecast, col="blue", ylab = "Wind speed", xlab = "Day")

Forecast Accuracy Measure for \(\alpha = 0.75\) by using Holtwinters function
SSE75des= data75.des$SSE
MSE75des= SSE75des/length(train.DailyDelhiClimateTest.ts)
RMSE75des = sqrt(MSE75des)
AccuracyMeasur75des <- c(SSE75des, MSE75des, RMSE75des)
mod75des <- c("SSE", "MSE","RMSE")
compmodel75des <- cbind(mod75des, AccuracyMeasur75des)

Double exponential smoothing \(\alpha = optimum\)

The fourth double exponential smoothing is done on wind speed data using \(\alpha = optimum\). Smoothing data with \(\alpha = optimum\) will be done in two ways: the Holtwinters function and the holt function, which is automatically provided by the forecast package.

Using Holtwinters function
dataoptim.des <- HoltWinters(train.DailyDelhiClimateTest.ts, gamma = FALSE)
str(dataoptim.des)
## List of 9
##  $ fitted      : Time-Series [1:92, 1:3] from 3 to 94: 3.05 3.43 3.85 3.87 5.17 ...
##   ..- attr(*, "dimnames")=List of 2
##   .. ..$ : NULL
##   .. ..$ : chr [1:3] "xhat" "level" "trend"
##  $ x           : Time-Series [1:94] from 1 to 94: 2.74 2.89 4.02 4.54 3.3 ...
##  $ alpha       : Named num 0.24
##   ..- attr(*, "names")= chr "alpha"
##  $ beta        : Named num 0
##   ..- attr(*, "names")= chr "beta"
##  $ gamma       : logi FALSE
##  $ coefficients: Named num [1:2] 10.827 0.151
##   ..- attr(*, "names")= chr [1:2] "a" "b"
##  $ seasonal    : chr "additive"
##  $ SSE         : num 972
##  $ call        : language HoltWinters(x = train.DailyDelhiClimateTest.ts, gamma = FALSE)
##  - attr(*, "class")= chr "HoltWinters"
dataoptim.des$SSE
## [1] 972.13966
dataoptim.des$fitted
## Time Series:
## Start = 3 
## End = 94 
## Frequency = 1 
##          xhat      level      trend
##  3  3.0454106  2.8944444 0.15096618
##  4  3.4290280  3.2780619 0.15096618
##  5  3.8473102  3.6963440 0.15096618
##  6  3.8671756  3.7162095 0.15096618
##  7  5.1714243  5.0204581 0.15096618
##  8  6.4889911  6.3380249 0.15096618
##  9  5.5527034  5.4017372 0.15096618
## 10  5.9408475  5.7898813 0.15096618
## 11  6.9110915  6.7601254 0.15096618
## 12  7.7474028  7.5964367 0.15096618
## 13  7.6298278  7.4788616 0.15096618
## 14  7.4946596  7.3436934 0.15096618
## 15  7.1141759  6.9632097 0.15096618
## 16  6.4306591  6.2796929 0.15096618
## 17  7.5276364  7.3766702 0.15096618
## 18  7.8010662  7.6501000 0.15096618
## 19  7.5275978  7.3766317 0.15096618
## 20  8.3517806  8.2008144 0.15096618
## 21  9.1913028  9.0403366 0.15096618
## 22 10.4212249 10.2702587 0.15096618
## 23  9.4815277  9.3305615 0.15096618
## 24  8.9788979  8.8279317 0.15096618
## 25  7.7914317  7.6404655 0.15096618
## 26  8.1734472  8.0224810 0.15096618
## 27  8.3949353  8.2439691 0.15096618
## 28  9.9743527  9.8233866 0.15096618
## 29 10.0574238  9.9064576 0.15096618
## 30 10.2651651 10.1141989 0.15096618
## 31  8.9925798  8.8416136 0.15096618
## 32  8.0973513  7.9463852 0.15096618
## 33  7.5303426  7.3793764 0.15096618
## 34  6.6026593  6.4516932 0.15096618
## 35  5.6162791  5.4653129 0.15096618
## 36  6.7741897  6.6232235 0.15096618
## 37  7.2427358  7.0917696 0.15096618
## 38  7.8252769  7.6743107 0.15096618
## 39  7.9312637  7.7802975 0.15096618
## 40  7.1597118  7.0087456 0.15096618
## 41  7.4820156  7.3310494 0.15096618
## 42  8.0125635  7.8615973 0.15096618
## 43  7.1903976  7.0394314 0.15096618
## 44  6.0082481  5.8572819 0.15096618
## 45  6.2477301  6.0967639 0.15096618
## 46  6.5699098  6.4189436 0.15096618
## 47  6.4782813  6.3273152 0.15096618
## 48  7.5776248  7.4266586 0.15096618
## 49  8.1363719  7.9854057 0.15096618
## 50  7.8354832  7.6845170 0.15096618
## 51  7.5598499  7.4088837 0.15096618
## 52  7.5617406  7.4107744 0.15096618
## 53  8.8576733  8.7067072 0.15096618
## 54  8.6624678  8.5115016 0.15096618
## 55 10.1758053 10.0248392 0.15096618
## 56 11.8805714 11.7296052 0.15096618
## 57 12.0430354 11.8920692 0.15096618
## 58 11.9711044 11.8201382 0.15096618
## 59 10.4761905 10.3252243 0.15096618
## 60  9.0545808  8.9036146 0.15096618
## 61  8.5733633  8.4223971 0.15096618
## 62  8.0911476  7.9401814 0.15096618
## 63  8.0795529  7.9285867 0.15096618
## 64  8.2953010  8.1443348 0.15096618
## 65  8.8456222  8.6946560 0.15096618
## 66  9.1932584  9.0422923 0.15096618
## 67  8.5853112  8.4343450 0.15096618
## 68  9.1382975  8.9873313 0.15096618
## 69  9.0987267  8.9477605 0.15096618
## 70  9.8159028  9.6649366 0.15096618
## 71  8.9490220  8.7980558 0.15096618
## 72  8.7858308  8.6348646 0.15096618
## 73  9.0014059  8.8504397 0.15096618
## 74  8.0794443  7.9284781 0.15096618
## 75  8.0137631  7.8627969 0.15096618
## 76  7.5769635  7.4259973 0.15096618
## 77  8.6652446  8.5142784 0.15096618
## 78  8.4468054  8.2958392 0.15096618
## 79  8.7688739  8.6179077 0.15096618
## 80  9.2333703  9.0824041 0.15096618
## 81  9.3913141  9.2403479 0.15096618
## 82  9.7329958  9.5820296 0.15096618
## 83  8.3879380  8.2369718 0.15096618
## 84  8.9330364  8.7820702 0.15096618
## 85  9.4413823  9.2904161 0.15096618
## 86 11.5442395 11.3932733 0.15096618
## 87 12.1996121 12.0486459 0.15096618
## 88 11.5468933 11.3959271 0.15096618
## 89 12.0938388 11.9428726 0.15096618
## 90 11.8835542 11.7325880 0.15096618
## 91 10.8527542 10.7017881 0.15096618
## 92 10.5689008 10.4179347 0.15096618
## 93 10.4069364 10.2559702 0.15096618
## 94  9.7268461  9.5758799 0.15096618
plot(dataoptim.des, col="blue", ylab = "Wind speed", xlab = "Day")
points(train.DailyDelhiClimateTest.ts, pch = 20, col = "blue")
legend("topleft",c("Actual data","Smoothed data"), lty=8, col=c("blue","red"), cex=0.8)

dataoptim.desforecast<-forecast(dataoptim.des, h=20)
dataoptim.desforecast
##     Point Forecast     Lo 80     Hi 80     Lo 95     Hi 95
##  95      10.978040 6.8038397 15.152240 4.5941515 17.361929
##  96      11.129006 6.8367230 15.421290 4.5645255 17.693487
##  97      11.279972 6.8727691 15.687176 4.5397365 18.020208
##  98      11.430939 6.9117365 15.950141 4.5194154 18.342462
##  99      11.581905 6.9534132 16.210396 4.5032378 18.660572
## 100      11.732871 6.9976117 16.468130 4.4909168 18.974825
## 101      11.883837 7.0441649 16.723509 4.4821972 19.285477
## 102      12.034803 7.0929238 16.976683 4.4768508 19.592756
## 103      12.185770 7.1437541 17.227785 4.4746723 19.896867
## 104      12.336736 7.1965347 17.476937 4.4754766 20.197995
## 105      12.487702 7.2511560 17.724248 4.4790961 20.496308
## 106      12.638668 7.3075182 17.969818 4.4853779 20.791958
## 107      12.789634 7.3655301 18.213738 4.4941828 21.085086
## 108      12.940600 7.4251084 18.456093 4.5053833 21.375818
## 109      13.091567 7.4861765 18.696957 4.5188622 21.664271
## 110      13.242533 7.5486638 18.936402 4.5345115 21.950554
## 111      13.393499 7.6125050 19.174493 4.5522317 22.234766
## 112      13.544465 7.6776400 19.411290 4.5719303 22.517000
## 113      13.695431 7.7440127 19.646850 4.5935220 22.797341
## 114      13.846398 7.8115711 19.881224 4.6169269 23.075868
plot(dataoptim.desforecast, col="blue", ylab = "Wind speed", xlab = "Day")

Forecast Accuracy Measure for \(\alpha = optimum\) by using Holtwinters function
SSEoptimdes= dataoptim.des$SSE
MSEoptimdes= SSEoptimdes/length(train.DailyDelhiClimateTest.ts)
RMSEoptimdes = sqrt(MSEoptimdes)
AccuracyMeasuroptimdes <- c(SSEoptimdes, MSEoptimdes, RMSEoptimdes)
modoptimdes <- c("SSE", "MSE","RMSE")
compmodeloptimdes <- cbind(modoptimdes, AccuracyMeasuroptimdes)
Using holt function
dataoptimdes <- holt(train.DailyDelhiClimateTest.ts, h=20)
summary(dataoptimdes)
## 
## Forecast method: Holt's method
## 
## Model Information:
## Holt's method 
## 
## Call:
##  holt(y = train.DailyDelhiClimateTest.ts, h = 20) 
## 
##   Smoothing parameters:
##     alpha = 1e-04 
##     beta  = 1e-04 
## 
##   Initial states:
##     l = 5.8621 
##     b = 0.0433 
## 
##   sigma:  3.1595
## 
##       AIC      AICc       BIC 
## 649.25755 649.93937 661.97402 
## 
## Error measures:
##                       ME      RMSE       MAE        MPE      MAPE       MASE
## Training set 0.034028969 3.0915072 2.4811744 -21.817496 43.413134 0.84731071
##                    ACF1
## Training set 0.28787888
## 
## Forecasts:
##     Point Forecast     Lo 80     Hi 80     Lo 95     Hi 95
##  95      10.003685 5.9546739 14.052697 3.8112566 16.196114
##  96      10.047330 5.9983184 14.096342 3.8549011 16.239759
##  97      10.090975 6.0419628 14.139986 3.8985454 16.283404
##  98      10.134619 6.0856070 14.183631 3.9421895 16.327049
##  99      10.178264 6.1292511 14.227276 3.9858333 16.370694
## 100      10.221908 6.1728950 14.270922 4.0294768 16.414340
## 101      10.265553 6.2165386 14.314567 4.0731198 16.457986
## 102      10.309197 6.2601818 14.358213 4.1167624 16.501633
## 103      10.352842 6.3038248 14.401859 4.1604045 16.545280
## 104      10.396487 6.3474674 14.445506 4.2040460 16.588927
## 105      10.440131 6.3911095 14.489153 4.2476868 16.632576
## 106      10.483776 6.4347512 14.532801 4.2913270 16.676225
## 107      10.527420 6.4783923 14.576449 4.3349663 16.719875
## 108      10.571065 6.5220329 14.620097 4.3786048 16.763525
## 109      10.614710 6.5656730 14.663746 4.4222424 16.807177
## 110      10.658354 6.6093124 14.707396 4.4658791 16.850829
## 111      10.701999 6.6529511 14.751046 4.5095147 16.894483
## 112      10.745643 6.6965891 14.794698 4.5531493 16.938137
## 113      10.789288 6.7402264 14.838349 4.5967827 16.981793
## 114      10.832933 6.7838629 14.882002 4.6404149 17.025450
plot(dataoptimdes, col="blue", ylab = "Wind speed", xlab = "Day")
points(train.DailyDelhiClimateTest.ts, pch = 20, col = "blue")

accuracy(dataoptimdes, test.DailyDelhiClimateTest.ts)
##                        ME      RMSE       MAE        MPE      MAPE       MASE
## Training set  0.034028969 3.0915072 2.4811744 -21.817496 43.413134 0.84731071
## Test set     -1.442048425 4.8696321 4.1942133 -76.375978 93.995096 1.43230634
##                    ACF1 Theil's U
## Training set 0.28787888        NA
## Test set     0.58643017 1.1983193

Best Model in Double exponential smoothing by using HoltWinters function

AccuracyMeasurDES <- cbind(AccuracyMeasur25des, AccuracyMeasur50des, AccuracyMeasur75des, AccuracyMeasuroptimdes)
modDES <- c("SSE", "MSE", "RMSE")
compmodelALLDES <- cbind(modDES, AccuracyMeasurDES)
colnames(compmodelALLDES) <- c("Accuracy Measure DES", "HW 0.25", "HW 0.5", "HW 0.75", "HW Optimum")
compmodelAllDES <- as.data.frame(cbind(compmodelALLDES))
compmodelAllDES
##   Accuracy Measure DES          HW 0.25           HW 0.5          HW 0.75
## 1                  SSE 1147.25363550708 1455.59416330361  1800.8938111289
## 2                  MSE 12.2048259096498 15.4850442904639 19.1584447992437
## 3                 RMSE 3.49354059796788 3.93510410160442 4.37703607470211
##         HW Optimum
## 1 972.139656249297
## 2 10.3419112366946
## 3 3.21588420760055

Best Model of Exponential smoothing

#### Best Model in Simple exponential smoothing by using HoltWinters function
AccuracyMeasurSES <- cbind(AccuracyMeasur25hw, AccuracyMeasur50hw, AccuracyMeasur75hw, AccuracyMeasuroptimumhw)
modSES <- c("SSE SES", "MSE SES", "RMSE SES")
compmodelALLSES <- cbind(modSES, AccuracyMeasurSES)

AccuracyMeasurDES <- cbind(AccuracyMeasur25des, AccuracyMeasur50des, AccuracyMeasur75des, AccuracyMeasuroptimdes)
modDES <- c("SSE DES", "MSE DES", "RMSE DES")
compmodelALLDES <- cbind(modDES, AccuracyMeasurDES)

commodelALLHW <- as.data.frame(rbind(compmodelALLSES, compmodelALLDES))

colnames(commodelALLHW) <- c("Accuracy Measure HW", "HW 0.25", "HW 0.5", "HW 0.75", "HW Optimum")
compmodelAllHW <- as.data.frame(commodelALLHW)
compmodelAllHW
##   Accuracy Measure HW          HW 0.25           HW 0.5          HW 0.75
## 1             SSE SES 972.510325275922 1006.79598674294 1087.26910678528
## 2             MSE SES 10.3458545242119 10.7105956036483 11.5666926253754
## 3            RMSE SES 3.21649724455221 3.27270463128714 3.40098406720399
## 4             SSE DES 1147.25363550708 1455.59416330361  1800.8938111289
## 5             MSE DES 12.2048259096498 15.4850442904639 19.1584447992437
## 6            RMSE DES 3.49354059796788 3.93510410160442 4.37703607470211
##         HW Optimum
## 1 972.157203512489
## 2 10.3420979097073
## 3 3.21591323106009
## 4 972.139656249297
## 5 10.3419112366946
## 6 3.21588420760055
Accuracy Measure HW HW \(\alpha\) 0.25 HW \(\alpha\) 0.5 HW \(\alpha\) 0.75 HW \(\alpha\) optimum
SSE SES 972.5103252 1006.795986 1087.269106 972.1572035
MSE SES 10.34585452 10.71059560 11.56669262 10.34209790
RMSE SES 3.216497244 3.272704631 3.400984067 3.215913231
SSE DES 1147.253635 1455.594163 1800.89381 972.1396562
MSE DES 12.20482590 15.48504429 19.15844479 10.34191123
RMSE DES 3.493540597 3.935104101 4.377036074 3.215884207

Based on the accuracy values of the single exponential smoothing and double exponential smoothing models with the HoltWinters function with daily Delhi climate data with the selected variable, namely wind speed , the best model obtained is the double exponential smoothing model with \(\alpha\) optimum (0.0001 ) and \(\beta\) optimum (0.0001). This model has SSE, MSE, and RMSE values compared to others. The best model results obtained with this train data will be tested on data testing.

Testing best smoothing for testing set

Using Holtwinters function

datatestoptim.des <- HoltWinters(test.DailyDelhiClimateTest.ts, alpha = 0.0001, beta = 0.0001, gamma = FALSE)
str(datatestoptim.des)
## List of 9
##  $ fitted      : Time-Series [1:19, 1:3] from 96 to 114: 14.4 14.5 14.6 14.6 14.7 ...
##   ..- attr(*, "dimnames")=List of 2
##   .. ..$ : NULL
##   .. ..$ : chr [1:3] "xhat" "level" "trend"
##  $ x           : Time-Series [1:21] from 94 to 114: 14.32 14.38 13.58 4.65 8.34 ...
##  $ alpha       : num 1e-04
##  $ beta        : num 1e-04
##  $ gamma       : logi FALSE
##  $ coefficients: Named num [1:2] 15.6003 0.0646
##   ..- attr(*, "names")= chr [1:2] "a" "b"
##  $ seasonal    : chr "additive"
##  $ SSE         : num 1165
##  $ call        : language HoltWinters(x = test.DailyDelhiClimateTest.ts, alpha = 1e-04, beta = 1e-04,      gamma = FALSE)
##  - attr(*, "class")= chr "HoltWinters"
datatestoptim.des$SSE
## [1] 1164.9709
datatestoptim.des$fitted
## Time Series:
## Start = 96 
## End = 114 
## Frequency = 1 
##          xhat     level       trend
##  96 14.449231 14.384615 0.064615385
##  97 14.513759 14.449144 0.064615376
##  98 14.577388 14.512773 0.064615277
##  99 14.641379 14.576764 0.064615215
## 100 14.705943 14.641327 0.064615210
## 101 14.771019 14.706404 0.064615256
## 102 14.835708 14.771093 0.064615263
## 103 14.899789 14.835173 0.064615210
## 104 14.963408 14.898793 0.064615110
## 105 15.026666 14.962051 0.064614974
## 106 15.090374 15.025760 0.064614884
## 107 15.153690 15.089075 0.064614754
## 108 15.217326 15.152711 0.064614656
## 109 15.281200 15.216585 0.064614582
## 110 15.345189 15.280574 0.064614519
## 111 15.408825 15.344211 0.064614422
## 112 15.472595 15.407980 0.064614337
## 113 15.536551 15.471937 0.064614271
## 114 15.600608 15.535993 0.064614216
plot(datatestoptim.des, col="blue", ylab = "Wind speed", xlab = "Day")
points(test.DailyDelhiClimateTest.ts, pch = 20, col = "blue")
legend("topleft",c("Actual data","Smoothed data"), lty=8, col=c("blue","red"), cex=0.8)

datatestoptim.desforecast<-forecast(datatestoptim.des, h=20)
datatestoptim.desforecast
##     Point Forecast      Lo 80     Hi 80     Lo 95     Hi 95
## 115      15.664877  9.6036218 21.726133 6.3949869 24.934768
## 116      15.729492  9.6682360 21.790747 6.4596010 24.999382
## 117      15.794106  9.7328501 21.855362 6.5242152 25.063997
## 118      15.858720  9.7974643 21.919976 6.5888293 25.128611
## 119      15.923334  9.8620784 21.984590 6.6534434 25.193225
## 120      15.987948  9.9266926 22.049204 6.7180576 25.257839
## 121      16.052563  9.9913067 22.113818 6.7826717 25.322453
## 122      16.117177 10.0559209 22.178433 6.8472858 25.387068
## 123      16.181791 10.1205350 22.243047 6.9119000 25.451682
## 124      16.246405 10.1851492 22.307661 6.9765141 25.516296
## 125      16.311019 10.2497633 22.372275 7.0411282 25.580910
## 126      16.375633 10.3143775 22.436889 7.1057424 25.645525
## 127      16.440248 10.3789916 22.501504 7.1703565 25.710139
## 128      16.504862 10.4436058 22.566118 7.2349706 25.774753
## 129      16.569476 10.5082199 22.630732 7.2995848 25.839367
## 130      16.634090 10.5728341 22.695346 7.3641989 25.903981
## 131      16.698704 10.6374482 22.759961 7.4288130 25.968596
## 132      16.763319 10.7020624 22.824575 7.4934272 26.033210
## 133      16.827933 10.7666765 22.889189 7.5580413 26.097824
## 134      16.892547 10.8312907 22.953803 7.6226555 26.162438
plot(datatestoptim.desforecast, col="blue", ylab = "Wind speed", xlab = "Day")

Forecast Accuracy Measure for \(\alpha = optimum\) by using Holtwinters function

SSEtestoptimdes= datatestoptim.des$SSE
MSEtestoptimdes= SSEtestoptimdes/length(train.DailyDelhiClimateTest.ts)
RMSEtestoptimdes = sqrt(MSEtestoptimdes)
AccuracyMeasurtestoptimdes <- c(SSEtestoptimdes, MSEtestoptimdes, RMSEtestoptimdes)
modtestoptimdes <- c("SSE", "MSE","RMSE")
compmodeltestoptimdes <- cbind(modtestoptimdes, AccuracyMeasurtestoptimdes)

Best Model between simple moving average and exponential smoothing

Based on the results of smoothing with the simple moving average method that has been carried out on the task of practicum 2 or can be seen in Smoothing Moving Average, it is obtained that the best smoothing is the simple moving average with a range of N=2 because it has a high forecasting accuracy than other ranges. The simple moving average model with a range of N=2 is compared with the best exponential smoothing model obtained, namely double exponential smoothing with \(\alpha\) optimum (0.0001) and \(\beta\) optimum (0.0001). These two models were chosen based on the smallest MSE value, namely 10.34191123 for the double exponential smoothing model and 12.256418788 for the simple moving average model. So, from the simple moving average, simple exponential smoothing, and double exponential smoothing models, the best model obtained for daily Delhi climate data with the selected variable, namely wind speed, is the double exponential smoothing model with \(\alpha\) optimum (0.0001) and \(\beta\) optimum (0.0001).

Conclusion

  1. The best model obtained by the exponential smoothing method is the double exponential smoothing model with \(\alpha\) optimum (0.0001) and \(\beta\) optimum (0.0001).

  2. The best model obtained from the simple moving average, simple exponential smoothing, and double exponential smoothing methods is double exponential smoothing with \(\alpha\) optimum (0.0001) and \(\beta\) optimum (0.0001).

  3. The best model obtained is selected based on the model that has the most outstanding accuracy value.

Reference

  1. Rácz A, Bajusz D, Héberger K. Effect of Dataset Size and Train/Test Split Ratios in QSAR/QSPR Multiclass Classification. Molecules. 2021; 26(4):1111. https://doi.org/10.3390/molecules26041111

  2. Montgomery, D. C., Jennings, C. L., & Kulahci, M. (2015). Introduction to time series analysis and forecasting. John Wiley & Sons.

  3. Yonar, H., Yonar, A., Tekindal, M. A., & Tekindal, M. (2020). Modeling and Forecasting for the number of cases of the COVID-19 pandemic with the Curve Estimation Models, the Box-Jenkins and Exponential Smoothing Methods. EJMO, 4(2), 160-165. https://doi.org/10.14744/ejmo.2020.28273