library(fpp2)
## Loading required package: ggplot2
## Loading required package: forecast
## Loading required package: fma
## Loading required package: expsmooth
library(readxl)
library(corrplot)
## corrplot 0.84 loaded
library(seasonal)
Train_Features <- read_excel("~/Predictive Analytics/Final/Train_Features.xlsx", col_types = c("text", "numeric", "numeric", "date", "numeric", "numeric", "numeric", "numeric", "numeric", "numeric"))
View(Train_Features)
#Separate cities
train_features_sj = Train_Features[Train_Features$city == 'sj',]
View(train_features_sj)
train_features_iq = Train_Features[Train_Features$city == 'iq',]
View(train_features_iq)
plot(train_features_sj$week_start_date,train_features_sj$Cases, type = 'l')

plot(train_features_iq$week_start_date,train_features_iq$Cases, type = 'l')

train_features_sj$city <- NULL
train_features_iq$city <- NULL
mycorSJdata = train_features_sj
mycorSJdata$week_start_date <- NULL 
mycorIQdata = train_features_iq
mycorIQdata$week_start_date <- NULL
mycorSJ <- cor(mycorSJdata)
mycorIQ <- cor(mycorIQdata)
corrplot(mycorSJ)

corrplot(mycorIQ)

cases_sj_ts = ts(train_features_sj$Cases, frequency = 52)
plot(cases_sj_ts)

##Arima
cases_ARIMA_sj = auto.arima(cases_sj_ts)
cases_ARIMA_sj_Fcast = forecast(cases_ARIMA_sj, h = 260)
autoplot(cases_ARIMA_sj_Fcast)

summary(cases_ARIMA_sj_Fcast)
## 
## Forecast method: ARIMA(1,1,1)
## 
## Model Information:
## Series: cases_sj_ts 
## ARIMA(1,1,1) 
## 
## Coefficients:
##          ar1      ma1
##       0.7159  -0.5981
## s.e.  0.0921   0.1048
## 
## sigma^2 estimated as 181.6:  log likelihood=-3745.45
## AIC=7496.9   AICc=7496.93   BIC=7511.41
## 
## Error measures:
##                       ME     RMSE      MAE MPE MAPE      MASE         ACF1
## Training set 0.001472294 13.45331 8.070728 NaN  Inf 0.2205363 0.0007786849
## 
## Forecasts:
##          Point Forecast      Lo 80     Hi 80      Lo 95     Hi 95
## 18.94231       5.278997  -11.98990  22.54790  -21.13150  31.68950
## 18.96154       5.478722  -20.42178  31.37922  -34.13267  45.09012
## 18.98077       5.621698  -27.57176  38.81516  -45.14332  56.38671
## 19.00000       5.724049  -33.98931  45.43741  -55.01230  66.46040
## 19.01923       5.797319  -39.87104  51.46568  -64.04641  75.64104
## 19.03846       5.849771  -45.32080  57.02034  -72.40886  84.10841
## 19.05769       5.887319  -50.40709  62.18172  -80.20754  91.98218
## 19.07692       5.914198  -55.18095  67.00935  -87.52277  99.35117
## 19.09615       5.933440  -59.68302  71.54990  -94.41828 106.28516
## 19.11538       5.947215  -63.94670  75.84113 -100.94630 112.84073
## 19.13462       5.957076  -67.99997  79.91412 -107.15047 119.06462
## 19.15385       5.964135  -71.86653  83.79480 -113.06760 124.99587
## 19.17308       5.969188  -75.56657  87.50494 -118.72899 130.66737
## 19.19231       5.972806  -79.11737  91.06298 -124.16139 136.10700
## 19.21154       5.975395  -82.53383  94.48462 -129.38778 141.33857
## 19.23077       5.977249  -85.82878  97.78328 -134.42795 146.38245
## 19.25000       5.978576  -89.01337 100.97052 -139.29907 151.25622
## 19.26923       5.979526  -92.09731 104.05636 -144.01605 155.97510
## 19.28846       5.980206  -95.08908 107.04949 -148.59192 160.55234
## 19.30769       5.980693  -97.99611 109.95750 -153.03811 164.99950
## 19.32692       5.981042 -100.82498 112.78706 -157.36467 169.32675
## 19.34615       5.981291 -103.58147 115.54406 -161.58050 173.54308
## 19.36538       5.981470 -106.27076 118.23369 -165.69349 177.65643
## 19.38462       5.981598 -108.89742 120.86061 -169.71070 181.67389
## 19.40385       5.981689 -111.46558 123.42895 -173.63840 185.60178
## 19.42308       5.981755 -113.97892 125.94243 -177.48227 189.44578
## 19.44231       5.981802 -116.44079 128.40440 -181.24740 193.21101
## 19.46154       5.981835 -118.85420 130.81787 -184.93841 196.90208
## 19.48077       5.981859 -121.22189 133.18560 -188.55948 200.52320
## 19.50000       5.981876 -123.54634 135.51009 -192.11443 204.07818
## 19.51923       5.981889 -125.82983 137.79361 -195.60674 207.57051
## 19.53846       5.981898 -128.07445 140.03824 -199.03959 211.00339
## 19.55769       5.981904 -130.28211 142.24592 -202.41593 214.37974
## 19.57692       5.981908 -132.45459 144.41841 -205.73844 217.70226
## 19.59615       5.981912 -134.59350 146.55732 -209.00963 220.97345
## 19.61538       5.981914 -136.70035 148.66418 -212.23178 224.19561
## 19.63462       5.981916 -138.77655 150.74038 -215.40706 227.37089
## 19.65385       5.981917 -140.82339 152.78723 -218.53743 230.50126
## 19.67308       5.981918 -142.84209 154.80592 -221.62476 233.58859
## 19.69231       5.981918 -144.83377 156.79760 -224.67077 236.63460
## 19.71154       5.981919 -146.79948 158.76332 -227.67707 239.64091
## 19.73077       5.981919 -148.74023 160.70406 -230.64518 242.60902
## 19.75000       5.981919 -150.65693 162.62077 -233.57653 245.54036
## 19.76923       5.981919 -152.55046 164.51430 -236.47243 248.43627
## 19.78846       5.981919 -154.42164 166.38548 -239.33415 251.29799
## 19.80769       5.981920 -156.27124 168.23508 -242.16287 254.12671
## 19.82692       5.981920 -158.09999 170.06383 -244.95971 256.92355
## 19.84615       5.981920 -159.90859 171.87243 -247.72572 259.68956
## 19.86538       5.981920 -161.69768 173.66152 -250.46189 262.42573
## 19.88462       5.981920 -163.46788 175.43172 -253.16918 265.13302
## 19.90385       5.981920 -165.21977 177.18361 -255.84848 267.81232
## 19.92308       5.981920 -166.95393 178.91777 -258.50063 270.46447
## 19.94231       5.981920 -168.67086 180.63470 -261.12646 273.09029
## 19.96154       5.981920 -170.37108 182.33492 -263.72671 275.69055
## 19.98077       5.981920 -172.05506 184.01890 -266.30214 278.26598
## 20.00000       5.981920 -173.72326 185.68710 -268.85344 280.81728
## 20.01923       5.981920 -175.37612 187.33996 -271.38127 283.34511
## 20.03846       5.981920 -177.01405 188.97789 -273.88627 285.85011
## 20.05769       5.981920 -178.63745 190.60129 -276.36904 288.33288
## 20.07692       5.981920 -180.24670 192.21054 -278.83018 290.79402
## 20.09615       5.981920 -181.84216 193.80600 -281.27022 293.23406
## 20.11538       5.981920 -183.42418 195.38802 -283.68972 295.65356
## 20.13462       5.981920 -184.99310 196.95694 -286.08917 298.05301
## 20.15385       5.981920 -186.54923 198.51307 -288.46907 300.43291
## 20.17308       5.981920 -188.09289 200.05673 -290.82989 302.79373
## 20.19231       5.981920 -189.62436 201.58820 -293.17207 305.13591
## 20.21154       5.981920 -191.14394 203.10778 -295.49607 307.45990
## 20.23077       5.981920 -192.65189 204.61573 -297.80228 309.76612
## 20.25000       5.981920 -194.14848 206.11232 -300.09112 312.05495
## 20.26923       5.981920 -195.63396 207.59780 -302.36296 314.32680
## 20.28846       5.981920 -197.10858 209.07242 -304.61819 316.58203
## 20.30769       5.981920 -198.57256 210.53640 -306.85717 318.82101
## 20.32692       5.981920 -200.02615 211.98999 -309.08023 321.04407
## 20.34615       5.981920 -201.46954 213.43338 -311.28771 323.25155
## 20.36538       5.981920 -202.90297 214.86681 -313.47995 325.44379
## 20.38462       5.981920 -204.32662 216.29046 -315.65724 327.62108
## 20.40385       5.981920 -205.74070 217.70454 -317.81989 329.78373
## 20.42308       5.981920 -207.14540 219.10924 -319.96819 331.93203
## 20.44231       5.981920 -208.54090 220.50474 -322.10243 334.06627
## 20.46154       5.981920 -209.92739 221.89123 -324.22287 336.18671
## 20.48077       5.981920 -211.30502 223.26886 -326.32978 338.29362
## 20.50000       5.981920 -212.67398 224.63782 -328.42342 340.38726
## 20.51923       5.981920 -214.03442 225.99826 -330.50403 342.46787
## 20.53846       5.981920 -215.38649 227.35033 -332.57185 344.53569
## 20.55769       5.981920 -216.73036 228.69420 -334.62713 346.59096
## 20.57692       5.981920 -218.06617 230.03001 -336.67007 348.63391
## 20.59615       5.981920 -219.39406 231.35790 -338.70090 350.66474
## 20.61538       5.981920 -220.71418 232.67802 -340.71984 352.68368
## 20.63462       5.981920 -222.02665 233.99049 -342.72709 354.69093
## 20.65385       5.981920 -223.33161 235.29545 -344.72286 356.68670
## 20.67308       5.981920 -224.62918 236.59302 -346.70733 358.67117
## 20.69231       5.981920 -225.91950 237.88334 -348.68069 360.64453
## 20.71154       5.981920 -227.20267 239.16651 -350.64314 362.60698
## 20.73077       5.981920 -228.47882 240.44266 -352.59484 364.55868
## 20.75000       5.981920 -229.74807 241.71191 -354.53598 366.49982
## 20.76923       5.981920 -231.01051 242.97435 -356.46673 368.43057
## 20.78846       5.981920 -232.26627 244.23011 -358.38724 370.35108
## 20.80769       5.981920 -233.51544 245.47928 -360.29769 372.26153
## 20.82692       5.981920 -234.75813 246.72197 -362.19822 374.16206
## 20.84615       5.981920 -235.99444 247.95828 -364.08899 376.05283
## 20.86538       5.981920 -237.22446 249.18830 -365.97015 377.93399
## 20.88462       5.981920 -238.44830 250.41214 -367.84184 379.80568
## 20.90385       5.981920 -239.66604 251.62988 -369.70421 381.66805
## 20.92308       5.981920 -240.87777 252.84161 -371.55739 383.52123
## 20.94231       5.981920 -242.08358 254.04742 -373.40152 385.36536
## 20.96154       5.981920 -243.28356 255.24740 -375.23673 387.20057
## 20.98077       5.981920 -244.47779 256.44163 -377.06315 389.02699
## 21.00000       5.981920 -245.66635 257.63019 -378.88090 390.84473
## 21.01923       5.981920 -246.84932 258.81316 -380.69010 392.65394
## 21.03846       5.981920 -248.02679 259.99063 -382.49088 394.45472
## 21.05769       5.981920 -249.19882 261.16266 -384.28335 396.24719
## 21.07692       5.981920 -250.36550 262.32933 -386.06762 398.03146
## 21.09615       5.981920 -251.52688 263.49072 -387.84381 399.80765
## 21.11538       5.981920 -252.68306 264.64690 -389.61202 401.57586
## 21.13462       5.981920 -253.83409 265.79793 -391.37237 403.33621
## 21.15385       5.981920 -254.98004 266.94388 -393.12495 405.08879
## 21.17308       5.981920 -256.12098 268.08482 -394.86987 406.83371
## 21.19231       5.981920 -257.25698 269.22082 -396.60723 408.57107
## 21.21154       5.981920 -258.38809 270.35193 -398.33712 410.30096
## 21.23077       5.981920 -259.51439 271.47823 -400.05964 412.02348
## 21.25000       5.981920 -260.63593 272.59977 -401.77489 413.73873
## 21.26923       5.981920 -261.75277 273.71661 -403.48295 415.44679
## 21.28846       5.981920 -262.86497 274.82881 -405.18391 417.14775
## 21.30769       5.981920 -263.97259 275.93643 -406.87787 418.84171
## 21.32692       5.981920 -265.07568 277.03952 -408.56490 420.52874
## 21.34615       5.981920 -266.17430 278.13814 -410.24510 422.20894
## 21.36538       5.981920 -267.26851 279.23234 -411.91854 423.88238
## 21.38462       5.981920 -268.35835 280.32219 -413.58531 425.54915
## 21.40385       5.981920 -269.44387 281.40771 -415.24548 427.20932
## 21.42308       5.981920 -270.52514 282.48898 -416.89914 428.86298
## 21.44231       5.981920 -271.60219 283.56603 -418.54635 430.51019
## 21.46154       5.981920 -272.67509 284.63893 -420.18720 432.15103
## 21.48077       5.981920 -273.74386 285.70770 -421.82175 433.78559
## 21.50000       5.981920 -274.80857 286.77241 -423.45008 435.41392
## 21.51923       5.981920 -275.86926 287.83310 -425.07226 437.03610
## 21.53846       5.981920 -276.92597 288.88981 -426.68836 438.65220
## 21.55769       5.981920 -277.97875 289.94259 -428.29844 440.26228
## 21.57692       5.981920 -279.02763 290.99147 -429.90258 441.86642
## 21.59615       5.981920 -280.07268 292.03652 -431.50083 443.46467
## 21.61538       5.981920 -281.11392 293.07776 -433.09327 445.05711
## 21.63462       5.981920 -282.15139 294.11523 -434.67995 446.64379
## 21.65385       5.981920 -283.18515 295.14899 -436.26095 448.22478
## 21.67308       5.981920 -284.21522 296.17906 -437.83630 449.80014
## 21.69231       5.981920 -285.24165 297.20549 -439.40609 451.36993
## 21.71154       5.981920 -286.26447 298.22831 -440.97036 452.93420
## 21.73077       5.981920 -287.28372 299.24756 -442.52918 454.49302
## 21.75000       5.981920 -288.29945 300.26329 -444.08260 456.04644
## 21.76923       5.981920 -289.31168 301.27552 -445.63067 457.59451
## 21.78846       5.981920 -290.32046 302.28430 -447.17346 459.13730
## 21.80769       5.981920 -291.32581 303.28965 -448.71101 460.67485
## 21.82692       5.981920 -292.32777 304.29161 -450.24338 462.20722
## 21.84615       5.981920 -293.32638 305.29022 -451.77062 463.73446
## 21.86538       5.981920 -294.32167 306.28551 -453.29278 465.25662
## 21.88462       5.981920 -295.31367 307.27751 -454.80992 466.77376
## 21.90385       5.981920 -296.30241 308.26625 -456.32207 468.28591
## 21.92308       5.981920 -297.28793 309.25177 -457.82930 469.79313
## 21.94231       5.981920 -298.27026 310.23410 -459.33164 471.29548
## 21.96154       5.981920 -299.24943 311.21327 -460.82915 472.79298
## 21.98077       5.981920 -300.22547 312.18931 -462.32186 474.28570
## 22.00000       5.981920 -301.19840 313.16224 -463.80984 475.77368
## 22.01923       5.981920 -302.16826 314.13210 -465.29312 477.25696
## 22.03846       5.981920 -303.13508 315.09892 -466.77174 478.73558
## 22.05769       5.981920 -304.09889 316.06273 -468.24576 480.20960
## 22.07692       5.981920 -305.05971 317.02355 -469.71520 481.67904
## 22.09615       5.981920 -306.01757 317.98141 -471.18012 483.14396
## 22.11538       5.981920 -306.97250 318.93634 -472.64056 484.60440
## 22.13462       5.981920 -307.92452 319.88836 -474.09656 486.06040
## 22.15385       5.981920 -308.87367 320.83751 -475.54815 487.51199
## 22.17308       5.981920 -309.81996 321.78380 -476.99538 488.95922
## 22.19231       5.981920 -310.76343 322.72727 -478.43828 490.40212
## 22.21154       5.981920 -311.70409 323.66793 -479.87691 491.84075
## 22.23077       5.981920 -312.64198 324.60582 -481.31128 493.27512
## 22.25000       5.981920 -313.57711 325.54095 -482.74144 494.70528
## 22.26923       5.981920 -314.50952 326.47336 -484.16743 496.13127
## 22.28846       5.981920 -315.43922 327.40306 -485.58929 497.55313
## 22.30769       5.981920 -316.36624 328.33008 -487.00704 498.97088
## 22.32692       5.981920 -317.29060 329.25444 -488.42073 500.38457
## 22.34615       5.981920 -318.21232 330.17616 -489.83039 501.79423
## 22.36538       5.981920 -319.13143 331.09527 -491.23605 503.19989
## 22.38462       5.981920 -320.04796 332.01180 -492.63775 504.60159
## 22.40385       5.981920 -320.96191 332.92575 -494.03552 505.99935
## 22.42308       5.981920 -321.87331 333.83715 -495.42939 507.39323
## 22.44231       5.981920 -322.78219 334.74603 -496.81940 508.78323
## 22.46154       5.981920 -323.68856 335.65240 -498.20557 510.16941
## 22.48077       5.981920 -324.59245 336.55629 -499.58795 511.55179
## 22.50000       5.981920 -325.49387 337.45771 -500.96655 512.93039
## 22.51923       5.981920 -326.39285 338.35669 -502.34142 514.30526
## 22.53846       5.981920 -327.28940 339.25324 -503.71258 515.67642
## 22.55769       5.981920 -328.18355 340.14739 -505.08006 517.04390
## 22.57692       5.981920 -329.07531 341.03915 -506.44389 518.40773
## 22.59615       5.981920 -329.96470 341.92854 -507.80410 519.76794
## 22.61538       5.981920 -330.85175 342.81558 -509.16072 521.12456
## 22.63462       5.981920 -331.73646 343.70030 -510.51377 522.47761
## 22.65385       5.981920 -332.61886 344.58270 -511.86329 523.82713
## 22.67308       5.981920 -333.49897 345.46281 -513.20930 525.17314
## 22.69231       5.981920 -334.37681 346.34065 -514.55184 526.51568
## 22.71154       5.981920 -335.25238 347.21622 -515.89091 527.85475
## 22.73077       5.981920 -336.12572 348.08956 -517.22656 529.19040
## 22.75000       5.981920 -336.99683 348.96067 -518.55881 530.52265
## 22.76923       5.981920 -337.86574 349.82957 -519.88769 531.85153
## 22.78846       5.981920 -338.73245 350.69629 -521.21321 533.17705
## 22.80769       5.981920 -339.59699 351.56083 -522.53541 534.49925
## 22.82692       5.981920 -340.45937 352.42321 -523.85432 535.81816
## 22.84615       5.981920 -341.31961 353.28345 -525.16994 537.13378
## 22.86538       5.981920 -342.17773 354.14157 -526.48232 538.44616
## 22.88462       5.981920 -343.03374 354.99758 -527.79147 539.75531
## 22.90385       5.981920 -343.88765 355.85149 -529.09741 541.06125
## 22.92308       5.981920 -344.73948 356.70332 -530.40018 542.36402
## 22.94231       5.981920 -345.58925 357.55309 -531.69979 543.66363
## 22.96154       5.981920 -346.43697 358.40081 -532.99626 544.96010
## 22.98077       5.981920 -347.28266 359.24650 -534.28963 546.25347
## 23.00000       5.981920 -348.12632 360.09016 -535.57990 547.54374
## 23.01923       5.981920 -348.96798 360.93182 -536.86711 548.83095
## 23.03846       5.981920 -349.80765 361.77149 -538.15128 550.11512
## 23.05769       5.981920 -350.64535 362.60919 -539.43242 551.39626
## 23.07692       5.981920 -351.48108 363.44492 -540.71056 552.67440
## 23.09615       5.981920 -352.31486 364.27870 -541.98571 553.94955
## 23.11538       5.981920 -353.14670 365.11054 -543.25791 555.22175
## 23.13462       5.981920 -353.97662 365.94046 -544.52717 556.49101
## 23.15385       5.981920 -354.80464 366.76848 -545.79350 557.75734
## 23.17308       5.981920 -355.63075 367.59459 -547.05694 559.02078
## 23.19231       5.981920 -356.45499 368.41883 -548.31750 560.28134
## 23.21154       5.981920 -357.27735 369.24119 -549.57520 561.53904
## 23.23077       5.981920 -358.09786 370.06170 -550.83005 562.79389
## 23.25000       5.981920 -358.91652 370.88036 -552.08209 564.04593
## 23.26923       5.981920 -359.73335 371.69719 -553.33132 565.29516
## 23.28846       5.981920 -360.54836 372.51220 -554.57777 566.54161
## 23.30769       5.981920 -361.36156 373.32540 -555.82145 567.78529
## 23.32692       5.981920 -362.17296 374.13680 -557.06239 569.02623
## 23.34615       5.981920 -362.98258 374.94642 -558.30059 570.26443
## 23.36538       5.981920 -363.79043 375.75427 -559.53609 571.49993
## 23.38462       5.981920 -364.59652 376.56036 -560.76889 572.73273
## 23.40385       5.981920 -365.40085 377.36469 -561.99902 573.96286
## 23.42308       5.981920 -366.20345 378.16729 -563.22649 575.19033
## 23.44231       5.981920 -367.00432 378.96816 -564.45131 576.41515
## 23.46154       5.981920 -367.80348 379.76732 -565.67352 577.63736
## 23.48077       5.981920 -368.60093 380.56477 -566.89311 578.85695
## 23.50000       5.981920 -369.39669 381.36052 -568.11012 580.07396
## 23.51923       5.981920 -370.19076 382.15460 -569.32455 581.28838
## 23.53846       5.981920 -370.98316 382.94700 -570.53642 582.50026
## 23.55769       5.981920 -371.77390 383.73774 -571.74575 583.70959
## 23.57692       5.981920 -372.56298 384.52682 -572.95255 584.91639
## 23.59615       5.981920 -373.35043 385.31427 -574.15684 586.12068
## 23.61538       5.981920 -374.13624 386.10008 -575.35864 587.32248
## 23.63462       5.981920 -374.92043 386.88427 -576.55796 588.52180
## 23.65385       5.981920 -375.70301 387.66685 -577.75481 589.71865
## 23.67308       5.981920 -376.48399 388.44783 -578.94922 590.91306
## 23.69231       5.981920 -377.26338 389.22722 -580.14119 592.10503
## 23.71154       5.981920 -378.04119 390.00503 -581.33074 593.29458
## 23.73077       5.981920 -378.81742 390.78126 -582.51789 594.48173
## 23.75000       5.981920 -379.59210 391.55594 -583.70265 595.66649
## 23.76923       5.981920 -380.36521 392.32905 -584.88503 596.84887
## 23.78846       5.981920 -381.13679 393.10063 -586.06505 598.02889
## 23.80769       5.981920 -381.90683 393.87067 -587.24273 599.20657
## 23.82692       5.981920 -382.67534 394.63918 -588.41807 600.38191
## 23.84615       5.981920 -383.44234 395.40618 -589.59109 601.55493
## 23.86538       5.981920 -384.20783 396.17167 -590.76181 602.72565
## 23.88462       5.981920 -384.97182 396.93566 -591.93023 603.89407
## 23.90385       5.981920 -385.73432 397.69816 -593.09637 605.06021
## 23.92308       5.981920 -386.49534 398.45918 -594.26025 606.22409
#AICc = 7496.93
#RMSE = 13.45331
#Predictions eventually turn into 'naive'
##NeuralNet Model
cases_Neural_net = nnetar(cases_sj_ts)
cases_neural_net_fcast = forecast(cases_Neural_net,h=260)
autoplot(cases_neural_net_fcast)

