Forecasting a Stock’s Closing Price:

The report below details a exploratory analysis of the target stock performance over the past 5 years. The forecast is produced using R to fit three Bayesian structural time series models. The data consists of a .xts times series dataset available through “Yahoo Finance”.

Understand the SP500 Stocks & Extract Stock Symbol…

## 'data.frame':    505 obs. of  9 variables:
##  $ Symbol                : chr  "MMM" "ABT" "ABBV" "ABMD" ...
##  $ Security              : chr  "3M Company" "Abbott Laboratories" "AbbVie Inc." "ABIOMED Inc" ...
##  $ SEC.filings           : chr  "reports" "reports" "reports" "reports" ...
##  $ GICS.Sector           : chr  "Industrials" "Health Care" "Health Care" "Health Care" ...
##  $ GICS.Sub.Industry     : chr  "Industrial Conglomerates" "Health Care Equipment" "Pharmaceuticals" "Health Care Equipment" ...
##  $ Headquarters.Location : chr  "St. Paul, Minnesota" "North Chicago, Illinois" "North Chicago, Illinois" "Danvers, Massachusetts" ...
##  $ Date.first.added.3..4.: chr  "" "1964-03-31" "2012-12-31" "2018-05-31" ...
##  $ CIK                   : int  66740 1800 1551152 815094 1467373 718877 796343 2488 1158449 874761 ...
##  $ Founded               : chr  "1902" "1888" "2013 (1888)" "1981" ...
## [1] "GOOG"
## [1] "Communication Services"
## [1] "Interactive Media & Services"

Import the Stock Dataset…

## [1] "GOOG"
## An 'xts' object on 2014-01-17/2019-01-15 containing:
##   Data: num [1:1257, 1:6] 575 577 580 576 572 ...
##  - attr(*, "dimnames")=List of 2
##   ..$ : NULL
##   ..$ : chr [1:6] "GOOG.Open" "GOOG.High" "GOOG.Low" "GOOG.Close" ...
##   Indexed by objects of class: [Date] TZ: UTC
##   xts Attributes:  
## List of 2
##  $ src    : chr "yahoo"
##  $ updated: POSIXct[1:1], format: "2019-01-16 02:08:16"

Exploratory Analysis of Stock Dataset…

Exploratory Analysis of stock dataset - Open Price:

Exploratory Analysis of stock dataset - Close Price:

Exploratory Analysis of stock dataset - High Price:

Exploratory Analysis of stock dataset - Low Price:

Exploratory Analysis of stock dataset - Volume:

Exploratory Analysis of stock dataset - Candle Chart - SMA = 20:

Exploratory Analysis of stock dataset - TA: Added Bollinger Bands, Volume, and Moving Average Convergence Divergence (MACD) plots:

Exploratory Analysis of stock dataset - Calculate some predictor variables to add to the stock dataset:

