library(readr)
final <- read_delim("final.csv", ";", escape_double = FALSE,
trim_ws = TRUE)
## Parsed with column specification:
## cols(
## ind = col_double(),
## Date = col_date(format = ""),
## PMIcomp = col_double(),
## PMItot = col_double(),
## SP = col_double(),
## GDP = col_double(),
## Gold = col_double(),
## Brent = col_double(),
## Unemployment = col_character(),
## `USD-EUR` = col_double(),
## Vol = col_double(),
## US_ind = col_double()
## )
head(final)
## # A tibble: 6 × 12
## ind Date PMIcomp PMItot SP GDP Gold Brent Unemployment `USD-EUR`
## <dbl> <date> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <chr> <dbl>
## 1 206 2005-01-01 49.8 50 4168. 0.03 1886 70.6 5.4% 0.824
## 2 205 2005-02-01 49.6 51.3 4202. 0.021 1894 69.5 5.3% 0.823
## 3 204 2005-03-01 51.5 53.2 4233. 0.021 1908. 69.0 5.4% 0.818
## 4 203 2005-04-01 51.7 53.7 4188. 0.021 1911. 68.2 5.2% 0.821
## 5 202 2005-05-01 49.5 54.9 4152. 0.021 1907. 66.4 5.2% 0.818
## 6 201 2005-06-01 50.7 55.4 4063. 0.021 1913. 65.2 5.1% 0.821
## # … with 2 more variables: Vol <dbl>, US_ind <dbl>
final$Date <-as.Date(final$Date)
library("urca")
library("tseries")
## Registered S3 method overwritten by 'quantmod':
## method from
## as.zoo.data.frame zoo
library("forecast")
library("TSA")
## Registered S3 methods overwritten by 'TSA':
## method from
## fitted.Arima forecast
## plot.Arima forecast
##
## Attaching package: 'TSA'
## The following object is masked from 'package:readr':
##
## spec
## The following objects are masked from 'package:stats':
##
## acf, arima
## The following object is masked from 'package:utils':
##
## tar
library("rugarch")
## Loading required package: parallel
##
## Attaching package: 'rugarch'
## The following object is masked from 'package:stats':
##
## sigma
diff1<-final$PMIcomp
plot(diff1)
acf.plot <- acf(as.ts(diff1), lag.max = 300)
Pacf(diff1)
Pacf(diff1^2, 100)
spec = ugarchspec(variance.model = list(model = 'gjrGARCH',garchOrder = c(1, 1)), mean.model = list(armaOrder = c(1, 4), include.mean = TRUE, archm = TRUE), distribution.model = "std")
garch.fit = ugarchfit(spec, diff1)
## Warning in arima0(data, order = c(modelinc[2], 0, modelinc[3]), include.mean =
## modelinc[1], : possible convergence problem: optim gave code = 1
garch.fit
##
## *---------------------------------*
## * GARCH Model Fit *
## *---------------------------------*
##
## Conditional Variance Dynamics
## -----------------------------------
## GARCH Model : gjrGARCH(1,1)
## Mean Model : ARFIMA(1,0,4)
## Distribution : std
##
## Optimal Parameters
## ------------------------------------
## Estimate Std. Error t value Pr(>|t|)
## mu 90.513892 0.426939 212.006 0
## ar1 0.992428 0.000122 8149.089 0
## ma1 0.398065 0.002007 198.305 0
## ma2 -0.021573 0.000026 -820.971 0
## ma3 0.004944 0.000167 29.575 0
## ma4 -0.026937 0.000672 -40.109 0
## archm -10.000000 0.158021 -63.283 0
## omega 0.054931 0.000166 329.972 0
## alpha1 0.064815 0.000035 1869.447 0
## beta1 0.996858 0.000020 49727.578 0
## gamma1 -0.170463 0.000085 -2012.839 0
## shape 2.237671 0.043273 51.710 0
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## mu 90.513892 0.225111 402.086 0
## ar1 0.992428 0.000069 14317.245 0
## ma1 0.398065 0.001161 342.844 0
## ma2 -0.021573 0.000620 -34.782 0
## ma3 0.004944 0.000087 56.821 0
## ma4 -0.026937 0.000347 -77.725 0
## archm -10.000000 0.068271 -146.476 0
## omega 0.054931 0.000087 633.942 0
## alpha1 0.064815 0.000031 2120.051 0
## beta1 0.996858 0.000012 86467.243 0
## gamma1 -0.170463 0.000048 -3530.746 0
## shape 2.237671 0.053710 41.662 0
##
## LogLikelihood : -399.4281
##
## Information Criteria
## ------------------------------------
##
## Akaike 3.9944
## Bayes 4.1883
## Shibata 3.9881
## Hannan-Quinn 4.0729
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 13.74 0.0002097
## Lag[2*(p+q)+(p+q)-1][14] 16.81 0.0000000
## Lag[4*(p+q)+(p+q)-1][24] 18.68 0.0178866
## d.o.f=5
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 51.57 6.914e-13
## Lag[2*(p+q)+(p+q)-1][5] 51.89 1.810e-14
## Lag[4*(p+q)+(p+q)-1][9] 51.98 2.776e-13
## d.o.f=2
##
## Weighted ARCH LM Tests
## ------------------------------------
## Statistic Shape Scale P-Value
## ARCH Lag[3] 0.1481 0.500 2.000 0.7004
## ARCH Lag[5] 0.1629 1.440 1.667 0.9740
## ARCH Lag[7] 0.1931 2.315 1.543 0.9973
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 2.89
## Individual Statistics:
## mu 0.03236
## ar1 0.03514
## ma1 0.03053
## ma2 0.01616
## ma3 0.19450
## ma4 0.11592
## archm 0.16558
## omega 0.02940
## alpha1 0.03043
## beta1 0.02887
## gamma1 0.03116
## shape 0.25538
##
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic: 2.69 2.96 3.51
## Individual Statistic: 0.35 0.47 0.75
##
## Sign Bias Test
## ------------------------------------
## t-value prob sig
## Sign Bias 1.78435 7.588e-02 *
## Negative Sign Bias 6.25317 2.371e-09 ***
## Positive Sign Bias 0.04329 9.655e-01
## Joint Effect 41.14970 6.078e-09 ***
##
##
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
## group statistic p-value(g-1)
## 1 20 18.27 0.5044
## 2 30 30.80 0.3751
## 3 40 37.50 0.5386
## 4 50 35.75 0.9213
##
##
## Elapsed time : 21.6086
coef(garch.fit)
## mu ar1 ma1 ma2 ma3
## 90.513891918 0.992428143 0.398065418 -0.021573077 0.004943522
## ma4 archm omega alpha1 beta1
## -0.026936575 -10.000000000 0.054931350 0.064814750 0.996858089
## gamma1 shape
## -0.170462661 2.237671383
Acf(residuals(garch.fit))
Acf(residuals(garch.fit)^2)
Acf(residuals(garch.fit, standardize="TRUE"))
Acf(residuals(garch.fit, standardize="TRUE")^2)
library(rugarch)
spec = ugarchspec() #the empty function specifies the default model.
print(spec)
##
## *---------------------------------*
## * GARCH Model Spec *
## *---------------------------------*
##
## Conditional Variance Dynamics
## ------------------------------------
## GARCH Model : sGARCH(1,1)
## Variance Targeting : FALSE
##
## Conditional Mean Dynamics
## ------------------------------------
## Mean Model : ARFIMA(1,0,1)
## Include Mean : TRUE
## GARCH-in-Mean : FALSE
##
## Conditional Distribution
## ------------------------------------
## Distribution : norm
## Includes Skew : FALSE
## Includes Shape : FALSE
## Includes Lambda : FALSE
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
set.seed(1234)
# Возьмем 80% как обучающие
train = final %>% sample_frac(.8)
# credits_train$Income %>% summary()
# создаем тестовый набор данных
# через анти-джойн, чтобы убрать все наблюдения, попавшие в обучающую выборку
test = anti_join(final, train, by = 'Date') %>% dplyr::select(-ind)
train = train %>% dplyr::select(-ind)
library(forecast)
library(xts)
## Loading required package: zoo
##
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
##
## as.Date, as.Date.numeric
##
## Attaching package: 'xts'
## The following objects are masked from 'package:dplyr':
##
## first, last
data_ts <- xts(train$PMItot, train$Date)
class(data_ts)
## [1] "xts" "zoo"
fit=Arima(data_ts,order=c(1,1,1),seasonal=list(order=c(0,1,1),period=12))
fit
## Series: data_ts
## ARIMA(1,1,1)(0,1,1)[12]
##
## Coefficients:
## ar1 ma1 sma1
## 0.4802 -0.6196 -1.0000
## s.e. 0.5607 0.5094 0.1195
##
## sigma^2 = 5.427: log likelihood = -358.41
## AIC=724.83 AICc=725.1 BIC=736.92
r=resid(fit)
sum(r)
## [1] 0.3830046
rr=r^2
par(mfrow=c(1,2))
acf(as.vector(rr),main="ACF of Squared Residuals");
pacf(as.vector(rr),main="PACF of Squared Residuals"); # homoscedasticity check
Engle’s ARCH Test.
This test is a Lagrange Multiplier test and uses the following hypothesis.
Ho: Residuals exhibits no ARCH effects.
H1: ARCH(lag) effects are present.
library(MTS)
archTest(r)
## Q(m) of squared series(LM test):
## Test statistic: 18.17846 p-value: 0.05202688
## Rank-based Test:
## Test statistic: 27.59135 p-value: 0.002098008
spec = ugarchspec() #the empty function specifies the default model.
print(spec)
##
## *---------------------------------*
## * GARCH Model Spec *
## *---------------------------------*
##
## Conditional Variance Dynamics
## ------------------------------------
## GARCH Model : sGARCH(1,1)
## Variance Targeting : FALSE
##
## Conditional Mean Dynamics
## ------------------------------------
## Mean Model : ARFIMA(1,0,1)
## Include Mean : TRUE
## GARCH-in-Mean : FALSE
##
## Conditional Distribution
## ------------------------------------
## Distribution : norm
## Includes Skew : FALSE
## Includes Shape : FALSE
## Includes Lambda : FALSE
library(rugarch)
def.fit = ugarchfit(spec = spec, data = data_ts)
print(def.fit)
##
## *---------------------------------*
## * GARCH Model Fit *
## *---------------------------------*
##
## Conditional Variance Dynamics
## -----------------------------------
## GARCH Model : sGARCH(1,1)
## Mean Model : ARFIMA(1,0,1)
## Distribution : norm
##
## Optimal Parameters
## ------------------------------------
## Estimate Std. Error t value Pr(>|t|)
## mu 53.521030 1.080398 49.53825 0.000000
## ar1 0.856798 0.050881 16.83923 0.000000
## ma1 -0.030408 0.097124 -0.31308 0.754220
## omega 1.973997 1.168352 1.68956 0.091113
## alpha1 0.118405 0.071988 1.64480 0.100012
## beta1 0.472030 0.255668 1.84627 0.064854
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## mu 53.521030 1.069328 50.05108 0.000000
## ar1 0.856798 0.044880 19.09076 0.000000
## ma1 -0.030408 0.075946 -0.40038 0.688874
## omega 1.973997 0.736451 2.68042 0.007353
## alpha1 0.118405 0.069039 1.71506 0.086335
## beta1 0.472030 0.142426 3.31421 0.000919
##
## LogLikelihood : -361.8737
##
## Information Criteria
## ------------------------------------
##
## Akaike 4.4591
## Bayes 4.5720
## Shibata 4.4566
## Hannan-Quinn 4.5049
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.1250 0.7236
## Lag[2*(p+q)+(p+q)-1][5] 0.6786 1.0000
## Lag[4*(p+q)+(p+q)-1][9] 3.7840 0.7405
## d.o.f=2
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 1.106 0.2930
## Lag[2*(p+q)+(p+q)-1][5] 1.260 0.7987
## Lag[4*(p+q)+(p+q)-1][9] 1.964 0.9093
## d.o.f=2
##
## Weighted ARCH LM Tests
## ------------------------------------
## Statistic Shape Scale P-Value
## ARCH Lag[3] 0.0003875 0.500 2.000 0.9843
## ARCH Lag[5] 0.3266040 1.440 1.667 0.9331
## ARCH Lag[7] 0.7918126 2.315 1.543 0.9449
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 1.3875
## Individual Statistics:
## mu 0.19740
## ar1 0.26690
## ma1 0.07879
## omega 0.11200
## alpha1 0.21845
## beta1 0.11807
##
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic: 1.49 1.68 2.12
## Individual Statistic: 0.35 0.47 0.75
##
## Sign Bias Test
## ------------------------------------
## t-value prob sig
## Sign Bias 0.3426 0.7323
## Negative Sign Bias 0.3693 0.7124
## Positive Sign Bias 0.4153 0.6784
## Joint Effect 1.7298 0.6303
##
##
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
## group statistic p-value(g-1)
## 1 20 13.79 0.7959
## 2 30 13.36 0.9942
## 3 40 42.76 0.3129
## 4 50 40.76 0.7928
##
##
## Elapsed time : 0.1131573
spec=ugarchspec(variance.model = list(model="gjrGARCH",garchOrder = c(1, 1)))
def.fit1= ugarchfit(spec = spec, data = data_ts)
print(def.fit1)
##
## *---------------------------------*
## * GARCH Model Fit *
## *---------------------------------*
##
## Conditional Variance Dynamics
## -----------------------------------
## GARCH Model : gjrGARCH(1,1)
## Mean Model : ARFIMA(1,0,1)
## Distribution : norm
##
## Optimal Parameters
## ------------------------------------
## Estimate Std. Error t value Pr(>|t|)
## mu 53.521465 1.077943 49.651491 0.000000
## ar1 0.857075 0.051104 16.771234 0.000000
## ma1 -0.031296 0.098546 -0.317572 0.750810
## omega 1.936338 1.290197 1.500808 0.133405
## alpha1 0.125074 0.143901 0.869162 0.384759
## beta1 0.477870 0.264254 1.808372 0.070549
## gamma1 -0.008893 0.164139 -0.054182 0.956790
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## mu 53.521465 1.059137 50.533083 0.00000
## ar1 0.857075 0.045306 18.917489 0.00000
## ma1 -0.031296 0.078355 -0.399407 0.68959
## omega 1.936338 1.744301 1.110094 0.26696
## alpha1 0.125074 0.187654 0.666513 0.50508
## beta1 0.477870 0.292102 1.635967 0.10185
## gamma1 -0.008893 0.290616 -0.030602 0.97559
##
## LogLikelihood : -361.8723
##
## Information Criteria
## ------------------------------------
##
## Akaike 4.4712
## Bayes 4.6029
## Shibata 4.4678
## Hannan-Quinn 4.5247
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.1188 0.7303
## Lag[2*(p+q)+(p+q)-1][5] 0.6655 1.0000
## Lag[4*(p+q)+(p+q)-1][9] 3.7622 0.7454
## d.o.f=2
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 1.183 0.2768
## Lag[2*(p+q)+(p+q)-1][5] 1.329 0.7819
## Lag[4*(p+q)+(p+q)-1][9] 2.041 0.9001
## d.o.f=2
##
## Weighted ARCH LM Tests
## ------------------------------------
## Statistic Shape Scale P-Value
## ARCH Lag[3] 0.000781 0.500 2.000 0.9777
## ARCH Lag[5] 0.332140 1.440 1.667 0.9316
## ARCH Lag[7] 0.811904 2.315 1.543 0.9421
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 1.7448
## Individual Statistics:
## mu 0.1945
## ar1 0.2665
## ma1 0.0779
## omega 0.1120
## alpha1 0.2217
## beta1 0.1166
## gamma1 0.4634
##
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic: 1.69 1.9 2.35
## Individual Statistic: 0.35 0.47 0.75
##
## Sign Bias Test
## ------------------------------------
## t-value prob sig
## Sign Bias 0.3283 0.7431
## Negative Sign Bias 0.3998 0.6898
## Positive Sign Bias 0.4349 0.6642
## Joint Effect 1.8182 0.6110
##
##
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
## group statistic p-value(g-1)
## 1 20 14.03 0.7819
## 2 30 13.00 0.9954
## 3 40 45.18 0.2294
## 4 50 40.76 0.7928
##
##
## Elapsed time : 0.5074065
spec=ugarchspec(variance.model = list(model="apARCH"))
def.fit2= ugarchfit(spec = spec, data = data_ts )
print(def.fit2)
##
## *---------------------------------*
## * GARCH Model Fit *
## *---------------------------------*
##
## Conditional Variance Dynamics
## -----------------------------------
## GARCH Model : apARCH(1,1)
## Mean Model : ARFIMA(1,0,1)
## Distribution : norm
##
## Optimal Parameters
## ------------------------------------
## Estimate Std. Error t value Pr(>|t|)
## mu 53.449367 0.681753 78.39987 0.00000
## ar1 0.825809 0.018290 45.15198 0.00000
## ma1 -0.036833 0.040085 -0.91887 0.35816
## omega 0.075288 0.001320 57.05514 0.00000
## alpha1 0.012916 0.001791 7.21179 0.00000
## beta1 0.927268 0.000086 10767.77276 0.00000
## gamma1 1.000000 0.001362 734.04294 0.00000
## delta 0.155003 0.006642 23.33625 0.00000
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## mu 53.449367 NaN NaN NaN
## ar1 0.825809 NaN NaN NaN
## ma1 -0.036833 NaN NaN NaN
## omega 0.075288 NaN NaN NaN
## alpha1 0.012916 NaN NaN NaN
## beta1 0.927268 NaN NaN NaN
## gamma1 1.000000 NaN NaN NaN
## delta 0.155003 NaN NaN NaN
##
## LogLikelihood : -361.7591
##
## Information Criteria
## ------------------------------------
##
## Akaike 4.4819
## Bayes 4.6325
## Shibata 4.4775
## Hannan-Quinn 4.5431
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.003545 0.9525
## Lag[2*(p+q)+(p+q)-1][5] 1.144746 0.9999
## Lag[4*(p+q)+(p+q)-1][9] 3.984171 0.6947
## d.o.f=2
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 0.8483 0.3570
## Lag[2*(p+q)+(p+q)-1][5] 2.9479 0.4166
## Lag[4*(p+q)+(p+q)-1][9] 4.2435 0.5481
## d.o.f=2
##
## Weighted ARCH LM Tests
## ------------------------------------
## Statistic Shape Scale P-Value
## ARCH Lag[3] 0.01913 0.500 2.000 0.8900
## ARCH Lag[5] 0.81055 1.440 1.667 0.7899
## ARCH Lag[7] 1.67903 2.315 1.543 0.7848
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: NaN
## Individual Statistics:
## mu 0.24167
## ar1 0.17946
## ma1 0.05546
## omega 0.07974
## alpha1 0.12334
## beta1 0.07991
## gamma1 NaN
## delta 0.09259
##
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic: 1.89 2.11 2.59
## Individual Statistic: 0.35 0.47 0.75
##
## Sign Bias Test
## ------------------------------------
## t-value prob sig
## Sign Bias 0.65007 0.5166
## Negative Sign Bias 1.40655 0.1615
## Positive Sign Bias 0.08221 0.9346
## Joint Effect 2.07337 0.5573
##
##
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
## group statistic p-value(g-1)
## 1 20 27.61 0.09131
## 2 30 25.73 0.64003
## 3 40 54.88 0.04720
## 4 50 37.73 0.87925
##
##
## Elapsed time : 1.56774
#plot(def.fit2,wich=2)
plot(def.fit1,which=3)
Прогнозирование
bootp=ugarchboot(def.fit2,method=c("Partial","Full")[1],n.ahead = 72,n.bootpred=1000,n.bootfit=1000)
bootp
##
## *-----------------------------------*
## * GARCH Bootstrap Forecast *
## *-----------------------------------*
## Model : apARCH
## n.ahead : 72
## Bootstrap method: partial
## Date (T[0]): 2022-02-01
##
## Series (summary):
## min q.25 mean q.75 max forecast[analytic]
## t+1 47.954 54.391 55.698 57.077 62.216 55.588
## t+2 43.008 53.443 55.361 57.302 65.189 55.216
## t+3 43.163 52.915 55.198 57.535 65.754 54.908
## t+4 42.042 52.889 55.117 57.449 65.914 54.654
## t+5 41.056 52.808 54.956 57.466 65.408 54.444
## t+6 39.425 52.633 54.969 57.587 65.480 54.271
## t+7 37.724 52.669 54.955 57.542 65.245 54.128
## t+8 39.141 52.500 55.017 57.671 64.511 54.010
## t+9 40.796 52.480 55.031 57.807 65.830 53.912
## t+10 41.093 52.484 55.039 57.857 66.887 53.831
## .....................
##
## Sigma (summary):
## min q0.25 mean q0.75 max forecast[analytic]
## t+1 2.3063 2.3063 2.3063 2.3063 2.3063 2.3063
## t+2 2.2175 2.2222 2.3081 2.4032 2.4705 2.3129
## t+3 2.1386 2.1493 2.3111 2.3642 2.6188 2.3190
## t+4 2.0691 2.2217 2.3122 2.4242 2.6943 2.3248
## t+5 2.0073 2.1727 2.3102 2.4091 2.7998 2.3302
## t+6 1.9564 2.1549 2.3089 2.4316 2.9084 2.3353
## t+7 1.9054 2.1711 2.3042 2.4376 2.9961 2.3401
## t+8 1.8584 2.1421 2.2990 2.4332 3.0675 2.3445
## t+9 1.8172 2.1479 2.2936 2.4261 3.1369 2.3487
## t+10 1.7805 2.1270 2.2888 2.4414 3.0082 2.3525
## .....................
s_f=bootp@forc@forecast$seriesFor #this is for series forecasts
s_f
## 2022-02-01
## T+1 55.58829
## T+2 55.21571
## T+3 54.90803
## T+4 54.65394
## T+5 54.44412
## T+6 54.27084
## T+7 54.12775
## T+8 54.00958
## T+9 53.91199
## T+10 53.83141
## T+11 53.76486
## T+12 53.70990
## T+13 53.66452
## T+14 53.62704
## T+15 53.59609
## T+16 53.57053
## T+17 53.54943
## T+18 53.53200
## T+19 53.51760
## T+20 53.50572
## T+21 53.49590
## T+22 53.48780
## T+23 53.48110
## T+24 53.47557
## T+25 53.47101
## T+26 53.46724
## T+27 53.46413
## T+28 53.46156
## T+29 53.45943
## T+30 53.45768
## T+31 53.45623
## T+32 53.45504
## T+33 53.45405
## T+34 53.45323
## T+35 53.45256
## T+36 53.45200
## T+37 53.45154
## T+38 53.45116
## T+39 53.45085
## T+40 53.45059
## T+41 53.45038
## T+42 53.45020
## T+43 53.45006
## T+44 53.44994
## T+45 53.44984
## T+46 53.44976
## T+47 53.44969
## T+48 53.44963
## T+49 53.44959
## T+50 53.44955
## T+51 53.44952
## T+52 53.44949
## T+53 53.44947
## T+54 53.44945
## T+55 53.44944
## T+56 53.44942
## T+57 53.44941
## T+58 53.44941
## T+59 53.44940
## T+60 53.44939
## T+61 53.44939
## T+62 53.44939
## T+63 53.44938
## T+64 53.44938
## T+65 53.44938
## T+66 53.44938
## T+67 53.44937
## T+68 53.44937
## T+69 53.44937
## T+70 53.44937
## T+71 53.44937
## T+72 53.44937
s_f1=as.vector(s_f)
f=forecast(fit,h=112)
f
## Point Forecast Lo 80 Hi 80 Lo 95 Hi 95
## 166 56.27887 53.18070 59.37705 51.54062 61.01712
## 167 56.17760 52.09013 60.26507 49.92635 62.42885
## 168 56.63204 51.86205 61.40202 49.33698 63.92709
## 169 56.92522 51.60395 62.24648 48.78705 65.06339
## 170 56.72091 50.92167 62.52015 47.85173 65.59008
## 171 56.51112 50.27883 62.74341 46.97965 66.04258
## 172 58.20954 51.57617 64.84291 48.06468 68.35441
## 173 58.14074 51.13091 65.15058 47.42012 68.86136
## 174 57.54190 50.17558 64.90821 46.27609 68.80770
## 175 56.96365 49.25768 64.66962 45.17839 68.74892
## 176 56.84190 48.81078 64.87303 44.55936 69.12445
## 177 57.17645 48.83288 65.52002 44.41606 69.93684
## 178 57.02941 48.32398 65.73484 43.71560 70.34322
## 179 56.72362 47.67911 65.76813 42.89123 70.55601
## 180 57.07985 47.71217 66.44753 42.75322 71.40648
## 181 57.32588 47.64722 67.00455 42.52364 72.12813
## 182 57.09893 47.12462 67.07324 41.84454 72.35332
## 183 56.87827 46.61719 67.13934 41.18531 72.57123
## 184 58.57147 48.03160 69.11135 42.45213 74.69082
## 185 58.50016 47.68875 69.31157 41.96554 75.03479
## 186 57.90011 46.82386 68.97637 40.96044 74.83979
## 187 57.32129 45.98638 68.65621 39.98604 74.65655
## 188 57.19926 45.61145 68.78707 39.47724 74.92129
## 189 57.53368 45.69834 69.36902 39.43309 75.63427
## 190 57.38657 45.26223 69.51092 38.84399 75.92916
## 191 57.08075 44.68050 69.48100 38.11621 76.04530
## 192 57.43697 44.76952 70.10442 38.06378 76.81017
## 193 57.68300 44.75461 70.61138 37.91073 77.45526
## 194 57.45604 44.27893 70.63315 37.30339 77.60869
## 195 57.23538 43.81444 70.65631 36.70983 77.76092
## 196 58.92858 45.26832 72.58884 38.03701 79.82015
## 197 58.85727 44.96186 72.75268 37.60607 80.10847
## 198 58.25722 44.13060 72.38384 36.65242 79.86202
## 199 57.67840 43.32430 72.03250 35.72569 79.63110
## 200 57.55637 42.97831 72.13442 35.26116 79.85158
## 201 57.89078 43.09212 72.68945 35.25818 80.52339
## 202 57.74368 42.68776 72.79960 34.71764 80.76972
## 203 57.43786 42.13443 72.74129 34.03328 80.84244
## 204 57.79408 42.24926 73.33889 34.02033 81.56782
## 205 58.04010 42.25796 73.82224 33.90340 82.17680
## 206 57.81314 41.80528 73.82101 33.33123 82.29506
## 207 57.59248 41.36229 73.82268 32.77054 82.41442
## 208 59.28568 42.83628 75.73509 34.12850 84.44287
## 209 59.21437 42.54871 75.88004 33.72644 84.70231
## 210 58.61433 41.73518 75.49347 32.79991 84.42875
## 211 58.03550 40.94555 75.12545 31.89868 84.17233
## 212 57.91347 40.61526 75.21169 31.45814 84.36881
## 213 58.24789 40.74384 75.75194 31.47775 85.01802
## 214 58.10079 40.35740 75.84417 30.96462 85.23695
## 215 57.79497 39.82025 75.76968 30.30502 85.28491
## 216 58.15118 39.94996 76.35240 30.31482 85.98755
## 217 58.39721 39.97237 76.82205 30.21884 86.57557
## 218 58.17025 39.53336 76.80713 29.66759 86.67290
## 219 57.94959 39.10328 76.79589 29.12665 86.77253
## 220 59.64279 40.58947 78.69611 30.50325 88.78233
## 221 59.57148 40.31343 78.82953 30.11883 89.02413
## 222 58.97143 39.51081 78.43205 29.20898 88.73388
## 223 58.39261 38.73151 78.05371 28.32355 88.46166
## 224 58.27058 38.41100 78.13016 27.89798 88.64318
## 225 58.60499 38.54884 78.66115 27.93175 89.27824
## 226 58.45789 38.17388 78.74190 27.43618 89.47961
## 227 58.15207 37.64716 78.65699 26.79251 89.51163
## 228 58.50829 37.78647 79.23011 26.81700 90.19958
## 229 58.75431 37.81775 79.69088 26.73460 90.77403
## 230 58.52735 37.38779 79.66692 26.19717 90.85753
## 231 58.30669 36.96627 79.64711 25.66934 90.94405
## 232 59.99990 38.46060 81.53919 27.05838 92.94141
## 233 59.92859 38.19228 81.66489 26.68577 93.17140
## 234 59.32854 37.39700 81.26007 25.78715 92.86992
## 235 58.74971 36.62468 80.87475 24.91239 92.58704
## 236 58.62769 36.31079 80.94458 24.49694 92.75843
## 237 58.96210 36.45492 81.46928 24.54034 93.38386
## 238 58.81500 36.08791 81.54208 24.05692 93.57308
## 239 58.50918 35.56840 81.44995 23.42429 93.59406
## 240 58.86540 35.71438 82.01641 23.45898 94.27181
## 241 59.11142 35.75181 82.47102 23.38599 94.83685
## 242 58.88446 35.32824 82.44068 22.85833 94.91059
## 243 58.66380 34.91280 82.41480 22.33978 94.98782
## 244 60.35700 36.41290 84.30110 23.73766 96.97634
## 245 60.28569 36.15008 84.42130 23.37346 97.19792
## 246 59.68564 35.36004 84.01124 22.48285 96.88843
## 247 59.10682 34.59270 83.62094 21.61571 96.59793
## 248 58.98479 34.28356 83.68602 21.20752 96.76206
## 249 59.31921 34.43220 84.20621 21.25782 97.38059
## 250 59.17210 34.07098 84.27322 20.78325 97.56095
## 251 58.86628 33.55674 84.17582 20.15868 97.57388
## 252 59.22250 33.70758 84.73742 20.20080 98.24420
## 253 59.46852 33.74949 85.18755 20.13466 98.80239
## 254 59.24157 33.33065 85.15248 19.61423 98.86890
## 255 59.02090 32.91970 85.12210 19.10256 98.93924
## 256 60.71411 34.42410 87.00412 20.50701 100.92121
## 257 60.64280 34.16537 87.12023 20.14906 101.13654
## 258 60.04275 33.37922 86.70627 19.26441 100.82109
## 259 59.46393 32.61559 86.31226 18.40294 100.52491
## 260 59.34190 32.30999 86.37381 18.00016 100.68363
## 261 59.67631 32.46200 86.89063 18.05561 101.29702
## 262 59.52921 32.10517 86.95325 17.58776 101.47066
## 263 59.22339 31.59491 86.85186 16.96928 101.47749
## 264 59.57961 31.74943 87.40979 17.01702 102.14219
## 265 59.82563 31.79472 87.85654 16.95605 102.69521
## 266 59.59867 31.37949 87.81785 16.44116 102.75618
## 267 59.37801 30.97200 87.78402 15.93477 102.82125
## 268 61.07121 32.47968 89.66274 17.34424 104.79818
## 269 60.99990 32.22409 89.77572 16.99110 105.00871
## 270 60.39985 31.44094 89.35876 16.11102 104.68869
## 271 59.82103 30.68017 88.96190 15.25392 104.38814
## 272 59.69900 30.37728 89.02073 14.85529 104.54271
## 273 60.03342 30.53187 89.53496 14.91469 105.15214
## 274 59.88631 30.17847 89.59416 14.45209 105.32054
## 275 59.58049 29.67132 89.48967 13.83836 105.32263
## 276 59.93671 29.82869 90.04473 13.89047 105.98296
## 277 60.18273 29.87660 90.48887 13.83350 106.53197
library(ggplot2)
f=as.data.frame(f)
f
## Point Forecast Lo 80 Hi 80 Lo 95 Hi 95
## 166 56.27887 53.18070 59.37705 51.54062 61.01712
## 167 56.17760 52.09013 60.26507 49.92635 62.42885
## 168 56.63204 51.86205 61.40202 49.33698 63.92709
## 169 56.92522 51.60395 62.24648 48.78705 65.06339
## 170 56.72091 50.92167 62.52015 47.85173 65.59008
## 171 56.51112 50.27883 62.74341 46.97965 66.04258
## 172 58.20954 51.57617 64.84291 48.06468 68.35441
## 173 58.14074 51.13091 65.15058 47.42012 68.86136
## 174 57.54190 50.17558 64.90821 46.27609 68.80770
## 175 56.96365 49.25768 64.66962 45.17839 68.74892
## 176 56.84190 48.81078 64.87303 44.55936 69.12445
## 177 57.17645 48.83288 65.52002 44.41606 69.93684
## 178 57.02941 48.32398 65.73484 43.71560 70.34322
## 179 56.72362 47.67911 65.76813 42.89123 70.55601
## 180 57.07985 47.71217 66.44753 42.75322 71.40648
## 181 57.32588 47.64722 67.00455 42.52364 72.12813
## 182 57.09893 47.12462 67.07324 41.84454 72.35332
## 183 56.87827 46.61719 67.13934 41.18531 72.57123
## 184 58.57147 48.03160 69.11135 42.45213 74.69082
## 185 58.50016 47.68875 69.31157 41.96554 75.03479
## 186 57.90011 46.82386 68.97637 40.96044 74.83979
## 187 57.32129 45.98638 68.65621 39.98604 74.65655
## 188 57.19926 45.61145 68.78707 39.47724 74.92129
## 189 57.53368 45.69834 69.36902 39.43309 75.63427
## 190 57.38657 45.26223 69.51092 38.84399 75.92916
## 191 57.08075 44.68050 69.48100 38.11621 76.04530
## 192 57.43697 44.76952 70.10442 38.06378 76.81017
## 193 57.68300 44.75461 70.61138 37.91073 77.45526
## 194 57.45604 44.27893 70.63315 37.30339 77.60869
## 195 57.23538 43.81444 70.65631 36.70983 77.76092
## 196 58.92858 45.26832 72.58884 38.03701 79.82015
## 197 58.85727 44.96186 72.75268 37.60607 80.10847
## 198 58.25722 44.13060 72.38384 36.65242 79.86202
## 199 57.67840 43.32430 72.03250 35.72569 79.63110
## 200 57.55637 42.97831 72.13442 35.26116 79.85158
## 201 57.89078 43.09212 72.68945 35.25818 80.52339
## 202 57.74368 42.68776 72.79960 34.71764 80.76972
## 203 57.43786 42.13443 72.74129 34.03328 80.84244
## 204 57.79408 42.24926 73.33889 34.02033 81.56782
## 205 58.04010 42.25796 73.82224 33.90340 82.17680
## 206 57.81314 41.80528 73.82101 33.33123 82.29506
## 207 57.59248 41.36229 73.82268 32.77054 82.41442
## 208 59.28568 42.83628 75.73509 34.12850 84.44287
## 209 59.21437 42.54871 75.88004 33.72644 84.70231
## 210 58.61433 41.73518 75.49347 32.79991 84.42875
## 211 58.03550 40.94555 75.12545 31.89868 84.17233
## 212 57.91347 40.61526 75.21169 31.45814 84.36881
## 213 58.24789 40.74384 75.75194 31.47775 85.01802
## 214 58.10079 40.35740 75.84417 30.96462 85.23695
## 215 57.79497 39.82025 75.76968 30.30502 85.28491
## 216 58.15118 39.94996 76.35240 30.31482 85.98755
## 217 58.39721 39.97237 76.82205 30.21884 86.57557
## 218 58.17025 39.53336 76.80713 29.66759 86.67290
## 219 57.94959 39.10328 76.79589 29.12665 86.77253
## 220 59.64279 40.58947 78.69611 30.50325 88.78233
## 221 59.57148 40.31343 78.82953 30.11883 89.02413
## 222 58.97143 39.51081 78.43205 29.20898 88.73388
## 223 58.39261 38.73151 78.05371 28.32355 88.46166
## 224 58.27058 38.41100 78.13016 27.89798 88.64318
## 225 58.60499 38.54884 78.66115 27.93175 89.27824
## 226 58.45789 38.17388 78.74190 27.43618 89.47961
## 227 58.15207 37.64716 78.65699 26.79251 89.51163
## 228 58.50829 37.78647 79.23011 26.81700 90.19958
## 229 58.75431 37.81775 79.69088 26.73460 90.77403
## 230 58.52735 37.38779 79.66692 26.19717 90.85753
## 231 58.30669 36.96627 79.64711 25.66934 90.94405
## 232 59.99990 38.46060 81.53919 27.05838 92.94141
## 233 59.92859 38.19228 81.66489 26.68577 93.17140
## 234 59.32854 37.39700 81.26007 25.78715 92.86992
## 235 58.74971 36.62468 80.87475 24.91239 92.58704
## 236 58.62769 36.31079 80.94458 24.49694 92.75843
## 237 58.96210 36.45492 81.46928 24.54034 93.38386
## 238 58.81500 36.08791 81.54208 24.05692 93.57308
## 239 58.50918 35.56840 81.44995 23.42429 93.59406
## 240 58.86540 35.71438 82.01641 23.45898 94.27181
## 241 59.11142 35.75181 82.47102 23.38599 94.83685
## 242 58.88446 35.32824 82.44068 22.85833 94.91059
## 243 58.66380 34.91280 82.41480 22.33978 94.98782
## 244 60.35700 36.41290 84.30110 23.73766 96.97634
## 245 60.28569 36.15008 84.42130 23.37346 97.19792
## 246 59.68564 35.36004 84.01124 22.48285 96.88843
## 247 59.10682 34.59270 83.62094 21.61571 96.59793
## 248 58.98479 34.28356 83.68602 21.20752 96.76206
## 249 59.31921 34.43220 84.20621 21.25782 97.38059
## 250 59.17210 34.07098 84.27322 20.78325 97.56095
## 251 58.86628 33.55674 84.17582 20.15868 97.57388
## 252 59.22250 33.70758 84.73742 20.20080 98.24420
## 253 59.46852 33.74949 85.18755 20.13466 98.80239
## 254 59.24157 33.33065 85.15248 19.61423 98.86890
## 255 59.02090 32.91970 85.12210 19.10256 98.93924
## 256 60.71411 34.42410 87.00412 20.50701 100.92121
## 257 60.64280 34.16537 87.12023 20.14906 101.13654
## 258 60.04275 33.37922 86.70627 19.26441 100.82109
## 259 59.46393 32.61559 86.31226 18.40294 100.52491
## 260 59.34190 32.30999 86.37381 18.00016 100.68363
## 261 59.67631 32.46200 86.89063 18.05561 101.29702
## 262 59.52921 32.10517 86.95325 17.58776 101.47066
## 263 59.22339 31.59491 86.85186 16.96928 101.47749
## 264 59.57961 31.74943 87.40979 17.01702 102.14219
## 265 59.82563 31.79472 87.85654 16.95605 102.69521
## 266 59.59867 31.37949 87.81785 16.44116 102.75618
## 267 59.37801 30.97200 87.78402 15.93477 102.82125
## 268 61.07121 32.47968 89.66274 17.34424 104.79818
## 269 60.99990 32.22409 89.77572 16.99110 105.00871
## 270 60.39985 31.44094 89.35876 16.11102 104.68869
## 271 59.82103 30.68017 88.96190 15.25392 104.38814
## 272 59.69900 30.37728 89.02073 14.85529 104.54271
## 273 60.03342 30.53187 89.53496 14.91469 105.15214
## 274 59.88631 30.17847 89.59416 14.45209 105.32054
## 275 59.58049 29.67132 89.48967 13.83836 105.32263
## 276 59.93671 29.82869 90.04473 13.89047 105.98296
## 277 60.18273 29.87660 90.48887 13.83350 106.53197