summary(cases_neural_net_fcast)
## 
## Forecast method: NNAR(13,1,8)[52]
## 
## Model Information:
## 
## Average of 20 networks, each of which is
## a 14-8-1 network with 129 weights
## options were - linear output units 
## 
## Error measures:
##                       ME     RMSE      MAE  MPE MAPE      MASE       ACF1
## Training set -0.01145688 7.154006 5.174343 -Inf  Inf 0.1413913 -0.0152953
## 
## Forecasts:
##        Point Forecast
## 18.942       5.143742
## 18.962       4.899760
## 18.981       5.375619
## 19.000       6.479717
## 19.019       7.651989
## 19.038       8.187080
## 19.058       8.530680
## 19.077       9.453158
## 19.096      10.516482
## 19.115      11.456385
## 19.135      11.994286
## 19.154      12.696213
## 19.173      13.581474
## 19.192      14.397169
## 19.212      15.767366
## 19.231      16.765970
## 19.250      17.670590
## 19.269      18.749325
## 19.288      19.587960
## 19.308      20.567248
## 19.327      21.450994
## 19.346      22.280119
## 19.365      24.293684
## 19.385      24.578299
## 19.404      25.106992
## 19.423      25.638150
## 19.442      25.885124
## 19.462      26.178084
## 19.481      26.293139
## 19.500      26.218822
## 19.519      26.059855
## 19.538      25.714640
## 19.558      25.230528
## 19.577      24.460688
## 19.596      23.627456
## 19.615      22.798221
## 19.635      21.827836
## 19.654      20.797255
## 19.673      19.725369
## 19.692      18.617015
## 19.712      17.623565
## 19.731      16.509565
## 19.750      15.404550
## 19.769      14.353502
## 19.788      13.381918
## 19.808      12.442932
## 19.827      11.547867
## 19.846      10.739817
## 19.865      10.008515
## 19.885       9.357932
## 19.904       8.840374
## 19.923       8.412779
## 19.942       8.059498
## 19.962       7.793185
## 19.981       7.605614
## 20.000       7.490942
## 20.019       7.446422
## 20.038       7.461865
## 20.058       7.531153
## 20.077       7.656843
## 20.096       7.832242
## 20.115       8.045937
## 20.135       8.294066
## 20.154       8.574717
## 20.173       8.882310
## 20.192       9.211927
## 20.212       9.558122
## 20.231       9.916267
## 20.250      10.283391
## 20.269      10.656071
## 20.288      11.029532
## 20.308      11.400028
## 20.327      11.764983
## 20.346      12.121744
## 20.365      12.471271
## 20.385      12.804182
## 20.404      13.120782
## 20.423      13.419345
## 20.442      13.696664
## 20.462      13.951858
## 20.481      14.182392
## 20.500      14.386041
## 20.519      14.562378
## 20.538      14.710089
## 20.558      14.827829
## 20.577      14.914135
## 20.596      14.969533
## 20.615      14.994839
## 20.635      14.989662
## 20.654      14.954709
## 20.673      14.890885
## 20.692      14.799455
## 20.712      14.683071
## 20.731      14.542536
## 20.750      14.380123
## 20.769      14.198732
## 20.788      14.001513
## 20.808      13.791240
## 20.827      13.570825
## 20.846      13.343625
## 20.865      13.112940
## 20.885      12.882070
## 20.904      12.654388
## 20.923      12.432572
## 20.942      12.219294
## 20.962      12.017168
## 20.981      11.828283
## 21.000      11.654393
## 21.019      11.496975
## 21.038      11.357160
## 21.058      11.235763
## 21.077      11.133323
## 21.096      11.050019
## 21.115      10.985734
## 21.135      10.940182
## 21.154      10.912868
## 21.173      10.903065
## 21.192      10.909895
## 21.212      10.932348
## 21.231      10.969298
## 21.250      11.019536
## 21.269      11.081773
## 21.288      11.154653
## 21.308      11.236798
## 21.327      11.326816
## 21.346      11.423306
## 21.365      11.524877
## 21.385      11.630148
## 21.404      11.737785
## 21.423      11.846495
## 21.442      11.955036
## 21.462      12.062228
## 21.481      12.166959
## 21.500      12.268194
## 21.519      12.364981
## 21.538      12.456455
## 21.558      12.541838
## 21.577      12.620445
## 21.596      12.691694
## 21.615      12.755105
## 21.635      12.810291
## 21.654      12.856970
## 21.673      12.894960
## 21.692      12.924178
## 21.712      12.944645
## 21.731      12.956469
## 21.750      12.959853
## 21.769      12.955085
## 21.788      12.942542
## 21.808      12.922672
## 21.827      12.895992
## 21.846      12.863081
## 21.865      12.824572
## 21.885      12.781144
## 21.904      12.733510
## 21.923      12.682406
## 21.942      12.628583
## 21.962      12.572799
## 21.981      12.515803
## 22.000      12.458331
## 22.019      12.401091
## 22.038      12.344761
## 22.058      12.289977
## 22.077      12.237326
## 22.096      12.187344
## 22.115      12.140505
## 22.135      12.097225
## 22.154      12.057854
## 22.173      12.022680
## 22.192      11.991921
## 22.212      11.965734
## 22.231      11.944210
## 22.250      11.927383
## 22.269      11.915225
## 22.288      11.907657
## 22.308      11.904547
## 22.327      11.905719
## 22.346      11.910956
## 22.365      11.920003
## 22.385      11.932575
## 22.404      11.948360
## 22.423      11.967024
## 22.442      11.988217
## 22.462      12.011578
## 22.481      12.036738
## 22.500      12.063325
## 22.519      12.090969
## 22.538      12.119305
## 22.558      12.147979
## 22.577      12.176646
## 22.596      12.204981
## 22.615      12.232675
## 22.635      12.259440
## 22.654      12.285012
## 22.673      12.309152
## 22.692      12.331647
## 22.712      12.352313
## 22.731      12.370993
## 22.750      12.387560
## 22.769      12.401916
## 22.788      12.413993
## 22.808      12.423750
## 22.827      12.431177
## 22.846      12.436288
## 22.865      12.439125
## 22.885      12.439752
## 22.904      12.438260
## 22.923      12.434756
## 22.942      12.429368
## 22.962      12.422242
## 22.981      12.413534
## 23.000      12.403416
## 23.019      12.392067
## 23.038      12.379672
## 23.058      12.366423
## 23.077      12.352512
## 23.096      12.338130
## 23.115      12.323467
## 23.135      12.308706
## 23.154      12.294024
## 23.173      12.279590
## 23.192      12.265562
## 23.212      12.252085
## 23.231      12.239292
## 23.250      12.227302
## 23.269      12.216220
## 23.288      12.206132
## 23.308      12.197113
## 23.327      12.189219
## 23.346      12.182491
## 23.365      12.176954
## 23.385      12.172620
## 23.404      12.169482
## 23.423      12.167524
## 23.442      12.166715
## 23.462      12.167012
## 23.481      12.168360
## 23.500      12.170697
## 23.519      12.173950
## 23.538      12.178040
## 23.558      12.182882
## 23.577      12.188385
## 23.596      12.194457
## 23.615      12.201000
## 23.635      12.207918
## 23.654      12.215114
## 23.673      12.222493
## 23.692      12.229960
## 23.712      12.237427
## 23.731      12.244805
## 23.750      12.252015
## 23.769      12.258981
## 23.788      12.265632
## 23.808      12.271906
## 23.827      12.277748
## 23.846      12.283109
## 23.865      12.287948
## 23.885      12.292234
## 23.904      12.295940
## 23.923      12.299050
#RMSE = 7.12234
##Multilinear Regression
Cases_Explanatory <- read_excel("~/Predictive Analytics/Final/Cases Explanatory.xlsx", col_types = c("date", "text", "numeric", "numeric", "numeric", "numeric", "numeric", "numeric"))
#Separate Cities
Cases_Explanatory_sj = Cases_Explanatory[Cases_Explanatory$city == 'sj',]
Cases_Explanatory_iq = Cases_Explanatory[Cases_Explanatory$city == 'iq',]
View(Cases_Explanatory_iq)
View(Cases_Explanatory_sj)
Cases_Explanatory_iq$city <- NULL
Cases_Explanatory_sj$city <- NULL
Cases_Explanatory_iq$week_start_date <- NULL
Cases_Explanatory_sj$week_start_date <- NULL
Cases_Explanatory_sj_ts <- ts(Cases_Explanatory_sj, frequency = 52)
library(GGally)
## 
## Attaching package: 'GGally'
## The following object is masked from 'package:fma':
## 
##     pigs
Cases_Explanatory_sj_ts %>%
  as.data.frame() %>%
  GGally::ggpairs()