## An 'xts' object on 2014-03-31/2019-01-15 containing:
##   Data: num [1:1208, 1:18] 564 556 597 567 572 ...
##  - attr(*, "dimnames")=List of 2
##   ..$ : NULL
##   ..$ : chr [1:18] "Open" "High" "Low" "Close" ...
##   Indexed by objects of class: [Date] TZ: UTC
##   xts Attributes:  
## List of 2
##  $ src    : chr "yahoo"
##  $ updated: POSIXct[1:1], format: "2019-01-16 02:08:16"
##                Open     High      Low    Close  Volume Adjusted
## 2014-03-31 563.7900 563.8994 553.8845 553.9243   10800 553.9243
## 2014-04-01 555.6547 565.3414 555.6547 564.0585    7900 564.0585
## 2014-04-02 596.7090 601.5225 559.1157 563.8994  147500 563.8994
## 2014-04-03 566.7338 584.0685 561.0450 566.6244 5113100 566.6244
## 2014-04-04 571.5076 574.6105 540.0306 540.1699 6386800 540.1699
## 2014-04-07 537.7830 545.4807 524.2673 535.2072 4413700 535.2072
##            daily.returns      atr       SMI      ADX oscillator
## 2014-03-31 -0.0053929421 10.82747 -33.53977 23.15336        -70
## 2014-04-01  0.0182954220 10.86959 -36.29836 25.08085        -70
## 2014-04-02 -0.0002822048 13.12225 -37.82165 23.82583        -70
## 2014-04-03  0.0048324883 13.82948 -38.12098 22.66045        -70
## 2014-04-04 -0.0466879461 15.31165 -43.19195 22.08344       -100
## 2014-04-07 -0.0091873101 15.73320 -47.30844 22.41628       -100
##                   pctB Delt.1.arithmetic        EMA     maEMV     signal
## 2014-03-31  0.02191260       -0.16519216 -0.5199409 -18.88975 -0.3883305
## 2014-04-01  0.13616488       -0.15804341 -0.2917477 -16.70284 -0.5884175
## 2014-04-02  0.35081510        2.20258964 -0.3795010 -10.37021 -0.7508086
## 2014-04-03  0.30677904        0.21422460 -0.4041978 -10.40161 -0.8718126
## 2014-04-04  0.06392328        0.09890972 -0.5110614 -10.43979 -1.0328525
## 2014-04-07 -0.07085107       -0.28911978 -0.4124297 -10.55061 -1.2229632
##                   mfi      sar
## 2014-03-31 16.0881151 582.4584
## 2014-04-01 17.4870427 577.8929
## 2014-04-02 19.7588157 553.9243
## 2014-04-03 19.5890639 553.9243
## 2014-04-04  8.9083640 601.5225
## 2014-04-07  0.4320798 601.5225

Exploratory Analysis of stock dataset - Volume:

Exploratory Analysis of stock dataset - Scatterplot Matrix:

Train a Bayesian Nowcasting Structural Time Series Model to Forecast Close Price…

## =-=-=-=-= Iteration 0 Wed Jan 16 02:09:09 2019
##  =-=-=-=-=
## =-=-=-=-= Iteration 10 Wed Jan 16 02:09:10 2019
##  =-=-=-=-=
## =-=-=-=-= Iteration 20 Wed Jan 16 02:09:12 2019
##  =-=-=-=-=
## =-=-=-=-= Iteration 30 Wed Jan 16 02:09:13 2019
##  =-=-=-=-=
## =-=-=-=-= Iteration 40 Wed Jan 16 02:09:14 2019
##  =-=-=-=-=
## =-=-=-=-= Iteration 50 Wed Jan 16 02:09:15 2019
##  =-=-=-=-=
## =-=-=-=-= Iteration 60 Wed Jan 16 02:09:16 2019
##  =-=-=-=-=
## =-=-=-=-= Iteration 70 Wed Jan 16 02:09:17 2019
##  =-=-=-=-=
## =-=-=-=-= Iteration 80 Wed Jan 16 02:09:18 2019
##  =-=-=-=-=
## =-=-=-=-= Iteration 90 Wed Jan 16 02:09:19 2019
##  =-=-=-=-=
## $residual.sd
## [1] 4.653731
## 
## $prediction.sd
## [1] 12.45421
## 
## $rsquare
## [1] 0.9995363
## 
## $relative.gof
## [1] -0.02596728

Plot Model

##  [1] "sigma.obs"                  "trend.level.sd"            
##  [3] "trend.slope.mean"           "trend.slope.ar.coefficient"
##  [5] "trend.slope.sd"             "sigma.seasonal.54"         
##  [7] "final.state"                "state.contributions"       
##  [9] "one.step.prediction.errors" "log.likelihood"            
## [11] "has.regression"             "state.specification"       
## [13] "prior"                      "timestamp.info"            
## [15] "model.options"              "family"                    
## [17] "niter"                      "original.series"

Create Prediction of Close Price Using the Nowcasting Model…

## List of 5
##  $ mean           : num [1:20] 1076 1075 1076 1073 1076 ...
##  $ median         : num [1:20] 1077 1074 1076 1074 1075 ...
##  $ interval       : num [1:2, 1:20] 1053 1091 1050 1097 1046 ...
##   ..- attr(*, "dimnames")=List of 2
##   .. ..$ : chr [1:2] "5%" "95%"
##   .. ..$ : NULL
##  $ distribution   : num [1:90, 1:20] 1080 1082 1084 1099 1090 ...
##  $ original.series:'zoo' series from 2014-03-31 to 2019-01-15
##   Data: num [1:1208] 554 564 564 567 540 ...
##   Index:  Date[1:1208], format: "2014-03-31" "2014-04-01" ...
##  - attr(*, "class")= chr "bsts.prediction"