Cases_MR <- tslm(
  Cases ~ precip + temp + hmdty + stemp + sprecip,
  data=Cases_Explanatory_sj_ts)
summary(Cases_MR)
## 
## Call:
## tslm(formula = Cases ~ precip + temp + hmdty + stemp + sprecip, 
##     data = Cases_Explanatory_sj_ts)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -44.39 -25.20 -10.35   6.65 419.83 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)  
## (Intercept) -1.044e+03  8.631e+02  -1.209   0.2269  
## precip      -3.835e-02  4.834e-02  -0.793   0.4277  
## temp         2.916e+00  3.052e+00   0.955   0.3397  
## hmdty        1.342e+00  6.742e-01   1.990   0.0469 *
## stemp        3.724e+00  2.852e+00   1.306   0.1919  
## sprecip      3.330e-02  7.373e-02   0.452   0.6517  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 50.43 on 927 degrees of freedom
## Multiple R-squared:  0.04446,    Adjusted R-squared:  0.03931 
## F-statistic: 8.627 on 5 and 927 DF,  p-value: 5.292e-08
autoplot(Cases_Explanatory_sj_ts[,'Cases'], series="Data") +
  autolayer(fitted(Cases_MR), series="Fitted") +
  xlab("Year") + ylab("") +
  ggtitle("Cases of Dengue") +
  guides(colour=guide_legend(title=" "))

cbind(Data = Cases_Explanatory_sj_ts[,"Cases"],
      Fitted = fitted(Cases_MR)) %>%
  as.data.frame() %>%
  ggplot(aes(x=Data, y=Fitted)) +
  geom_point() +
  ylab("Fitted (predicted values)") +
  xlab("Data (actual values)") +
  ggtitle("Cases of Dengue") +
  geom_abline(intercept=0, slope=1)

checkresiduals((Cases_MR))

## 
##  Breusch-Godfrey test for serial correlation of order up to 104
## 
## data:  Residuals from Linear regression model
## LM test = 867.98, df = 104, p-value < 2.2e-16
View(Cases_MR)
## Error in as.data.frame.default(x): cannot coerce class 'c("tslm", "lm")' to a data.frame
fcast.Cases_MR_Fitted = forecast(Cases_MR$fitted.values, 260)
fcast.Cases_MR_data = forecast(Cases_MR$x, 260)
autoplot(fcast.Cases_MR_Fitted)

autoplot(fcast.Cases_MR_data)