Summary of Prediction:

summary(pred)
##                 Length Class  Mode   
## mean              20   -none- numeric
## median            20   -none- numeric
## interval          40   -none- numeric
## distribution    1800   -none- numeric
## original.series 1208   zoo    numeric

Plot the Mean:

par(mfrow=c(2,2))
plot(pred$original.series)
plot(pred$mean)
plot(pred$median)
plot(pred$interval)

Plot Prediction:

plot(pred, plot.original = 20)

Nowcasting Prediction Table

tail(pred$original.series)
## 2019-01-08 2019-01-09 2019-01-10 2019-01-11 2019-01-14 2019-01-15 
##    1076.28    1074.66    1070.33    1057.19    1044.69    1077.15
head(pred$mean)
## [1] 1076.096 1074.938 1075.674 1073.444 1076.323 1078.456
head(pred$median)
## [1] 1077.000 1073.501 1075.783 1073.786 1075.277 1079.716
head(pred$interval)
##         [,1]     [,2]     [,3]     [,4]     [,5]     [,6]     [,7]
## 5%  1053.291 1050.253 1045.771 1040.191 1042.209 1040.844 1037.484
## 95% 1090.687 1097.167 1098.795 1103.192 1111.731 1116.211 1120.822
##         [,8]     [,9]    [,10]    [,11]    [,12]    [,13]    [,14]
## 5%  1037.422 1038.771 1038.805 1026.418 1024.441 1020.323 1020.174
## 95% 1120.207 1134.213 1128.781 1136.509 1137.636 1148.233 1158.923
##        [,15]    [,16]    [,17]    [,18]    [,19]    [,20]
## 5%  1009.938 1013.055 1009.121 1010.848 1006.712 1011.248
## 95% 1155.656 1155.984 1159.226 1158.208 1159.771 1159.111

Train a Bayesian Regression Structural Time Series Model to Forecast Close Price…

## =-=-=-=-= Iteration 0 Wed Jan 16 02:09:23 2019
##  =-=-=-=-=
## =-=-=-=-= Iteration 10 Wed Jan 16 02:09:24 2019
##  =-=-=-=-=
## =-=-=-=-= Iteration 20 Wed Jan 16 02:09:25 2019
##  =-=-=-=-=
## =-=-=-=-= Iteration 30 Wed Jan 16 02:09:26 2019
##  =-=-=-=-=
## =-=-=-=-= Iteration 40 Wed Jan 16 02:09:27 2019
##  =-=-=-=-=
## =-=-=-=-= Iteration 50 Wed Jan 16 02:09:28 2019
##  =-=-=-=-=
## =-=-=-=-= Iteration 60 Wed Jan 16 02:09:29 2019
##  =-=-=-=-=
## =-=-=-=-= Iteration 70 Wed Jan 16 02:09:30 2019
##  =-=-=-=-=
## =-=-=-=-= Iteration 80 Wed Jan 16 02:09:32 2019
##  =-=-=-=-=
## =-=-=-=-= Iteration 90 Wed Jan 16 02:09:33 2019
##  =-=-=-=-=
## $residual.sd
## [1] 2.347485
## 
## $prediction.sd
## [1] 7.695103
## 
## $rsquare
## [1] 0.999882
## 
## $relative.gof
## [1] 0.6083241
## 
## $size
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##     1.0     1.0     4.0     2.9     4.0     6.0 
## 
## $coefficients
##                            mean           sd      mean.inc      sd.inc
## daily.returns      3.658029e+02 5.077317e+01 365.802864827 50.77317322
## EMA                5.744693e+00 4.861029e+00   9.232542779  2.33447809
## sar               -6.248684e-02 6.632812e-02  -0.108150306  0.05140105
## Adjusted           5.981886e-02 6.630046e-02   0.119637730  0.03965051
## Low                1.502880e-03 6.369351e-03   0.016907400  0.01476968
## High               9.374259e-04 5.313597e-03   0.016873667  0.01709049
## Open              -5.790669e-05 3.594042e-03  -0.001302900  0.01952039
## SMI               -5.994437e-05 5.686822e-04  -0.005394993  0.00000000
## mfi                0.000000e+00 0.000000e+00   0.000000000  0.00000000
## signal             0.000000e+00 0.000000e+00   0.000000000  0.00000000
## maEMV              0.000000e+00 0.000000e+00   0.000000000  0.00000000
## Delt.1.arithmetic  0.000000e+00 0.000000e+00   0.000000000  0.00000000
## pctB               0.000000e+00 0.000000e+00   0.000000000  0.00000000
## oscillator         0.000000e+00 0.000000e+00   0.000000000  0.00000000
## ADX                0.000000e+00 0.000000e+00   0.000000000  0.00000000
## atr                0.000000e+00 0.000000e+00   0.000000000  0.00000000
## Volume             0.000000e+00 0.000000e+00   0.000000000  0.00000000
## (Intercept)        0.000000e+00 0.000000e+00   0.000000000  0.00000000
##                     inc.prob
## daily.returns     1.00000000
## EMA               0.62222222
## sar               0.57777778
## Adjusted          0.50000000
## Low               0.08888889
## High              0.05555556
## Open              0.04444444
## SMI               0.01111111
## mfi               0.00000000
## signal            0.00000000
## maEMV             0.00000000
## Delt.1.arithmetic 0.00000000
## pctB              0.00000000
## oscillator        0.00000000
## ADX               0.00000000
## atr               0.00000000
## Volume            0.00000000
## (Intercept)       0.00000000

Parameter Estimates: (Sample mean of the Sampled beta value)

##       (Intercept)              Open              High               Low 
##      0.000000e+00     -5.211602e-05      8.436833e-04      1.352592e-03 
##            Volume          Adjusted     daily.returns               atr 
##      0.000000e+00      5.383698e-02      3.451865e+02      0.000000e+00 
##               SMI               ADX        oscillator              pctB 
##     -5.394993e-05      0.000000e+00      0.000000e+00      0.000000e+00 
## Delt.1.arithmetic               EMA             maEMV            signal 
##      0.000000e+00      5.170224e+00      0.000000e+00      0.000000e+00 
##               mfi               sar 
##      0.000000e+00     -5.623816e-02

Plot Model

##  [1] "coefficients"               "sigma.obs"                 
##  [3] "trend.level.sd"             "trend.slope.mean"          
##  [5] "trend.slope.ar.coefficient" "trend.slope.sd"            
##  [7] "sigma.seasonal.54"          "final.state"               
##  [9] "state.contributions"        "one.step.prediction.errors"
## [11] "log.likelihood"             "has.regression"            
## [13] "state.specification"        "prior"                     
## [15] "timestamp.info"             "model.options"             
## [17] "family"                     "niter"                     
## [19] "original.series"            "xlevels"                   
## [21] "terms"                      "predictors"

Create Prediction of Close Price Using the Regression Model…

## List of 5
##  $ mean           : num [1:91] 1048 1046 1049 1051 1062 ...
##  $ median         : num [1:91] 1048 1046 1049 1051 1062 ...
##  $ interval       : num [1:2, 1:91] 1044 1053 1039 1052 1040 ...
##   ..- attr(*, "dimnames")=List of 2
##   .. ..$ : chr [1:2] "5%" "95%"
##   .. ..$ : NULL
##  $ distribution   : num [1:2, 1:91] 1043 1054 1038 1053 1039 ...
##  $ original.series:'zoo' series from 2014-03-31 to 2019-01-15
##   Data: num [1:1208] 554 564 564 567 540 ...
##   Index:  Date[1:1208], format: "2014-03-31" "2014-04-01" ...
##  - attr(*, "class")= chr "bsts.prediction"

Summary of Prediction:

summary(pred)
##                 Length Class  Mode   
## mean              91   -none- numeric
## median            91   -none- numeric
## interval         182   -none- numeric
## distribution     182   -none- numeric
## original.series 1208   zoo    numeric

Plot the Mean:

par(mfrow=c(2,2))
plot(pred$original.series)
plot(pred$mean)
plot(pred$median)
plot(pred$interval)

Plot Prediction:

plot(pred, plot.original = 90)

Regression Model Prediction Table