summary(fcast.Cases_MR_Fitted)
## 
## Forecast method: STL +  ETS(A,N,N)
## 
## Model Information:
## ETS(A,N,N) 
## 
## Call:
##  ets(y = x, model = etsmodel, allow.multiplicative.trend = allow.multiplicative.trend) 
## 
##   Smoothing parameters:
##     alpha = 0.2359 
## 
##   Initial states:
##     l = 30.2322 
## 
##   sigma:  4.5032
## 
##      AIC     AICc      BIC 
## 9192.147 9192.173 9206.662 
## 
## Error measures:
##                        ME     RMSE      MAE       MPE     MAPE      MASE
## Training set -0.006935465 4.498327 3.379475 -5.154487 18.24216 0.5898735
##                   ACF1
## Training set 0.1321072
## 
## Forecasts:
##          Point Forecast       Lo 80    Hi 80        Lo 95    Hi 95
## 18.94231       22.33716 16.56613187 28.10819  13.51113461 31.16318
## 18.96154       27.62955 21.70018952 33.55892  18.56137402 36.69773
## 18.98077       27.85169 21.76811136 33.93527  18.54765840 37.15573
## 19.00000       30.44282 24.20883537 36.67680  20.90876390 39.97687
## 19.01923       32.57897 26.19812610 38.95981  22.82031228 42.33762
## 19.03846       34.13310 27.60870320 40.65750  24.15489650 44.11130
## 19.05769       35.73838 29.07352453 42.40324  25.54536138 45.93141
## 19.07692       35.92874 29.12631583 42.73116  25.52533128 46.33214
## 19.09615       38.10944 31.17217850 45.04669  27.49981629 48.71906
## 19.11538       37.93628 30.86675886 45.00580  27.12438012 48.74818
## 19.13462       38.25709 31.05773421 45.45645  27.24662503 49.26756
## 19.15385       37.28160 29.95471201 44.60849  26.07609014 48.48712
## 19.17308       37.85987 30.40762842 45.31212  26.46264906 49.25709
## 19.19231       38.20999 30.63447144 45.78551  26.62423246 49.79575
## 19.21154       39.91935 32.22252476 47.61618  28.14807128 51.69063
## 19.23077       39.47163 31.65538123 47.28788  27.51770970 51.42555
## 19.25000       40.63649 32.70261836 48.57036  28.50268025 52.77030
## 19.26923       39.16566 31.11588177 47.21544  26.85458682 51.47673
## 19.28846       39.16906 31.00501731 47.33309  26.68323653 51.65487
## 19.30769       38.10222 29.82549545 46.37894  25.44406377 50.76037
## 19.32692       40.42341 32.03552124 48.81130  27.59523994 53.25158
## 19.34615       38.74915 30.25154227 47.24676  25.75318117 51.74512
## 19.36538       38.50424 29.89831939 47.11017  25.34261889 51.66587
## 19.38462       38.65304 29.94014179 47.36593  25.32781467 51.97826
## 19.40385       37.14088 28.32231446 45.95945  23.65404754 50.62771
## 19.42308       35.95887 27.03588218 44.88186  22.31233790 49.60540
## 19.44231       36.94282 27.91661405 45.96902  23.13843186 50.74720
## 19.46154       36.20644 27.07819569 45.33469  22.24599334 50.16689
## 19.48077       32.73576 23.50659153 41.96492  18.62096629 46.85055
## 19.50000       29.53600 20.20701060 38.86500  15.26854034 43.80347
## 19.51923       25.82192 16.39415726 35.24968  11.40340151 40.24044
## 19.53846       27.34048 17.81497117 36.86599  12.77247204 41.90849
## 19.55769       21.20733 11.58506658 30.82959   6.49134968 35.92330
## 19.57692       23.82880 14.11075395 33.54685   8.96632916 38.69128
## 19.59615       22.40558 12.59267843 32.21849   7.39804073 37.41312
## 19.61538       23.57065 13.66379520 33.47750   8.41942532 38.72187
## 19.63462       18.53118  8.53126709 28.53110   3.23763224 33.82473
## 19.65385       15.92564  5.83352312 26.01776   0.49107758 31.36021
## 19.67308       17.56029  7.37679720 27.74378   1.98598290 33.13459
## 19.69231       14.19133  3.91728598 24.46538  -1.52146695 29.90414
## 19.71154       12.32669  1.96287113 22.69050  -3.52340154 28.17678
## 19.73077       13.06741  2.61459972 23.52022  -2.91878463 29.05361
## 19.75000       14.48946  3.94840725 25.03052  -1.63169104 30.61062
## 19.76923       14.31772  3.68915519 24.94629  -1.93726920 30.57272
## 19.78846       15.00116  4.28579572 25.71653  -1.38657643 31.38890
## 19.80769       15.58011  4.77864837 26.38158  -0.93930234 32.09953
## 19.82692       14.90584  4.01895976 25.79273  -1.74420906 31.55590
## 19.84615       17.74340  6.77175794 28.71504   0.96372305 34.52307
## 19.86538       20.24936  9.19361817 31.30510   3.34106114 37.15766
## 19.88462       20.16087  9.02165688 31.30008   3.12491385 37.19683
## 19.90385       22.70170 11.47963542 33.92376   5.53903505 39.86436
## 19.92308       26.07507 14.77077242 37.37938   8.78663612 43.36351
## 19.94231       22.33716 10.95120921 33.72311   4.92385143 39.75047
## 19.96154       27.62955 16.16253730 39.09657  10.09226579 45.16684
## 19.98077       27.85169 16.30417907 39.39920  10.19129508 45.51209
## 20.00000       30.44282 18.81536642 42.07027  12.66016494 48.22547
## 20.01923       32.57897 20.87212216 44.28581  14.67489216 50.48304
## 20.03846       34.13310 22.34739427 45.91880  16.10841886 52.15778
## 20.05769       35.73838 23.87434347 47.60242  17.59390012 53.88287
## 20.07692       35.92874 23.98687670 47.87060  17.66523742 54.19224
## 20.09615       38.10944 26.09025789 50.12861  19.72768941 56.49118
## 20.11538       37.93628 25.84027973 50.03228  19.43704366 56.43552
## 20.13462       38.25709 26.08475189 50.42943  19.64110490 56.87308
## 20.15385       37.28160 25.03340193 49.52980  18.54959586 56.01361
## 20.17308       37.85987 25.53627531 50.18347  19.01255738 56.70719
## 20.19231       38.20999 25.81145984 50.60853  19.24807275 57.17191
## 20.21154       39.91935 27.44633062 52.39237  20.84351269 58.99519
## 20.23077       39.47163 26.92456438 52.01869  20.28254969 58.66071
## 20.25000       40.63649 28.01581586 53.25716  21.33483438 59.93815
## 20.26923       39.16566 26.47180190 51.85952  19.75207959 58.57924
## 20.28846       39.16906 26.40243423 51.93568  19.64419315 58.69392
## 20.30769       38.10222 25.26324431 50.94119  18.46670276 57.73773
## 20.32692       40.42341 27.51249383 53.33433  20.67786644 60.16896
## 20.34615       38.74915 25.76668303 51.73161  18.89418086 58.60412
## 20.36538       38.50424 25.45062185 51.55786  18.54045250 58.46803
## 20.38462       38.65304 25.52864526 51.77743  18.58101293 58.72506
## 20.40385       37.14088 23.94610101 50.33566  16.96120663 57.32055
## 20.42308       35.95887 22.69407398 49.22367  15.67211528 56.24562
## 20.44231       36.94282 23.60837078 50.27726  16.54954238 57.33609
## 20.46154       36.20644 22.80271230 49.61017  15.70720577 56.70568
## 20.48077       32.73576 19.26309608 46.20842  12.13110005 53.34041
## 20.50000       29.53600 15.99476234 43.07724   8.82646254 50.24554
## 20.51923       25.82192 12.21244479 39.43139   5.00802417 46.63581
## 20.53846       27.34048 13.66311081 41.01785   6.42274956 48.25821
## 20.55769       21.20733  7.46240081 34.95225   0.18627647 42.22838
## 20.57692       23.82880 10.01664999 37.64096   2.70493747 44.95267
## 20.59615       22.40558  8.52652690 36.28464   1.17939859 43.63177
## 20.61538       23.57065  9.62500889 37.51628   2.24263469 44.89866
## 20.63462       18.53118  4.51927981 32.54308  -2.89817280 39.96054
## 20.65385       15.92564  1.84778865 30.00350  -5.60457728 37.45586
## 20.67308       17.56029  3.41678824 31.70379  -4.07032818 39.19090
## 20.69231       14.19133 -0.01750676 28.40018  -7.53921314 35.92188
## 20.71154       12.32669 -1.94719752 26.60057  -9.50333551 34.15671
## 20.73077       13.06741 -1.27122068 27.40604  -8.86163410 34.99646
## 20.75000       14.48946  0.08637481 28.89255  -7.53815995 36.51709
## 20.76923       14.31772 -0.14953475 28.78498  -7.80803883 36.44349
## 20.78846       15.00116  0.47001698 29.53231  -7.22230642 37.22463
## 20.80769       15.58011  0.98536301 30.17487  -6.74063166 37.90086
## 20.82692       14.90584  0.24776289 29.56393  -7.51175696 37.32345
## 20.84615       17.74340  3.02225700 32.46454  -4.77064379 40.25744
## 20.86538       20.24936  5.46543240 35.03329  -2.36070695 42.85943
## 20.88462       20.16087  5.31441684 35.00732  -2.54482051 42.86656
## 20.90385       22.70170  7.79298250 37.61041  -0.09921404 45.50261
## 20.92308       26.07507 11.10435837 41.04579   3.17933972 48.97081
## 20.94231       22.33716  7.30469574 37.36962  -0.65300965 45.32733
## 20.96154       27.62955 12.53559569 42.72351   4.54533727 50.71377
## 20.98077       27.85169 12.69648974 43.00689   4.67381038 51.02957
## 21.00000       30.44282 15.22661860 45.65902   7.17164879 53.71399
## 21.01923       32.57897 17.30201357 47.85592   9.21488224 55.94305
## 21.03846       34.13310 18.79563074 49.47057  10.67646528 57.58973
## 21.05769       35.73838 20.34063867 51.13613  12.18956499 59.28720
## 21.07692       35.92874 20.47095182 51.38652  12.28809433 59.56938
## 21.09615       38.10944 22.59184137 53.62703  14.37732306 61.84155
## 21.11538       37.93628 22.35910703 53.51345  14.11304945 61.75951
## 21.13462       38.25709 22.62056517 53.89362  14.34308850 62.17109
## 21.15385       37.28160 21.58594985 52.97726  13.27717289 61.28603
## 21.17308       37.85987 22.10531279 53.61443  13.76535301 61.95439
## 21.19231       38.20999 22.39674784 54.02324  14.02572140 62.39426
## 21.21154       39.91935 24.04763592 55.79107  15.64565770 64.19304
## 21.23077       39.47163 23.54165940 55.40160  15.10884299 63.83441
## 21.25000       40.63649 24.64847846 56.62450  16.18493623 65.08804
## 21.26923       39.16566 23.11981518 55.21150  14.62565828 63.70566
## 21.28846       39.16906 23.06558638 55.27252  14.54092474 63.79719
## 21.30769       38.10222 21.94132842 54.26311  13.38627083 62.81816
## 21.32692       40.42341 24.20530775 56.64152  15.61996181 65.22686
## 21.34615       38.74915 22.47402921 55.02427  13.85850139 63.63980
## 21.36538       38.50424 22.17230717 54.83618  13.52670286 63.48178
## 21.38462       38.65304 22.26448093 55.04159  13.58890438 63.71717
## 21.40385       37.14088 20.69590241 53.58586  11.99045681 62.29130
## 21.42308       35.95887 19.45766051 52.46008  10.72244801 61.19529
## 21.44231       36.94282 20.38556579 53.50006  11.62068747 62.26494
## 21.46154       36.20644 19.59334291 52.81954  10.79889884 61.61399
## 21.48077       32.73576 16.06699311 49.40452   7.24308236 58.22843
## 21.50000       29.53600 12.81176017 46.26025   3.95848081 55.11353
## 21.51923       25.82192  9.04238128 42.60146   0.15983042 51.48401
## 21.53846       27.34048 10.50582719 44.17513   1.59410096 53.08686
## 21.55769       21.20733  4.31774157 38.09691  -4.62306482 47.03772
## 21.57692       23.82880  6.88446277 40.77314  -2.08532950 49.74294
## 21.59615       22.40558  5.40666245 39.40450  -3.59202233 48.40319
## 21.61538       23.57065  6.51732094 40.62397  -2.51016389 49.65146
## 21.63462       18.53118  1.42362501 35.63874  -7.63256828 44.69493
## 21.65385       15.92564 -1.23597355 33.08726 -10.32078457 42.17207
## 21.67308       17.56029  0.34478087 34.77579  -8.76855803 43.88913
## 21.69231       14.19133 -3.07789442 31.46056 -12.21967216 40.60234
## 21.71154       12.32669 -4.99609797 29.64947 -14.16622637 38.81960
## 21.73077       13.06741 -4.30876391 30.44359 -13.50715558 39.64198
## 21.75000       14.48946 -2.93993871 31.91887 -12.16650707 41.14543
## 21.76923       14.31772 -3.16474367 31.80019 -12.41940294 41.05485
## 21.78846       15.00116 -2.53421015 32.53653 -11.81687532 41.81920
## 21.80769       15.58011 -2.00800282 33.16823 -11.31858966 42.47882
## 21.82692       14.90584 -2.73485997 32.54655 -12.07328498 41.88497
## 21.84615       17.74340  0.05026098 35.43653  -9.31591946 44.80271
## 21.86538       20.24936  2.50394918 37.99477  -6.88990470 47.38863
## 21.88462       20.16087  2.36333441 37.95840  -7.05811161 47.37985
## 21.90385       22.70170  4.85219086 40.55120  -4.59676673 50.00016
## 21.92308       26.07507  8.17374947 43.97640  -1.30263983 53.45279
## 21.94231       22.33716  4.38416341 40.29015  -5.11957841 49.79390
## 21.96154       27.62955  9.62503563 45.63407   0.09401978 55.16509
## 21.98077       27.85169  9.79579944 45.90758   0.23758739 55.46580
## 22.00000       30.44282 12.33569733 48.54994   2.75036624 58.13527
## 22.01923       32.57897 14.42076230 50.73717   4.80838868 60.34955
## 22.03846       34.13310 15.92395212 52.34225   6.28461184 61.98159
## 22.05769       35.73838 17.47843700 53.99833   7.81220529 63.66456
## 22.07692       35.92874 17.61813300 54.23934   7.92508445 63.93239
## 22.09615       38.10944 19.74831285 56.47056  10.02852147 66.19035
## 22.11538       37.93628 19.52477779 56.34778   9.77831694 66.09424
## 22.13462       38.25709 19.79534568 56.71884  10.02228815 66.49189
## 22.15385       37.28160 18.76975203 55.79345   8.97017000 65.59304
## 22.17308       37.85987 19.29804999 56.42169   9.47201506 66.24773
## 22.19231       38.20999 19.59833480 56.82165   9.74591799 66.67407
## 22.21154       39.91935 21.25798874 58.58071  11.37926051 68.45944
## 22.23077       39.47163 20.76069551 58.18256  10.85572575 68.08753
## 22.25000       40.63649 21.87611658 59.39686  11.94497463 69.32801
## 22.26923       39.16566 20.35597532 57.97534  10.39872997 67.93259
## 22.28846       39.16906 20.31018976 58.02792  10.32690926 68.01120
## 22.30769       38.10222 19.19429751 57.01014   9.18504959 67.01938
## 22.32692       40.42341 21.46656618 59.38026  11.43141803 69.41541
## 22.34615       38.74915 19.74350180 57.75480   9.68252009 67.81578
## 22.36538       38.50424 19.44991987 57.55857   9.36317077 67.64531
## 22.38462       38.65304 19.55016079 57.75591   9.43770995 67.86836
## 22.40385       37.14088 17.98957758 56.29218   7.85149017 66.43027
## 22.42308       35.95887 16.75926022 55.15848   6.59560090 65.32214
## 22.44231       36.94282 17.69502031 56.19061   7.50585325 66.37978
## 22.46154       36.20644 16.91058352 55.50230   6.69597243 65.71691
## 22.48077       32.73576 13.39195212 52.07956   3.15196020 62.31955
## 22.50000       29.53600 10.14437084 48.92764  -0.12093913 59.19295
## 22.51923       25.82192  6.38257787 45.26126  -3.90798788 55.55183
## 22.53846       27.34048  7.85354486 46.82741  -2.46221482 57.14317
## 22.55769       21.20733  1.67291643 40.74174  -8.66797581 51.08263
## 22.57692       23.82880  4.24703185 43.41058  -6.11893201 53.77654
## 22.59615       22.40558  2.77656364 42.03460  -7.61441135 52.42558
## 22.61538       23.57065  3.89449301 43.24680  -6.52143305 53.66272
## 22.63462       18.53118 -1.19199241 38.25436 -11.63280992 48.69517
## 22.65385       15.92564 -3.84444001 35.69573 -14.31008976 46.16138
## 22.67308       17.56029 -2.25659334 37.37717 -12.74701656 47.86759
## 22.69231       14.19133 -5.67223429 34.05490 -16.18737260 44.57004
## 22.71154       12.32669 -7.58346064 32.23683 -18.12325610 42.77663
## 22.73077       13.06741 -6.88920572 33.02403 -17.45360077 43.58842
## 22.75000       14.48946 -5.51351525 34.49244 -16.10245275 45.08138
## 22.76923       14.31772 -5.73150980 34.36696 -16.34493299 44.98038
## 22.78846       15.00116 -5.09421998 35.09654 -15.73207249 45.73440
## 22.80769       15.58011 -4.56130976 35.72154 -15.22353563 46.38376
## 22.82692       14.90584 -5.28151669 35.09321 -15.96806034 45.77975
## 22.84615       17.74340 -2.48979754 37.97659 -13.20060375 48.68740
## 22.86538       20.24936 -0.02956247 40.52829 -10.76457641 51.26330
## 22.88462       20.16087 -0.16368103 40.48542 -10.92284822 51.24459
## 22.90385       22.70170  2.33162163 43.07177  -8.45164472 53.85504
## 22.92308       26.07507  5.65957708 46.49057  -5.14773468 57.29788
## 22.94231       22.33716  1.87633914 42.79798  -8.95496467 53.62928
## 22.96154       27.62955  7.12351134 48.13559  -3.73173147 58.99084
## 22.98077       27.85169  7.30052765 48.40286  -3.57860150 59.28199
## 23.00000       30.44282  9.84663111 51.03901  -1.05633204 61.94197
## 23.01923       32.57897 11.93785534 53.22008   1.01111016 64.14683
## 23.03846       34.13310 13.44715867 54.81904   2.49668313 65.76952
## 23.05769       35.73838 15.00771187 56.46905   4.03355728 67.44321
## 23.07692       35.92874 15.15343157 56.70404   4.15564891 67.70183
## 23.09615       38.10944 17.28959106 58.92928   6.26823098 69.95064
## 23.11538       37.93628 17.07199209 58.80057   6.02710492 69.84546
## 23.13462       38.25709 17.34845306 59.16573   6.28008882 70.23409
## 23.15385       37.28160 16.32871000 58.23450   5.23691838 69.32629
## 23.17308       37.85987 16.86281658 58.85693   5.74764694 69.97210
## 23.19231       38.20999 17.16886852 59.25112   6.03036995 70.38962
## 23.21154       39.91935 18.83424861 61.00445   7.67246986 72.16623
## 23.23077       39.47163 18.34264104 60.60062   7.15763056 71.78563
## 23.25000       40.63649 19.46370774 61.80927   8.25551369 73.01747
## 23.26923       39.16566 17.94917256 60.38215   6.71784279 71.61348
## 23.28846       39.16906 17.90895399 60.42916   6.65453606 71.68358
## 23.30769       38.10222 16.79859010 59.40584   5.52113128 70.68330
## 23.32692       40.42341 19.07634894 61.77048   7.77589621 73.07093
## 23.34615       38.74915 17.35873698 60.13956   6.03533703 71.46296
## 23.36538       38.50424 17.07057015 59.93791   5.72426940 71.28422
## 23.38462       38.65304 17.17618928 60.12988   5.80703385 71.49904
## 23.40385       37.14088 15.62094782 58.66081   4.22898356 70.05278
## 23.42308       35.95887 14.39593615 57.52180   2.98120863 68.93653
## 23.44231       36.94282 15.33696626 58.54866   3.89952079 69.98611
## 23.46154       36.20644 14.55776426 57.85512   3.09764588 69.31524
## 23.48077       32.73576 11.04433276 54.42718  -0.43841376 65.90993
## 23.50000       29.53600  7.80191693 51.27009  -3.70341323 62.77542
## 23.51923       25.82192  4.04525530 47.59858  -7.48261426 59.12645
## 23.53846       27.34048  5.52131993 49.15964  -6.02904506 60.71000
## 23.55769       21.20733 -0.65424422 43.06890 -12.22706089 54.64171
## 23.57692       23.82880  1.92490249 45.73270  -9.67032240 57.32793
## 23.59615       22.40558  0.45943295 44.35173 -11.15815693 55.96932
## 23.61538       23.57065  1.58232872 45.55896 -10.05758319 57.19887
## 23.63462       18.53118 -3.49922225 40.56158 -15.16141345 52.22378
## 23.65385       15.92564 -6.14676696 37.99805 -17.83119498 49.68248
## 23.67308       17.56029 -4.55404867 39.67462 -16.26067127 51.38125
## 23.69231       14.19133 -7.96484890 36.34752 -19.69362408 48.07629
## 23.71154       12.32669 -9.87126513 34.52464 -21.62215113 46.27552
## 23.73077       13.06741 -9.17223036 35.30705 -20.94518564 47.08001
## 23.75000       14.48946 -7.79178999 36.77072 -19.58677327 48.56570
## 23.76923       14.31772 -8.00506427 36.64051 -19.82203449 48.45748
## 23.78846       15.00116 -7.36308351 37.36541 -19.20199983 49.20432
## 23.80769       15.58011 -6.82551138 37.98574 -18.68633319 49.84656
## 23.82692       14.90584 -7.54108513 37.35277 -19.42377206 49.23546
## 23.84615       17.74340 -4.74476123 40.23156 -16.64927311 52.13607
## 23.86538       20.24936 -2.27994956 42.77867 -14.20624645 54.70497
## 23.88462       20.16087 -2.40951935 42.73126 -14.35756154 54.67930
## 23.90385       22.70170  0.09030449 45.31309 -11.87944349 57.28284
## 23.92308       26.07507  3.42275382 48.72740  -8.56866065 60.71881
#RMSE = 4.498327
summary(fcast.Cases_MR_data)
## 
## Forecast method: STL +  ETS(A,Ad,N)
## 
## Model Information:
## ETS(A,Ad,N) 
## 
## Call:
##  ets(y = x, model = etsmodel, allow.multiplicative.trend = allow.multiplicative.trend) 
## 
##   Smoothing parameters:
##     alpha = 0.9999 
##     beta  = 0.1047 
##     phi   = 0.8 
## 
##   Initial states:
##     l = 38.3829 
##     b = -0.7926 
## 
##   sigma:  12.3531
## 
##      AIC     AICc      BIC 
## 11078.17 11078.26 11107.20 
## 
## Error measures:
##                        ME     RMSE      MAE  MPE MAPE      MASE       ACF1
## Training set -0.007586283 12.31994 7.645447 -Inf  Inf 0.2089153 0.02822224
## 
## Forecasts:
##          Point Forecast       Lo 80     Hi 80      Lo 95     Hi 95
## 18.94231       7.083826   -8.747292  22.91495  -17.12778  31.29543
## 18.96154       7.886692  -15.457487  31.23087  -27.81515  43.58853
## 18.98077       9.021845  -20.589193  38.63288  -36.26433  54.30802
## 19.00000       7.936063  -27.282219  43.15435  -45.92565  61.79778
## 19.01923      10.849757  -29.525976  51.22549  -50.89960  72.59911
## 19.03846      12.191092  -32.995447  57.37763  -56.91576  81.29794
## 19.05769      13.500286  -36.211612  63.21218  -62.52750  89.52807
## 19.07692      16.641664  -37.351440  70.63477  -65.93366  99.21699
## 19.09615      16.225197  -41.835445  74.28584  -72.57089 105.02129
## 19.11538      17.627884  -44.310576  79.56634  -77.09882 112.35458
## 19.13462      18.600552  -47.045624  84.24673  -81.79661 118.99771
## 19.15385      26.578894  -42.621423  95.77921  -79.25386 132.41164
## 19.17308      28.392594  -44.222482 101.00767  -82.66258 139.44777
## 19.19231      28.417637  -47.485162 104.32044  -87.66568 144.50095
## 19.21154      37.202598  -41.871726 116.27692  -83.73114 158.13634
## 19.23077      41.535678  -40.603550 123.67491  -84.08543 167.15679
## 19.25000      50.809385  -34.296631 135.91540  -79.34903 180.96780
## 19.26923      52.148432  -35.833839 140.13070  -82.40884 186.70570
## 19.28846      48.667084  -42.107691 139.44186  -90.16095 187.49512
## 19.30769      55.345199  -38.144416 148.83481  -87.63483 198.32523
## 19.32692      54.121984  -42.010278 150.25425  -92.89962 201.14359
## 19.34615      48.151922  -50.555729 146.85957 -102.80840 199.11225
## 19.36538      55.348895  -45.871347 156.56914  -99.45411 210.15190
## 19.38462      46.698445  -56.975627 150.37252 -111.85737 205.25426
## 19.40385      45.561454  -60.511353 151.63426 -116.66290 207.78581
## 19.42308      38.841706  -69.578073 147.26148 -126.97204 204.65545
## 19.44231      37.872298  -72.845728 148.59032 -131.45631 207.20091
## 19.46154      38.784731  -74.185594 151.75506 -133.98847 211.55793
## 19.48077      35.292312  -79.886902 150.47153 -140.85910 211.44372
## 19.50000      31.110715  -86.236307 148.45774 -148.35607 210.57750
## 19.51923      32.210668  -87.265221 151.68656 -150.51194 214.93327
## 19.53846      26.352637  -95.215147 147.92042 -159.56924 212.27452
## 19.55769      22.834654 -100.789871 146.45918 -166.23274 211.90205
## 19.57692      22.312666 -103.335125 147.96046 -169.84905 214.47438
## 19.59615      18.756091 -108.883047 146.39523 -176.45113 213.96331
## 19.61538      19.822751 -109.777257 149.42276 -178.38336 218.02886
## 19.63462      20.760648 -110.771091 152.29239 -180.39979 221.92108
## 19.65385      22.688470 -110.747111 156.12405 -181.38364 226.76058
## 19.67308      19.673446 -115.639249 154.98614 -187.26946 226.61636
## 19.69231      17.354497 -119.809672 154.51867 -192.42000 227.12899
## 19.71154      16.323495 -122.667522 155.31451 -196.24492 228.89191
## 19.73077      14.948521 -125.845670 155.74271 -200.37761 230.27465
## 19.75000      15.331504 -127.243080 157.90609 -202.71751 233.38051
## 19.76923      14.686836 -129.646199 159.01987 -206.05149 235.42516
## 19.78846      12.836862 -133.233470 158.90719 -210.55843 236.23216
## 19.80769      10.261320 -137.525899 158.04854 -215.75973 236.28237
## 19.82692      12.197691 -137.286706 161.68209 -216.41897 240.81435
## 19.84615       9.062438 -142.100090 160.22497 -222.12070 240.24557
## 19.86538       9.954060 -142.868178 162.77630 -223.76738 243.67550
## 19.88462       8.534552 -145.929567 162.99867 -227.69793 244.76704
## 19.90385       6.306565 -149.782169 162.39530 -232.41055 245.02368
## 19.92308       6.903920 -150.792697 164.60054 -234.27224 248.08008
## 19.94231       8.607051 -150.681220 167.89532 -235.00334 252.21744
## 19.96154       9.105275 -151.758904 169.96945 -236.91526 255.12581
## 19.98077       9.996715 -152.428085 172.42152 -238.41058 258.40401
## 20.00000       8.715961 -155.254608 172.68653 -242.05538 259.48731
## 20.01923      11.473677 -154.028225 176.97558 -241.63964 264.58699
## 20.03846      12.690229 -154.328967 179.70943 -242.74359 268.12405
## 20.05769      13.899597 -154.623234 182.42243 -243.83383 271.63302
## 20.07692      16.961113 -153.052054 186.97428 -243.05159 276.97381
## 20.09615      16.480757 -155.009796 187.97131 -245.79141 278.75292
## 20.11538      17.832333 -155.122987 190.78765 -246.68000 282.34467
## 20.13462      18.764111 -155.643674 193.17190 -247.96958 285.49780
## 20.15385      26.709742 -149.138512 202.55800 -242.22695 295.64644
## 20.17308      28.497272 -148.779746 205.77429 -242.62453 299.61908
## 20.19231      28.501380 -150.192980 207.19574 -244.78806 301.79082
## 20.21154      37.269593 -142.830955 217.37014 -238.17043 312.70961
## 20.23077      41.589274 -139.906567 223.08512 -235.98466 319.16321
## 20.25000      50.852262 -132.028228 233.73275 -228.83931 330.54384
## 20.26923      52.182734 -132.071999 236.43747 -229.61056 333.97603
## 20.28846      48.694525 -136.924277 234.31333 -235.18494 332.57399
## 20.30769      55.367152 -131.605769 242.34007 -230.58325 341.31756
## 20.32692      54.139546 -134.177755 242.45685 -233.86691 342.14601
## 20.34615      48.165972 -141.486181 237.81813 -241.88197 338.21391
## 20.36538      55.360136 -135.617540 246.33781 -236.71501 347.43529
## 20.38462      46.707437 -145.586623 239.00150 -247.38095 340.79582
## 20.40385      45.568647 -148.032847 239.17014 -250.51929 341.65658
## 20.42308      38.847461 -156.052698 233.74762 -259.22661 336.92153
## 20.44231      37.876902 -158.313324 234.06713 -262.17016 337.92396
## 20.46154      38.788415 -158.683452 236.26028 -263.21874 340.79557
## 20.48077      35.295258 -163.449984 234.04050 -268.65936 339.24988
## 20.50000      31.113072 -168.897439 231.12358 -274.77661 337.00275
## 20.51923      32.212554 -169.055272 233.48038 -275.60002 340.02513
## 20.53846      26.354146 -176.163189 228.87148 -283.36939 336.07768
## 20.55769      22.835861 -180.923321 226.59504 -288.78692 334.45864
## 20.57692      22.313632 -182.679874 227.30714 -291.19688 335.82414
## 20.59615      18.756863 -187.463578 224.97730 -296.63009 334.14381
## 20.61538      19.823369 -187.616752 227.26349 -297.42892 337.07566
## 20.63462      20.761142 -187.891528 229.41381 -298.34558 339.86786
## 20.65385      22.688866 -187.169348 232.54708 -298.26158 343.63931
## 20.67308      19.673763 -191.383109 230.73063 -303.10987 342.45739
## 20.69231      17.354750 -194.894011 229.60351 -307.25172 341.96122
## 20.71154      16.323698 -197.110296 229.75769 -310.09543 342.74282
## 20.73077      14.948683 -199.663997 229.56136 -313.27309 343.17045
## 20.75000      15.331634 -200.453296 231.11656 -314.68294 345.34620
## 20.76923      14.686940 -202.263905 231.63778 -317.11074 346.48462
## 20.78846      12.836945 -205.273582 230.94747 -320.73432 346.40821
## 20.80769      10.261386 -209.002691 229.52546 -325.07408 345.59685
## 20.82692      12.197744 -208.213845 232.60933 -324.89269 349.28818
## 20.84615       9.062480 -212.490678 230.61564 -329.77384 347.89879
## 20.86538       9.954094 -212.734781 232.64297 -330.61915 350.52734
## 20.88462       8.534580 -215.284249 232.35341 -333.76678 350.83594
## 20.90385       6.306587 -218.636520 231.24969 -337.71421 350.32738
## 20.92308       6.903937 -219.157856 232.96573 -338.82774 352.63562
## 20.94231       8.607065 -218.567906 235.78204 -338.82707 356.04120
## 20.96154       9.105286 -219.177435 237.38801 -340.02301 358.23358
## 20.98077       9.996724 -219.388398 239.38185 -340.81755 360.81099
## 21.00000       8.715968 -221.766281 239.19822 -343.77621 361.20815
## 21.01923      11.473683 -220.100496 243.04786 -342.68846 365.63583
## 21.03846      12.690234 -219.970750 245.35122 -343.13404 368.51450
## 21.05769      13.899600 -219.843136 247.64234 -343.57907 371.37827
## 21.07692      16.961116 -217.858389 251.78062 -342.16433 376.08656
## 21.09615      16.480759 -219.410599 252.37212 -344.28394 377.24546
## 21.11538      17.832334 -219.126029 254.79070 -344.56421 380.22888
## 21.13462      18.764113 -219.256473 256.78470 -345.25696 382.78519
## 21.15385      26.709743 -212.368346 265.78783 -338.92864 392.34813
## 21.17308      28.497273 -211.633661 268.62821 -338.75130 395.74585
## 21.19231      28.501381 -212.677804 269.68056 -340.35035 397.35311
## 21.21154      37.269593 -204.953304 279.49249 -333.17836 407.71755
## 21.23077      41.589275 -201.672858 284.85141 -330.44805 413.62660
## 21.25000      50.852262 -193.444685 295.14921 -322.76768 424.47220
## 21.26923      52.182734 -193.144663 297.51013 -323.01314 427.37861
## 21.28846      48.694525 -197.659011 295.04806 -328.07070 425.45975
## 21.30769      55.367152 -192.008267 302.74257 -322.96090 433.69521
## 21.32692      54.139547 -194.253551 302.53264 -325.74491 434.02401
## 21.34615      48.165973 -201.240652 297.57260 -333.26854 429.60049
## 21.36538      55.360136 -195.055913 305.77618 -327.61816 438.33843
## 21.38462      46.707437 -204.713983 298.12886 -337.80844 431.22332
## 21.40385      45.568647 -206.854141 297.99144 -340.47869 431.61599
## 21.42308      38.847461 -214.572738 292.26766 -348.72529 426.42021
## 21.44231      37.876902 -216.536797 292.29060 -351.21527 426.96908
## 21.46154      38.788415 -216.614920 294.19175 -351.81728 429.39411
## 21.48077      35.295258 -221.093892 291.68441 -356.81811 427.40863
## 21.50000      31.113072 -226.258118 288.48426 -362.50220 424.72834
## 21.51923      32.212554 -226.136944 290.56205 -362.89891 427.32401
## 21.53846      26.354146 -232.969968 285.67826 -370.24786 422.95615
## 21.55769      22.835861 -237.459220 283.13094 -375.25111 420.92283
## 21.57692      22.313632 -238.948808 283.57607 -377.25279 421.88005
## 21.59615      18.756863 -243.469366 280.98309 -382.28355 419.79727
## 21.61538      19.823369 -243.363122 283.00986 -382.68563 422.33237
## 21.63462      20.761142 -243.382118 284.90440 -383.21111 424.73340
## 21.65385      22.688866 -242.407711 287.78544 -382.74136 428.11909
## 21.67308      19.673763 -246.372715 285.72024 -387.20921 426.55674
## 21.69231      17.354750 -249.638249 284.34775 -390.97581 425.68530
## 21.71154      16.323698 -251.612479 284.25987 -393.44932 426.09672
## 21.73077      14.948683 -253.927362 283.82473 -396.26174 426.15911
## 21.75000      15.331634 -254.481007 285.14427 -397.31119 427.97446
## 21.76923      14.686940 -256.059056 285.43294 -399.38333 428.75721
## 21.78846      12.836945 -258.839199 284.51309 -402.65586 428.32975
## 21.80769      10.261386 -262.341733 282.86451 -406.64911 427.17188
## 21.82692      12.197744 -261.329209 285.72470 -406.12563 430.52112
## 21.84615       9.062480 -265.385196 283.51016 -410.66902 428.79398
## 21.86538       9.954094 -265.411228 285.31941 -411.18082 431.08901
## 21.88462       8.534580 -267.745339 284.81450 -413.99909 431.06825
## 21.90385       6.306587 -270.884911 283.49808 -417.62123 430.23440
## 21.92308       6.903937 -271.196152 285.00403 -418.41345 432.22132
## 21.94231       8.607065 -270.398657 287.61279 -418.09536 435.30949
## 21.96154       9.105286 -270.803138 289.01371 -418.97771 437.18828
## 21.98077       9.996724 -270.811501 290.80495 -419.46240 439.45584
## 22.00000       8.715968 -272.989183 290.42112 -422.11488 439.54682
## 22.01923      11.473683 -271.125549 294.07291 -420.72455 443.67191
## 22.03846      12.690234 -270.800258 296.18073 -420.87106 446.25153
## 22.05769      13.899600 -270.479358 298.27856 -421.02048 448.81969
## 22.07692      16.961116 -268.303542 302.22577 -419.31353 453.23576
## 22.09615      16.480759 -269.666857 302.62838 -421.14425 454.10577
## 22.11538      17.832334 -269.195524 304.86019 -421.13889 456.80356
## 22.13462      18.764113 -269.141297 306.66952 -421.54921 459.07744
## 22.15385      26.709743 -262.070550 315.49004 -414.94160 468.36109
## 22.17308      28.497273 -261.155261 318.14981 -414.48805 471.48260
## 22.19231      28.501381 -262.020777 319.02354 -415.81392 472.81668
## 22.21154      37.269593 -254.119592 328.65878 -408.37171 482.91090
## 22.23077      41.589275 -250.664366 333.84292 -405.37410 488.55265
## 22.25000      50.852262 -242.263284 343.96781 -397.42928 499.13381
## 22.26923      52.182734 -241.792191 346.15766 -397.41312 501.77858
## 22.28846      48.694525 -246.137274 343.52632 -402.21180 499.60085
## 22.30769      55.367152 -240.319038 351.05334 -396.84585 507.58016
## 22.32692      54.139547 -242.398573 350.67767 -399.37637 507.65546
## 22.34615      48.165973 -249.221636 345.55358 -406.64913 502.98107
## 22.36538      55.360136 -242.874542 353.59481 -400.75044 511.47071
## 22.38462      46.707437 -252.371910 345.78678 -410.69495 504.10983
## 22.40385      45.568647 -254.352991 345.49029 -413.12192 504.25921
## 22.42308      38.847461 -261.914109 339.60903 -421.12767 498.82259
## 22.44231      37.876902 -263.722261 339.47607 -423.37921 499.13302
## 22.46154      38.788415 -263.646022 341.22285 -423.74514 501.32197
## 22.48077      35.295258 -267.972151 338.56267 -428.51222 499.10274
## 22.50000      31.113072 -272.985028 335.21117 -433.96484 496.19098
## 22.51923      32.212554 -272.713975 337.13908 -434.13233 498.55744
## 22.53846      26.354146 -279.398567 332.10686 -441.25428 493.96257
## 22.55769      22.835861 -283.740809 329.41253 -446.03269 491.70442
## 22.57692      22.313632 -285.084787 329.71205 -447.81168 492.43894
## 22.59615      18.756863 -289.461113 326.97484 -452.62185 490.13558
## 22.61538      19.823369 -289.211992 328.85873 -452.80543 492.45217
## 22.63462      20.761142 -289.089447 330.61173 -453.11444 494.63672
## 22.65385      22.688866 -287.974812 333.35254 -452.43023 497.80796
## 22.67308      19.673763 -291.800881 331.14841 -456.68560 496.03312
## 22.69231      17.354750 -294.928754 329.63825 -460.24166 494.95115
## 22.71154      16.323698 -296.766577 329.41397 -462.50656 495.15395
## 22.73077      14.948683 -298.946288 328.84365 -465.11225 495.00962
## 22.75000      15.331634 -299.365977 330.02924 -465.95683 496.62010
## 22.76923      14.686940 -300.811268 330.18515 -467.82593 497.19981
## 22.78846      12.836945 -303.459834 329.13372 -470.89724 496.57113
## 22.80769      10.261386 -306.831953 327.35473 -474.69103 495.21380
## 22.82692      12.197744 -305.690159 330.08565 -473.96985 498.36534
## 22.84615       9.062480 -309.618006 327.74297 -478.31726 496.44222
## 22.86538       9.954094 -309.517009 329.42520 -478.63479 498.54298
## 22.88462       8.534580 -311.725188 328.79435 -481.26047 498.32963
## 22.90385       6.306587 -314.739907 327.35308 -484.69166 497.30483
## 22.92308       6.903937 -314.927362 328.73524 -485.29456 499.10243
## 22.94231       8.607065 -314.007128 331.22126 -484.78877 502.00290
## 22.96154       9.105286 -314.289907 332.50048 -485.48498 503.69555
## 22.98077       9.996724 -314.177588 334.17104 -485.78510 505.77855
## 23.00000       8.715968 -316.235594 333.66753 -488.25456 505.68650
## 23.01923      11.473683 -314.253275 337.20064 -486.68271 509.63008
## 23.03846      12.690234 -313.810278 339.19075 -486.64921 512.02968
## 23.05769      13.899600 -313.372637 341.17184 -486.62009 514.41929
## 23.07692      16.961116 -311.081031 345.00326 -484.73605 518.65829
## 23.09615      16.480759 -312.329495 345.29101 -486.39113 519.35265
## 23.11538      17.832334 -311.744237 347.40891 -486.21154 521.87620
## 23.13462      18.764113 -311.576999 349.10522 -486.44902 523.97724
## 23.15385      26.709743 -304.394143 357.81363 -479.66995 533.08944
## 23.17308      28.497273 -303.367633 360.36218 -479.04630 536.04085
## 23.19231      28.501381 -304.122806 361.12557 -480.20341 537.20617
## 23.21154      37.269593 -296.112143 370.65133 -472.59377 547.13296
## 23.23077      41.589275 -292.548295 375.72684 -469.43004 552.60859
## 23.25000      50.852262 -284.039435 385.74396 -461.32039 563.02492
## 23.26923      52.182734 -283.461396 387.82686 -461.14067 565.50613
## 23.28846      48.694525 -287.700354 385.08941 -465.77705 563.16610
## 23.30769      55.367152 -281.776806 392.51111 -460.25004 570.98434
## 23.32692      54.139547 -283.751829 392.03092 -462.62072 570.89981
## 23.34615      48.165973 -290.471171 386.80312 -469.73485 566.06679
## 23.36538      55.360136 -284.021137 394.74141 -463.67873 574.39900
## 23.38462      46.707437 -293.416336 386.83121 -473.46699 566.88186
## 23.40385      45.568647 -295.296010 386.43330 -475.73886 566.87615
## 23.42308      38.847461 -302.756473 380.45139 -483.59067 561.28559
## 23.44231      37.876902 -304.464712 380.21852 -485.68942 561.44322
## 23.46154      38.788415 -304.289294 381.86612 -485.90366 563.48049
## 23.48077      35.295258 -308.516968 379.10748 -490.52017 561.11068
## 23.50000      31.113072 -313.432106 375.65825 -495.82331 558.04945
## 23.51923      32.212554 -313.064021 377.48913 -495.84240 560.26751
## 23.53846      26.354146 -319.652280 372.36057 -502.81702 555.52531
## 23.55769      22.835861 -323.898879 369.57060 -507.44916 553.12088
## 23.57692      22.313632 -325.147895 369.77516 -509.08292 553.71018
## 23.59615      18.756863 -329.429934 366.94366 -513.74889 551.26262
## 23.61538      19.823369 -329.087192 368.73393 -513.78929 553.43602
## 23.63462      20.761142 -328.871683 370.39397 -513.95612 555.47840
## 23.65385      22.688866 -327.664735 373.04247 -513.13073 558.50846
## 23.67308      19.673763 -331.399134 370.74666 -517.24590 556.59342
## 23.69231      17.354750 -334.435972 369.14547 -520.66273 555.37223
## 23.71154      16.323698 -336.183388 368.83078 -522.78937 555.43676
## 23.73077      14.948683 -338.273313 368.17068 -525.25774 555.15511
## 23.75000      15.331634 -338.603829 369.26710 -525.96594 556.62921
## 23.76923      14.686940 -339.960554 369.33443 -527.69960 557.07348
## 23.78846      12.836945 -342.521153 368.19504 -530.63637 556.31026
## 23.80769      10.261386 -345.805898 366.32867 -534.29653 554.81930
## 23.82692      12.197744 -344.577317 368.97281 -533.44263 557.83811
## 23.84615       9.062480 -348.418956 366.54392 -537.65820 555.78316
## 23.86538       9.954094 -348.232325 368.14051 -537.84476 557.75295
## 23.88462       8.534580 -350.355437 367.42460 -540.34034 557.40949
## 23.90385       6.306587 -353.285650 365.89882 -543.64228 556.25546
## 23.92308       6.903937 -353.389152 367.19703 -544.11679 557.92467
#RMSE = 12.31994
##Takeaways
#Out of all these models, the fitted multilinear regression model has the lowest RMSE. However, I believe it's predictions are too high due to the outliers in the model. I will not be choosing the ARIMA model as it's RMSE is the highest and the forecast is poor. Even though the Nueral Net model produced a lower RMSE, I don't trust the forecasting for further dates as the forecast begins to taper off.  I believe the best model here is the STL + ETS(A,Ad,N) Model produced from the forcasting of the Cases data in the MR data.
##Create forecasts for 'iq'
cases_iq_ts = ts(train_features_iq$Cases, frequency = 52)
##NeuralNet Model
cases_Neural_net_iq = nnetar(cases_iq_ts)
cases_neural_net_iq_fcast = forecast(cases_Neural_net_iq,h=156)
autoplot(cases_neural_net_iq_fcast)