tail(pred$original.series)
## 2019-01-08 2019-01-09 2019-01-10 2019-01-11 2019-01-14 2019-01-15 
##    1076.28    1074.66    1070.33    1057.19    1044.69    1077.15
head(pred$mean)
## [1] 1048.420 1045.581 1048.682 1051.084 1061.686 1050.594
head(pred$median)
## [1] 1048.420 1045.581 1048.682 1051.084 1061.686 1050.594
head(pred$interval)
##         [,1]     [,2]     [,3]     [,4]     [,5]     [,6]     [,7]
## 5%  1043.832 1039.047 1039.921 1043.459 1048.729 1035.796 1049.782
## 95% 1053.008 1052.114 1057.442 1058.710 1074.644 1065.392 1079.228
##         [,8]     [,9]    [,10]    [,11]    [,12]    [,13]    [,14]
## 5%  1048.606 1036.892 1045.919 1045.920 1046.745 1045.646 1059.720
## 95% 1077.441 1068.804 1069.930 1078.355 1079.988 1069.143 1078.993
##        [,15]    [,16]    [,17]    [,18]    [,19]    [,20]    [,21]
## 5%  1068.039 1054.509 1058.169 1048.628 1037.033 1039.961 1041.822
## 95% 1084.141 1082.167 1098.429 1087.218 1078.623 1085.162 1080.901
##        [,22]    [,23]    [,24]    [,25]     [,26]    [,27]   [,28]
## 5%  1013.305 1020.731 1019.097 1015.285  990.2831 1010.021 1025.74
## 95% 1056.399 1066.886 1069.258 1066.151 1033.0874 1046.329 1057.09
##        [,29]    [,30]    [,31]    [,32]    [,33]    [,34]    [,35]
## 5%  1000.653 1018.558 1008.169 1002.163 1010.358 1017.584 1014.798
## 95% 1045.648 1067.002 1062.176 1057.414 1063.300 1057.799 1066.705
##        [,36]    [,37]    [,38]     [,39]    [,40]    [,41]    [,42]
## 5%   989.220 1026.141 1004.289  984.9669 1006.081 1021.519 1008.487
## 95% 1043.665 1074.030 1052.818 1039.1861 1060.469 1081.946 1061.600
##         [,43]    [,44]    [,45]    [,46]    [,47]    [,48]     [,49]
## 5%   998.7286  991.469 1007.817 1035.897 1015.619 1010.941  997.8328
## 95% 1051.8848 1050.509 1065.096 1080.088 1065.272 1066.584 1062.0544
##        [,50]    [,51]    [,52]    [,53]    [,54]    [,55]     [,56]
## 5%  1000.343 1005.083 1017.226 1012.868  986.999 1004.985  998.3561
## 95% 1073.413 1078.649 1089.339 1081.803 1044.145 1068.332 1071.6561
##        [,57]    [,58]    [,59]    [,60]    [,61]    [,62]    [,63]
## 5%  1002.858 1023.148 1018.096 1065.996 1061.449 1067.587 1069.782
## 95% 1061.921 1078.057 1074.620 1105.164 1096.473 1089.216 1090.632
##        [,64]    [,65]    [,66]    [,67]    [,68]    [,69]    [,70]
## 5%  1042.418 1068.409 1036.404 1049.386 1045.386 1052.371 1049.695
## 95% 1059.538 1085.284 1039.933 1051.924 1056.832 1058.467 1054.676
##        [,71]    [,72]    [,73]    [,74]    [,75]    [,76]    [,77]
## 5%  1045.056 1041.988 1060.224 1057.084 1058.827 1046.342 1055.386
## 95% 1048.321 1046.440 1061.461 1068.836 1060.657 1047.501 1057.295
##        [,78]    [,79]    [,80]    [,81]    [,82]    [,83]    [,84]
## 5%  1084.040 1069.520 1084.150 1087.356 1091.586 1067.557 1097.785
## 95% 1096.761 1089.229 1099.953 1091.617 1094.384 1075.860 1115.091
##        [,85]    [,86]    [,87]    [,88]    [,89]    [,90]    [,91]
## 5%  1068.231 1068.291 1052.044 1045.899 1034.178 1023.857 1034.247
## 95% 1091.963 1089.569 1079.653 1074.211 1062.142 1061.985 1083.679

Train a Modified Bayesian Regression Structural Time Series Model to Forecast Close Price…

## =-=-=-=-= Iteration 0 Wed Jan 16 02:09:37 2019
##  =-=-=-=-=
## =-=-=-=-= Iteration 10 Wed Jan 16 02:09:38 2019
##  =-=-=-=-=
## =-=-=-=-= Iteration 20 Wed Jan 16 02:09:39 2019
##  =-=-=-=-=
## =-=-=-=-= Iteration 30 Wed Jan 16 02:09:40 2019
##  =-=-=-=-=
## =-=-=-=-= Iteration 40 Wed Jan 16 02:09:41 2019
##  =-=-=-=-=
## =-=-=-=-= Iteration 50 Wed Jan 16 02:09:42 2019
##  =-=-=-=-=
## =-=-=-=-= Iteration 60 Wed Jan 16 02:09:43 2019
##  =-=-=-=-=
## =-=-=-=-= Iteration 70 Wed Jan 16 02:09:44 2019
##  =-=-=-=-=
## =-=-=-=-= Iteration 80 Wed Jan 16 02:09:45 2019
##  =-=-=-=-=
## =-=-=-=-= Iteration 90 Wed Jan 16 02:09:46 2019
##  =-=-=-=-=
## $residual.sd
## [1] 2.210037
## 
## $prediction.sd
## [1] 8.495394
## 
## $rsquare
## [1] 0.9998954
## 
## $relative.gof
## [1] 0.5226127
## 
## $size
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##       1       1       1       1       1       1 
## 
## $coefficients
##                   mean       sd mean.inc   sd.inc inc.prob
## daily.returns 402.4452 42.16706 402.4452 42.16706        1
## Adjusted        0.0000  0.00000   0.0000  0.00000        0
## Volume          0.0000  0.00000   0.0000  0.00000        0
## (Intercept)     0.0000  0.00000   0.0000  0.00000        0

Parameter Estimates: (Sample mean of the Sampled beta value)

##   (Intercept)        Volume      Adjusted daily.returns 
##        0.0000        0.0000        0.0000      377.4992

Plot Model

##  [1] "coefficients"               "sigma.obs"                 
##  [3] "trend.level.sd"             "trend.slope.mean"          
##  [5] "trend.slope.ar.coefficient" "trend.slope.sd"            
##  [7] "sigma.seasonal.54"          "final.state"               
##  [9] "state.contributions"        "one.step.prediction.errors"
## [11] "log.likelihood"             "has.regression"            
## [13] "state.specification"        "prior"                     
## [15] "timestamp.info"             "model.options"             
## [17] "family"                     "niter"                     
## [19] "original.series"            "xlevels"                   
## [21] "terms"                      "predictors"

Create Prediction of Close Price Using the Modified Regression Model…

## List of 5
##  $ mean           : num [1:91] 1062 1062 1064 1068 1074 ...
##  $ median         : num [1:91] 1063 1058 1061 1064 1075 ...
##  $ interval       : num [1:2, 1:91] 1051 1072 1053 1077 1055 ...
##   ..- attr(*, "dimnames")=List of 2
##   .. ..$ : chr [1:2] "5%" "95%"
##   .. ..$ : NULL
##  $ distribution   : num [1:8, 1:91] 1065 1072 1070 1068 1050 ...
##  $ original.series:'zoo' series from 2014-03-31 to 2019-01-15
##   Data: num [1:1208] 554 564 564 567 540 ...
##   Index:  Date[1:1208], format: "2014-03-31" "2014-04-01" ...
##  - attr(*, "class")= chr "bsts.prediction"

Summary of Prediction:

summary(pred)
##                 Length Class  Mode   
## mean              91   -none- numeric
## median            91   -none- numeric
## interval         182   -none- numeric
## distribution     728   -none- numeric
## original.series 1208   zoo    numeric

Plot the Mean:

par(mfrow=c(2,2))
plot(pred$original.series)
plot(pred$mean)
plot(pred$median)
plot(pred$interval)

Plot Prediction:

plot(pred, plot.original = 90)

Regression Model Prediction Table