summary(cases_neural_net_iq_fcast)
## 
## Forecast method: NNAR(5,1,4)[52]
## 
## Model Information:
## 
## Average of 20 networks, each of which is
## a 6-4-1 network with 33 weights
## options were - linear output units 
## 
## Error measures:
##                      ME     RMSE      MAE  MPE MAPE      MASE        ACF1
## Training set -0.0282793 4.778105 3.271654 -Inf  Inf 0.3463405 -0.06072723
## 
## Forecasts:
##        Point Forecast
## 10.962       3.693681
## 10.981       3.843078
## 11.000       4.474794
## 11.019       4.779534
## 11.038       4.979554
## 11.058       5.133735
## 11.077       5.241425
## 11.096       5.321422
## 11.115       5.337160
## 11.135       5.422483
## 11.154       5.556203
## 11.173       5.640845
## 11.192       5.717918
## 11.212       5.822794
## 11.231       5.863999
## 11.250       5.929014
## 11.269       5.975710
## 11.288       6.000264
## 11.308       6.026148
## 11.327       6.029139
## 11.346       5.904711
## 11.365       5.929799
## 11.385       5.915507
## 11.404       5.925699
## 11.423       5.924551
## 11.442       5.991292
## 11.462       6.035240
## 11.481       5.884084
## 11.500       5.829049
## 11.519       5.883243
## 11.538       5.812641
## 11.558       5.589723
## 11.577       5.268658
## 11.596       5.607028
## 11.615       5.393496
## 11.635       5.007640
## 11.654       4.754590
## 11.673       4.997808
## 11.692       4.982402
## 11.712       5.117317
## 11.731       5.081955
## 11.750       5.202432
## 11.769       5.201656
## 11.788       5.339345
## 11.808       5.469105
## 11.827       5.431755
## 11.846       5.473761
## 11.865       5.536080
## 11.885       5.492728
## 11.904       5.665762
## 11.923       5.745073
## 11.942       5.747239
## 11.962       5.787118
## 11.981       5.820565
## 12.000       5.824024
## 12.019       5.824649
## 12.038       5.825666
## 12.058       5.821960
## 12.077       5.815766
## 12.096       5.809639
## 12.115       5.804431
## 12.135       5.797258
## 12.154       5.788131
## 12.173       5.779182
## 12.192       5.769942
## 12.212       5.759478
## 12.231       5.750074
## 12.250       5.740390
## 12.269       5.731129
## 12.288       5.722673
## 12.308       5.714780
## 12.327       5.707921
## 12.346       5.705256
## 12.365       5.700977
## 12.385       5.697957
## 12.404       5.695036
## 12.423       5.692748
## 12.442       5.688759
## 12.462       5.684854
## 12.481       5.685885
## 12.500       5.686666
## 12.519       5.685295
## 12.538       5.686825
## 12.558       5.693779
## 12.577       5.706308
## 12.596       5.704760
## 12.615       5.713503
## 12.635       5.729915
## 12.654       5.747143
## 12.673       5.752663
## 12.692       5.761895
## 12.712       5.766174
## 12.731       5.771841
## 12.750       5.772568
## 12.769       5.774813
## 12.788       5.772614
## 12.808       5.768585
## 12.827       5.767070
## 12.846       5.764137
## 12.865       5.759955
## 12.885       5.758156
## 12.904       5.751470
## 12.923       5.745058
## 12.942       5.740090
## 12.962       5.734562
## 12.981       5.728853
## 13.000       5.724202
## 13.019       5.720125
## 13.038       5.716416
## 13.058       5.713280
## 13.077       5.710712
## 13.096       5.708560
## 13.115       5.706764
## 13.135       5.705360
## 13.154       5.704327
## 13.173       5.703587
## 13.192       5.703120
## 13.212       5.702928
## 13.231       5.702933
## 13.250       5.703128
## 13.269       5.703476
## 13.288       5.703941
## 13.308       5.704497
## 13.327       5.705111
## 13.346       5.705670
## 13.365       5.706265
## 13.385       5.706836
## 13.404       5.707391
## 13.423       5.707914
## 13.442       5.708467
## 13.462       5.709020
## 13.481       5.709442
## 13.500       5.709807
## 13.519       5.710178
## 13.538       5.710444
## 13.558       5.710498
## 13.577       5.710276
## 13.596       5.710246
## 13.615       5.709943
## 13.635       5.709301
## 13.654       5.708425
## 13.673       5.707676
## 13.692       5.706776
## 13.712       5.705935
## 13.731       5.705073
## 13.750       5.704352
## 13.769       5.703647
## 13.788       5.703112
## 13.808       5.702725
## 13.827       5.702391
## 13.846       5.702166
## 13.865       5.702065
## 13.885       5.701989
## 13.904       5.702091
## 13.923       5.702297
## 13.942       5.702558
##Multilinear Regression
Cases_Explanatory_iq_ts <- ts(Cases_Explanatory_iq, frequency = 52)
Cases_Explanatory_iq_ts %>%
  as.data.frame() %>%
  GGally::ggpairs()