tail(pred$original.series)
## 2019-01-08 2019-01-09 2019-01-10 2019-01-11 2019-01-14 2019-01-15 
##    1076.28    1074.66    1070.33    1057.19    1044.69    1077.15
head(pred$mean)
## [1] 1062.446 1061.602 1064.334 1067.696 1073.702 1065.159
head(pred$median)
## [1] 1062.615 1057.625 1061.360 1063.950 1074.650 1069.765
head(pred$interval)
##         [,1]     [,2]     [,3]     [,4]    [,5]     [,6]     [,7]     [,8]
## 5%  1051.380 1053.300 1054.635 1049.082 1048.93 1032.127 1033.725 1027.314
## 95% 1071.543 1077.167 1079.814 1095.090 1104.49 1098.268 1103.762 1094.067
##         [,9]    [,10]    [,11]    [,12]    [,13]    [,14]    [,15]
## 5%  1016.641 1023.927 1035.987 1043.815 1039.693 1054.909 1057.112
## 95% 1091.293 1105.445 1115.940 1127.597 1128.393 1144.255 1155.915
##        [,16]    [,17]    [,18]    [,19]    [,20]    [,21]    [,22]
## 5%  1048.684 1041.628 1030.721 1038.614 1027.547 1026.063 1007.716
## 95% 1151.664 1173.004 1177.533 1190.668 1199.975 1190.130 1181.664
##        [,23]    [,24]    [,25]     [,26]    [,27]    [,28]    [,29]
## 5%  1014.446 1016.269 1014.453  995.2356 1021.287 1038.713 1006.384
## 95% 1194.792 1196.395 1197.477 1186.3856 1204.735 1215.579 1190.332
##        [,30]    [,31]     [,32]    [,33]    [,34]    [,35]     [,36]
## 5%  1022.174 1004.283  991.2864 1008.218 1022.563 1017.959  993.7759
## 95% 1209.606 1204.852 1194.3871 1211.210 1203.682 1197.313 1175.1390
##        [,37]    [,38]     [,39]    [,40]    [,41]    [,42]    [,43]
## 5%  1033.429 1003.831  996.0879 1025.693 1041.217 1027.280 1030.897
## 95% 1209.790 1174.691 1162.3389 1188.525 1195.942 1173.352 1166.130
##        [,44]    [,45]    [,46]   [,47]    [,48]    [,49]    [,50]    [,51]
## 5%  1027.259 1034.554 1042.205 1023.42 1009.514 1001.231 1005.923 1008.275
## 95% 1166.905 1190.663 1200.970 1186.34 1189.961 1184.040 1194.462 1208.008
##        [,52]    [,53]     [,54]    [,55]    [,56]    [,57]    [,58]
## 5%  1019.169 1005.279  991.9454 1009.070 1012.508 1006.726 1017.727
## 95% 1214.100 1197.431 1173.2262 1197.951 1201.570 1205.017 1219.051
##        [,59]    [,60]    [,61]    [,62]    [,63]     [,64]    [,65]
## 5%  1001.851 1028.302 1008.192 1005.821 1012.828  986.8021 1016.015
## 95% 1208.229 1225.390 1212.849 1217.482 1227.843 1198.0510 1227.483
##        [,66]    [,67]    [,68]    [,69]    [,70]     [,71]     [,72]
## 5%   994.868 1007.808 1016.157 1011.660 1002.829  998.5024  987.4353
## 95% 1206.006 1221.633 1226.908 1232.077 1220.897 1215.5176 1213.0597
##        [,73]     [,74]     [,75]     [,76]    [,77]    [,78]    [,79]
## 5%  1004.758  998.7331  994.9902  990.6137 1000.453 1033.949 1016.453
## 95% 1228.998 1229.4686 1228.6987 1226.7837 1246.541 1282.764 1251.030
##        [,80]    [,81]    [,82]    [,83]    [,84]    [,85]    [,86]
## 5%  1017.466 1022.558 1030.164 1013.417 1043.832 1016.863 1025.917
## 95% 1253.910 1263.386 1263.914 1238.732 1279.189 1253.000 1259.551
##        [,87]    [,88]    [,89]    [,90]    [,91]
## 5%  1021.655 1019.743 1020.860 1027.302 1043.697
## 95% 1259.648 1259.046 1258.115 1262.605 1284.576