Cases_MR_iq <- tslm(
  Cases ~ precip + temp + hmdty + stemp + sprecip,
  data=Cases_Explanatory_iq_ts)
summary(Cases_MR_iq)
## 
## Call:
## tslm(formula = Cases ~ precip + temp + hmdty + stemp + sprecip, 
##     data = Cases_Explanatory_iq_ts)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -11.609  -5.496  -2.735   1.642 105.902 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept) -7.979e+02  1.717e+02  -4.647 4.28e-06 ***
## precip      -4.718e-03  1.587e-02  -0.297    0.766    
## temp         2.652e+00  5.925e-01   4.475 9.41e-06 ***
## hmdty        4.034e-01  8.505e-02   4.743 2.73e-06 ***
## stemp       -7.269e-01  6.292e-01  -1.155    0.249    
## sprecip      1.980e-03  8.055e-03   0.246    0.806    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 10.5 on 512 degrees of freedom
## Multiple R-squared:  0.06072,    Adjusted R-squared:  0.05155 
## F-statistic:  6.62 on 5 and 512 DF,  p-value: 5.51e-06
autoplot(Cases_Explanatory_iq_ts[,'Cases'], series="Data") +
  autolayer(fitted(Cases_MR_iq), series="Fitted") +
  xlab("Year") + ylab("") +
  ggtitle("Cases of Dengue") +
  guides(colour=guide_legend(title=" "))

cbind(Data = Cases_Explanatory_iq_ts[,"Cases"],
      Fitted = fitted(Cases_MR_iq)) %>%
  as.data.frame() %>%
  ggplot(aes(x=Data, y=Fitted)) +
  geom_point() +
  ylab("Fitted (predicted values)") +
  xlab("Data (actual values)") +
  ggtitle("Cases of Dengue") +
  geom_abline(intercept=0, slope=1)

checkresiduals((Cases_MR_iq))

## 
##  Breusch-Godfrey test for serial correlation of order up to 103
## 
## data:  Residuals from Linear regression model
## LM test = 309.33, df = 103, p-value < 2.2e-16
View(Cases_MR_iq)
## Error in as.data.frame.default(x): cannot coerce class 'c("tslm", "lm")' to a data.frame
fcast.Cases_MR_iq_Fitted = forecast(Cases_MR_iq$fitted.values, 156)
fcast.Cases_MR_iq_data = forecast(Cases_MR_iq$x, 156)
autoplot(fcast.Cases_MR_iq_Fitted)

autoplot(fcast.Cases_MR_iq_data)

summary(fcast.Cases_MR_iq_Fitted)
## 
## Forecast method: STL +  ETS(A,Ad,N)
## 
## Model Information:
## ETS(A,Ad,N) 
## 
## Call:
##  ets(y = x, model = etsmodel, allow.multiplicative.trend = allow.multiplicative.trend) 
## 
##   Smoothing parameters:
##     alpha = 0.1213 
##     beta  = 1e-04 
##     phi   = 0.8353 
## 
##   Initial states:
##     l = 10.1605 
##     b = -1.021 
## 
##   sigma:  1.5797
## 
##      AIC     AICc      BIC 
## 3718.168 3718.332 3743.668 
## 
## Error measures:
##                      ME     RMSE      MAE      MPE     MAPE      MASE
## Training set 0.07560606 1.572072 1.199372 6.976239 44.50258 0.6521854
##                   ACF1
## Training set 0.1213823
## 
## Forecasts:
##          Point Forecast     Lo 80     Hi 80     Lo 95     Hi 95
## 10.96154       7.861522  5.837037  9.886008 4.7653387 10.957706
## 10.98077       5.689039  3.649683  7.728395 2.5701127  8.807965
## 11.00000       6.611982  4.557846  8.666117 3.4704519  9.753511
## 11.01923       6.393771  4.324947  8.462595 3.2297778  9.557765
## 11.03846       6.770376  4.686955  8.853796 3.5840591  9.956692
## 11.05769       7.404618  5.306694  9.502543 4.1961192 10.613118
## 11.07692       7.082337  4.969999  9.194675 3.8517951 10.312879
## 11.09615       6.838777  4.712117  8.965437 3.5863317 10.091222
## 11.11538       6.890423  4.749532  9.031314 3.6162124 10.164634
## 11.13462       8.417806  6.262773 10.572840 5.1219672 11.713646
## 11.15385       9.048581  6.879494 11.217669 5.7312487 12.365914
## 11.17308       8.069988  5.886934 10.253041 4.7312952 11.408680
## 11.19231       8.322491  6.125557 10.519425 4.9625706 11.682412
## 11.21154       8.906461  6.695731 11.117190 5.5254418 12.287480
## 11.23077       9.502352  7.277911 11.726793 6.1003628 12.904341
## 11.25000       9.690867  7.452797 11.928937 6.2680341 13.113700
## 11.26923      10.670385  8.418767 12.922003 7.2268326 14.113938
## 11.28846      11.413400  9.148315 13.678486 7.9492506 14.877550
## 11.30769      11.900042  9.621567 14.178517 8.4154149 15.384668
## 11.32692      12.011204  9.719417 14.302990 8.5062187 15.516189
## 11.34615      11.900303  9.595281 14.205325 8.3750766 15.425530
## 11.36538      11.912759  9.594577 14.230941 8.3674051 15.458112
## 11.38462      13.123807 10.792539 15.455076 9.5584395 16.689175
## 11.40385      12.385296 10.041014 14.729578 8.8000259 15.970566
## 11.42308      11.499970  9.142746 13.857194 7.8949066 15.105034
## 11.44231      12.026625  9.656529 14.396721 8.4018761 15.651374
## 11.46154      11.260319  8.877421 13.643218 7.6159908 14.904648
## 11.48077      10.059833  7.664200 12.455465 6.3960293 13.723636
## 11.50000      10.007545  7.599246 12.415845 6.3243695 13.690721
## 11.51923      10.906332  8.485432 13.327232 7.2038852 14.608779
## 11.53846      10.846305  8.412869 13.279740 7.1246860 14.567923
## 11.55769      11.268680  8.822773 13.714587 7.5279885 15.009372
## 11.57692      10.698289  8.239973 13.156604 6.9386200 14.457957
## 11.59615      10.448152  7.977490 12.918813 6.6696015 14.226702
## 11.61538      10.161569  7.678623 12.644514 6.3642311 13.958907
## 11.63462      10.785815  8.290645 13.280985 6.9697821 14.601848
## 11.65385      11.257951  8.750616 13.765285 7.4233138 15.092588
## 11.67308      11.490213  8.970773 14.009654 7.6370619 15.343365
## 11.69231      10.390191  7.858702 12.921679 6.5186135 14.261768
## 11.71154      10.547217  8.003738 13.090696 6.6573015 14.437133
## 11.73077      10.895416  8.340002 13.450830 6.9872477 14.803584
## 11.75000      10.730611  8.163318 13.297904 6.8042747 14.656947
## 11.76923      11.119713  8.540595 13.698830 7.1752927 15.064133
## 11.78846      11.098185  8.507297 13.689073 7.1357634 15.060607
## 11.80769      10.500377  7.897771 13.102983 6.5200352 14.480719
## 11.82692       9.965544  7.351274 12.579815 5.9673627 13.963726
## 11.84615       7.736484  5.110601 10.362368 3.7205420 11.752426
## 11.86538       8.485096  5.847651 11.122541 4.4514713 12.518720
## 11.88462       9.123173  6.474216 11.772130 5.0719430 13.174403
## 11.90385       8.642059  5.981641 11.302477 4.5733002 12.710818
## 11.92308       7.957647  5.285816 10.629478 3.8714342 12.043860
## 11.94231       8.054507  5.371312 10.737702 3.9509149 12.158099
## 11.96154       7.861701  5.167190 10.556212 3.7408024 11.982600
## 11.98077       5.689188  2.983409  8.394968 1.5510556  9.827321
## 12.00000       6.612106  3.895105  9.329108 2.4568114 10.767401
## 12.01923       6.393876  3.665698  9.122053 2.2214886 10.566262
## 12.03846       6.770463  4.031155  9.509770 2.5810538 10.959872
## 12.05769       7.404691  4.654299 10.155084 3.1983289 11.611054
## 12.07692       7.082398  4.320965  9.843831 2.8591502 11.305645
## 12.09615       6.838828  4.066398  9.611258 2.5987622 11.078893
## 12.11538       6.890465  4.107082  9.673848 2.6336484 11.147282
## 12.13462       8.417842  5.623549 11.212135 4.1443390 12.691345
## 12.15385       9.048611  6.243450 11.853772 4.7584871 13.338735
## 12.17308       8.070012  5.254025 10.886000 3.7633318 12.376693
## 12.19231       8.322512  5.495740 11.149284 3.9993378 12.645686
## 12.21154       8.906478  6.068963 11.743993 4.5668731 13.246083
## 12.23077       9.502366  6.654148 12.350584 5.1463925 13.858340
## 12.25000       9.690879  6.831998 12.549760 5.3185980 14.063160
## 12.26923      10.670395  7.800891 13.539899 6.2818673 15.058923
## 12.28846      11.413409  8.533321 14.293497 7.0086940 15.818124
## 12.30769      11.900049  9.009415 14.790682 7.4792061 16.320891
## 12.32692      12.011210  9.110069 14.912350 7.5742980 16.448121
## 12.34615      11.900308  8.988699 14.811918 7.4473856 16.353231
## 12.36538      11.912763  8.990722 14.834804 7.4438864 16.381639
## 12.38462      13.123810 10.191375 16.056246 8.6390371 17.608584
## 12.40385      12.385299  9.442506 15.328092 7.8846848 16.885913
## 12.42308      11.499972  8.546858 14.453087 6.9835730 16.016372
## 12.44231      12.026627  9.063227 14.990027 7.4944973 16.558757
## 12.46154      11.260321  8.286671 14.233971 6.7125154 15.808127
## 12.48077      10.059834  7.075969 13.043699 5.4964067 14.623262
## 12.50000      10.007547  7.013502 13.001591 5.4285503 14.586543
## 12.51923      10.906333  7.902143 13.910523 6.3118209 15.500845
## 12.53846      10.846305  7.832004 13.860607 6.2363294 15.456281
## 12.55769      11.268681  8.244302 14.293060 6.6432931 15.894069
## 12.57692      10.698289  7.663867 13.732712 6.0575403 15.339038
## 12.59615      10.448152  7.403719 13.492585 5.7920929 15.104211
## 12.61538      10.161569  7.107158 13.215981 5.4902502 14.832888
## 12.63462      10.785815  7.721458 13.850172 6.0992860 15.472345
## 12.65385      11.257951  8.183681 14.332221 6.5562607 15.959642
## 12.67308      11.490214  8.406062 14.574365 6.7734107 16.207016
## 12.69231      10.390191  7.296189 13.484192 5.6583239 15.122058
## 12.71154      10.547217  7.443397 13.651038 5.8003342 15.294101
## 12.73077      10.895416  7.781808 14.009024 6.1335640 15.657268
## 12.75000      10.730611  7.607246 13.853976 5.9538366 15.507385
## 12.76923      11.119713  7.986621 14.252804 6.3280630 15.911363
## 12.78846      11.098185  7.955397 14.240973 6.2917058 15.904664
## 12.80769      10.500377  7.347922 13.652832 5.6791137 15.321640
## 12.82692       9.965544  6.803453 13.127636 5.1295423 14.801546
## 12.84615       7.736484  4.564785 10.908184 2.8857883 12.587180
## 12.86538       8.485096  5.303817 11.666374 3.6197504 13.350441
## 12.88462       9.123173  5.932344 12.314001 4.2432217 14.003124
## 12.90385       8.642059  5.441709 11.842409 3.7475460 13.536572
## 12.92308       7.957647  4.747803 11.167490 3.0486150 12.866679
## 12.94231       8.054507  4.835198 11.273816 3.1309993 12.978015
## 12.96154       7.861701  4.632955 11.090447 2.9237596 12.799643
## 12.98077       5.689188  2.451032  8.927345 0.7368552 10.641521
## 13.00000       6.612106  3.364567  9.859646 1.6454237 11.578789
## 13.01923       6.393876  3.136980  9.650771 1.4128843 11.374867
## 13.03846       6.770463  3.504239 10.036687 1.7752042 11.765721
## 13.05769       7.404691  4.129165 10.680218 2.3952057 12.414177
## 13.07692       7.082398  3.797595 10.367200 2.0587257 12.106070
## 13.09615       6.838828  3.544775 10.132880 1.8010091 11.876646
## 13.11538       6.890465  3.587189 10.193742 1.8385399 11.942391
## 13.13462       8.417842  5.105367 11.730317 3.3518486 13.483835
## 13.15385       9.048611  5.726963 12.370259 3.9685889 14.128633
## 13.17308       8.070012  4.739217 11.400808 2.9760003 13.164025
## 13.19231       8.322512  4.982594 11.662430 3.2145480 13.430476
## 13.21154       8.906478  5.557462 12.255494 3.7846002 14.028356
## 13.23077       9.502366  6.144277 12.860455 4.3666123 14.638120
## 13.25000       9.690879  6.323742 13.058017 4.5412866 14.840472
## 13.26923      10.670395  7.294233 14.046557 5.5070011 15.833789
## 13.28846      11.413409  8.028247 14.798571 6.2362500 16.590568
## 13.30769      11.900049  8.505910 15.294187 6.7091614 17.090936
## 13.32692      12.011210  8.608118 15.414301 6.8066303 17.215789
## 13.34615      11.900308  8.488287 15.312329 6.6820728 17.118544
## 13.36538      11.912763  8.491836 15.333690 6.6809068 17.144619
## 13.38462      13.123810  9.694001 16.553620 7.8783693 18.369252
## 13.40385      12.385299  8.946629 15.823969 7.1263077 17.644290
## 13.42308      11.499972  8.052466 14.947479 6.2274659 16.772479
## 13.44231      12.026627  8.570306 15.482948 6.7406398 17.312614
## 13.46154      11.260321  7.795208 14.725434 5.9608874 16.559755
## 13.48077      10.059834  6.585951 13.533718 4.7469883 15.372680
## 13.50000      10.007547  6.524916 13.490178 4.6813220 15.333771
## 13.51923      10.906333  7.414976 14.397690 5.5667635 16.245903
## 13.53846      10.846305  7.346244 14.346366 5.4934239 16.199187
## 13.55769      11.268681  7.759938 14.777425 5.9025209 16.634841
## 13.57692      10.698289  7.180884 14.215694 5.3188829 16.077695
## 13.59615      10.448152  6.922108 13.974196 5.0555323 15.840772
## 13.61538      10.161569  6.626906 13.696232 4.7557684 15.567370
## 13.63462      10.785815  7.242554 14.329076 5.3668654 16.204765
## 13.65385      11.257951  7.706113 14.809789 5.8258839 16.690018
## 13.67308      11.490214  7.929819 15.050608 6.0450606 16.935366
## 13.69231      10.390191  6.821261 13.959121 4.9319837 15.848398
## 13.71154      10.547217  6.969772 14.124663 5.0759871 16.018448
## 13.73077      10.895416  7.309476 14.481357 5.4111936 16.379639
## 13.75000      10.730611  7.136195 14.325026 5.2334267 16.227795
## 13.76923      11.119713  7.516842 14.722584 5.6095977 16.629828
## 13.78846      11.098185  7.486879 14.709491 5.5751692 16.621201
## 13.80769      10.500377  6.880655 14.120099 4.9644904 16.036264
## 13.82692       9.965544  6.337426 13.593662 4.4168169 15.514272
## 13.84615       7.736484  4.099990 11.372979 2.1749456 13.298023
## 13.86538       8.485096  4.840244 12.129948 2.9107755 14.059416
## 13.88462       9.123173  5.469982 12.776363 3.5360999 14.710246
## 13.90385       8.642059  4.980549 12.303569 3.0422627 14.241855
## 13.92308       7.957647  4.287836 11.627458 2.3451559 13.570138
## 13.94231       8.054507  4.376415 11.732600 2.4293502 13.679664
summary(fcast.Cases_MR_iq_data)
## 
## Forecast method: STL +  ETS(A,N,N)
## 
## Model Information:
## ETS(A,N,N) 
## 
## Call:
##  ets(y = x, model = etsmodel, allow.multiplicative.trend = allow.multiplicative.trend) 
## 
##   Smoothing parameters:
##     alpha = 0.67 
## 
##   Initial states:
##     l = 2.5384 
## 
##   sigma:  6.6773
## 
##      AIC     AICc      BIC 
## 5208.544 5208.591 5221.294 
## 
## Error measures:
##                      ME     RMSE      MAE MPE MAPE      MASE       ACF1
## Training set 0.01886702 6.664356 3.874579 NaN  Inf 0.4101667 0.06661059
## 
## Forecasts:
##          Point Forecast      Lo 80    Hi 80       Lo 95     Hi 95
## 10.96154       3.676802  -4.880450 12.23405   -9.410386  16.76399
## 10.98077       2.543711  -7.756658 12.84408  -13.209344  18.29677
## 11.00000       4.521912  -7.266584 16.31041  -13.507038  22.55086
## 11.01923       2.617786 -10.490979 15.72655  -17.430340  22.66591
## 11.03846       4.536182  -9.771535 18.84390  -17.345583  26.41795
## 11.05769       4.497052 -10.916637 19.91074  -19.076152  28.07026
## 11.07692       3.820142 -12.625309 20.26559  -21.331005  28.97129
## 11.09615       3.994859 -13.421338 21.41106  -22.640916  30.63063
## 11.11538       5.074665 -13.260955 23.41029  -22.967246  33.11658
## 11.13462       3.457130 -15.753961 22.66822  -25.923699  32.83796
## 11.15385       4.027373 -16.020995 24.07574  -26.633960  34.68871
## 11.17308       7.071565 -13.780489 27.92362  -24.818899  38.96203
## 11.19231       5.870002 -15.755889 27.49589  -27.203944  38.94395
## 11.21154       7.058102 -15.314878 29.43108  -27.158418  41.27462
## 11.23077      11.914687 -11.181227 35.01060  -23.407466  47.23684
## 11.25000      11.320448 -12.476449 35.11735  -25.073766  47.71466
## 11.26923      14.458518 -10.019296 38.93633  -22.977068  51.89410
## 11.28846      12.254459 -12.885836 37.39475  -26.194305  50.70322
## 11.30769      14.998777 -10.786984 40.78454  -24.437141  54.43470
## 11.32692      11.637932 -14.777528 38.05339  -28.761028  52.03689
## 11.34615       9.806482 -17.224012 36.83698  -31.533091  51.14605
## 11.36538      12.908913 -14.722928 40.54075  -29.350341  55.16817
## 11.38462      11.185672 -17.034705 39.40605  -31.973670  54.34501
## 11.40385      10.117423 -18.679464 38.91431  -33.923616  54.15846
## 11.42308      20.142153  -9.219928 49.50423  -24.763274  65.04758
## 11.44231      19.494958 -10.421640 49.41156  -26.258531  65.24845
## 11.46154       7.052921 -23.408101 37.51394  -39.533193  53.63903
## 11.48077       8.832256 -22.163630 39.82814  -38.571861  56.23637
## 11.50000      19.434180 -12.087495 50.95585  -28.774062  67.64242
## 11.51923      13.662272 -18.376565 45.70111  -35.336900  62.66144
## 11.53846      18.071334 -14.476448 50.61912  -31.706202  67.84887
## 11.55769      19.002181 -14.046710 52.05107  -31.541735  69.54610
## 11.57692      20.779069 -12.763444 54.32158  -30.519778  72.07792
## 11.59615      15.231648 -18.797328 49.26062  -36.811180  67.27448
## 11.61538      15.636459 -18.872124 50.14504  -37.139865  68.41278
## 11.63462      14.316626 -20.664988 49.29824  -39.183137  67.81639
## 11.65385      12.385391 -23.062944 47.83372  -41.828158  66.59894
## 11.67308       9.874734 -26.034255 45.78372  -45.043325  64.79279
## 11.69231       6.909761 -29.454046 43.27357  -48.703883  62.52341
## 11.71154       6.459277 -30.353731 43.27229  -49.841360  62.75991
## 11.73077       9.362247 -27.894546 46.61904  -47.617100  66.34159
## 11.75000       6.677778 -31.017575 44.37313  -50.972289  64.32785
## 11.76923       5.939105 -32.189765 44.06797  -52.373970  64.25218
## 11.78846       5.758573 -32.798939 44.31609  -53.210053  64.72720
## 11.80769       3.567751 -35.413691 42.54919  -56.049220  63.18472
## 11.82692       6.002092 -33.398718 45.40290  -54.256247  66.26043
## 11.84615       5.406532 -34.409230 45.22229  -55.486421  66.29949
## 11.86538       4.259473 -35.966961 44.48591  -57.261549  65.78049
## 11.88462       5.178962 -35.453993 45.81192  -56.963780  67.32170
## 11.90385       3.483072 -37.552377 44.51852  -59.275232  66.24138
## 11.92308       3.275785 -38.158249 44.70982  -60.092101  66.64367
## 11.94231       3.091513 -38.737306 44.92033  -60.880146  67.06317
## 11.96154       3.676802 -38.543113 45.89672  -60.892986  68.24659
## 11.98077       2.543711 -40.063709 45.15113  -62.618715  67.70614
## 12.00000       4.521912 -38.469521 47.51335  -61.227811  70.27164
## 12.01923       2.617786 -40.754260 45.98983  -63.714035  68.94961
## 12.03846       4.536182 -39.213166 48.28553  -62.372672  71.44504
## 12.05769       4.497052 -39.626372 48.62047  -62.983901  71.97800
## 12.07692       3.820142 -40.674212 48.31450  -64.228100  71.86838
## 12.09615       3.994859 -40.867359 48.85708  -64.615982  72.60570
## 12.11538       5.074665 -40.152425 50.30175  -64.094200  74.24353
## 12.13462       3.457130 -42.131912 49.04617  -66.265292  73.17955
## 12.15385       4.027373 -41.920769 49.97551  -66.244246  74.29899
## 12.17308       7.071565 -39.232893 53.37602  -63.744992  77.88812
## 12.19231       5.870002 -40.788050 52.52805  -65.487331  77.22734
## 12.21154       7.058102 -39.950886 54.06709  -64.835940  78.95214
## 12.23077      11.914687 -35.442635 59.27201  -60.512086  84.34146
## 12.25000      11.320448 -36.382665 59.02356  -61.635168  84.27606
## 12.26923      14.458518 -33.587897 62.50493  -59.022133  87.93917
## 12.28846      12.254459 -36.132824 60.64174  -61.747504  86.25642
## 12.30769      14.998777 -33.726988 63.72454  -59.520849  89.51840
## 12.32692      11.637932 -37.423980 60.69984  -63.395787  86.67165
## 12.34615       9.806482 -39.589290 59.20225  -65.737832  85.35080
## 12.36538      12.908913 -36.818477 62.63630  -63.142567  88.96039
## 12.38462      11.185672 -38.871139 61.24248  -65.369614  87.74096
## 12.40385      10.117423 -40.266655 60.50150  -66.938376  87.17322
## 12.42308      20.142153 -30.567081 70.85139  -57.410929  97.69523
## 12.44231      19.494958 -31.537361 70.52728  -58.552238  97.54215
## 12.46154       7.052921 -44.300448 58.40629  -71.485280  85.59112
## 12.48077       8.832256 -42.840170 60.50468  -70.193900  87.85841
## 12.50000      19.434180 -32.555345 71.42370  -60.076937  98.94530
## 12.51923      13.662272 -38.642429 65.96697  -66.330865  93.65541
## 12.53846      18.071334 -34.546655 70.68932  -62.400936  98.54360
## 12.55769      19.002181 -33.927242 71.93160  -61.946386  99.95075
## 12.57692      20.779069 -32.459966 74.01810  -60.643008 102.20115
## 12.59615      15.231648 -38.315209 68.77851  -66.661203  97.12450
## 12.61538      15.636459 -38.216461 69.48938  -66.724475  97.99739
## 12.63462      14.316626 -39.840627 68.47388  -68.509744  97.14300
## 12.65385      12.385391 -42.074494 66.84528  -70.903816  95.67460
## 12.67308       9.874734 -44.886111 64.63558  -73.874751  93.62422
## 12.69231       6.909761 -48.150398 61.96992  -77.297486  91.11701
## 12.71154       6.459277 -48.898579 61.81713  -78.203258  91.12181
## 12.73077       9.362247 -46.291713 65.01621  -75.753140  94.47763
## 12.75000       6.677778 -49.270719 62.62628  -78.888064  92.24362
## 12.76923       5.939105 -50.302387 62.18060  -80.074834  91.95304
## 12.78846       5.758573 -50.774394 62.29154  -80.701140  92.21829
## 12.80769       3.567751 -53.255198 60.39070  -83.335449  90.47095
## 12.82692       6.002092 -51.109365 63.11355  -81.342344  93.34653
## 12.84615       5.406532 -51.991983 62.80505  -82.376922  93.18999
## 12.86538       4.259473 -53.424673 61.94362  -83.960815  92.47976
## 12.88462       5.178962 -52.789406 63.14733  -83.476007  93.83393
## 12.90385       3.483072 -54.768132 61.73428  -85.604456  92.57060
## 12.92308       3.275785 -55.256888 61.80846  -86.242213  92.79378
## 12.94231       3.091513 -55.721281 61.90431  -86.854894  93.03792
## 12.96154       3.676802 -55.414787 62.76839  -86.695985  94.04959
## 12.98077       2.543711 -56.825363 61.91279  -88.253452  93.34087
## 13.00000       4.521912 -55.123355 64.16718  -86.697653  95.74148
## 13.01923       2.617786 -57.302403 62.53797  -89.022235  94.25781
## 13.03846       4.536182 -55.657673 64.73004  -87.522374  96.59474
## 13.05769       4.497052 -55.969229 64.96333  -87.978145  96.97225
## 13.07692       3.820142 -56.917344 64.55763  -89.069827  96.71011
## 13.09615       3.994859 -57.012626 65.00234  -89.308038  97.29776
## 13.11538       5.074665 -56.201630 66.35096  -88.639341  98.78867
## 13.13462       3.457130 -58.086801 65.00106  -90.666189  97.58045
## 13.15385       4.027373 -57.783034 65.83778  -90.503487  98.55823
## 13.17308       7.071565 -55.004175 69.14730  -87.865087 102.00822
## 13.19231       5.870002 -56.469941 68.20995  -89.470713 101.21072
## 13.21154       7.058102 -55.544930 69.66113  -88.684973 102.80118
## 13.23077      11.914687 -50.950332 74.77971  -84.229062 108.05844
## 13.25000      11.320448 -51.805471 74.44637  -85.222314 107.86321
## 13.26923      14.458518 -48.927227 77.84426  -82.481613 111.39865
## 13.28846      12.254459 -51.390052 75.89897  -85.081421 109.59034
## 13.30769      14.998777 -48.903451 78.90101  -82.731248 112.72880
## 13.32692      11.637932 -52.520979 75.79684  -86.484655 109.76052
## 13.34615       9.806482 -54.608089 74.22105  -88.707103 108.32007
## 13.36538      12.908913 -51.760306 77.57813  -85.994123 111.81195
## 13.38462      11.185672 -53.737198 76.10854  -88.105289 110.47663
## 13.40385      10.117423 -55.058109 75.29296  -89.559952 109.79480
## 13.42308      20.142153 -45.285067 85.56937  -79.920145 120.20445
## 13.44231      19.494958 -46.182985 85.17290  -80.950788 119.94070
## 13.46154       7.052921 -58.874791 72.98063  -93.774814 107.88066
## 13.48077       8.832256 -57.344283 75.00879  -92.376026 110.04054
## 13.50000      19.434180 -46.990254 85.85861  -82.153224 121.02158
## 13.51923      13.662272 -53.009134 80.33368  -88.302845 115.62739
## 13.53846      18.071334 -48.846133 84.98880  -84.270100 120.41277
## 13.55769      19.002181 -48.160446 86.16481  -83.714193 121.71855
## 13.57692      20.779069 -46.627826 88.18596  -82.310881 123.86902
## 13.59615      15.231648 -52.418633 82.88193  -88.230529 118.69383
## 13.61538      15.636459 -52.256336 83.52925  -88.196611 119.46953
## 13.63462      14.316626 -53.817820 82.45107  -89.886016 118.51927
## 13.65385      12.385391 -55.989852 80.76063  -92.185518 116.95630
## 13.67308       9.874734 -58.740460 78.48993  -95.063149 114.81262
## 13.69231       6.909761 -61.944548 75.76407  -98.393817 112.21334
## 13.71154       6.459277 -62.633319 75.55187  -99.208731 112.12728
## 13.73077       9.362247 -59.967818 78.69231  -96.668937 115.39343
## 13.75000       6.677778 -62.888945 76.24450  -99.715344 113.07090
## 13.76923       5.939105 -63.863474 75.74168 -100.814728 112.69294
## 13.78846       5.758573 -64.279067 75.79621 -101.354755 112.87190
## 13.80769       3.567751 -66.704165 73.83967 -103.903870 111.03937
## 13.82692       6.002092 -64.503320 76.50750 -101.826631 113.83082
## 13.84615       5.406532 -65.331606 76.14467 -102.778115 113.59118
## 13.86538       4.259473 -66.710629 75.22957 -104.279931 112.79888
## 13.88462       5.178962 -66.022347 76.38027 -103.714043 114.07197
## 13.90385       3.483072 -67.948696 74.91484 -105.762389 112.72853
## 13.92308       3.275785 -68.385700 74.93727 -106.320999 112.87257
## 13.94231       3.091513 -68.798955 74.98198 -106.855471 113.03850
View(fcast.Cases_MR_iq_data)
##Transfer Forecast Data (STL)
write.csv(fcast.Cases_MR_data, 'predictions.csv', row.names = FALSE)
write.csv(fcast.Cases_MR_iq_data, 'predictions_iq.csv', row.names = FALSE)
##Transfer Forecast Data (MR Fitted)
write.csv(fcast.Cases_MR_Fitted, 'predictions_MRsj.csv', row.names = FALSE)
write.csv(fcast.Cases_MR_iq_Fitted, 'predictions_MRiq.csv', row.names = FALSE)
##Tranfer Forecast Data (Neural Net)
write.csv(cases_neural_net_fcast, 'predictions_NeuralNetsj.csv', row.names = FALSE)
write.csv(cases_neural_net_iq_fcast, 'predictions_NeuralNetiq.csv', row.names = FALSE)