Dataset Description

The motivation of this study is to analyze the nature of financial data. Therefore, we choose Microsoft financial data from March 1986 to May 31,2021.Data is extracted from Yahoo Finance which is an open source Financial data provider.Dataset contains Microsoft Open, Close, High, Low, Volume and Adjusted prices. We collected about 36 years of Microsoft historical stock price. The goal of this project is to discover interesting facts of Microsoft Stock price and develop a suitable model for forecasting.

Source: Microsoft Financial Data

Exploratory Analysis:

Require Library for loading and Analysis

library(quantmod)
library(lmtest)
library(dplyr)
library(PerformanceAnalytics)
library(ggplot2)
library(xts)
library(tidyverse)
library("feasts") 
library("fable") 
library("lubridate")
library("gridExtra")
library(tseries)
library(forecast)
library(rugarch)
getSymbols("MSFT", src="yahoo", periodicity = "daily", from = "1986-03-13", to = "2021-05-31")
## [1] "MSFT"
head(MSFT)
##            MSFT.Open MSFT.High MSFT.Low MSFT.Close MSFT.Volume MSFT.Adjusted
## 1986-03-13  0.088542  0.101563 0.088542   0.097222  1031788800      0.061608
## 1986-03-14  0.097222  0.102431 0.097222   0.100694   308160000      0.063809
## 1986-03-17  0.100694  0.103299 0.100694   0.102431   133171200      0.064909
## 1986-03-18  0.102431  0.103299 0.098958   0.099826    67766400      0.063258
## 1986-03-19  0.099826  0.100694 0.097222   0.098090    47894400      0.062158
## 1986-03-20  0.098090  0.098090 0.094618   0.095486    58435200      0.060508
#Checking the missing values
colSums(is.na(MSFT)) 
##     MSFT.Open     MSFT.High      MSFT.Low    MSFT.Close   MSFT.Volume 
##             0             0             0             0             0 
## MSFT.Adjusted 
##             0
#Data Frame
data <- cbind(
  Price = MSFT$MSFT.Close,
  Return=CalculateReturns(MSFT$MSFT.Close, method = 'log'))  #Calculating Returns and transform into log values
colnames(data) <- c('Price','Return')
head(data)
##               Price      Return
## 1986-03-13 0.097222          NA
## 1986-03-14 0.100694  0.03508919
## 1986-03-17 0.102431  0.01710319
## 1986-03-18 0.099826 -0.02576073
## 1986-03-19 0.098090 -0.01754325
## 1986-03-20 0.095486 -0.02690578
plot(na.omit(data$Price), ylab='MSFT Closing Price',main='Microsoft Stock Price from 1986-2021',col='blue')

The time series plots depicts the price of Microsoft Stock Price.It shows the price of the stock increases over time even though the price shows volatility.Thus the stock price is not stationary over time due to changing mean and variance over time.

plot(na.omit(data$Return),main='Return of MSFT')

The Log of Return series shows the Return series is stationary i.e. the mean and variance of Return series is constant over time.

Checking the Stationarity of Price

Augmented Dickey Fuller Test

adf.test(na.omit(data$Price))
## Warning in adf.test(na.omit(data$Price)): p-value greater than printed p-value
## 
##  Augmented Dickey-Fuller Test
## 
## data:  na.omit(data$Price)
## Dickey-Fuller = 4.1881, Lag order = 20, p-value = 0.99
## alternative hypothesis: stationary

After applying the ADF to test on Price of the data, we see that the P-value is higher than 5% significant level i.e. P-value 0.99 > 0.05. Therefore, we can not reject the null hypothesis and conclude that the Price of the data is not stationary.

Checking the Stationarity of Return

adf.test(na.omit(data$Return))
## Warning in adf.test(na.omit(data$Return)): p-value smaller than printed p-value
## 
##  Augmented Dickey-Fuller Test
## 
## data:  na.omit(data$Return)
## Dickey-Fuller = -21.223, Lag order = 20, p-value = 0.01
## alternative hypothesis: stationary

After applying the ADF to test on Return series, we see that the P-value is smaller than 5% significant level i.e. P-value 0.01 < 0.05. Therefore, we can reject the null hypothesis and conclude that the Retrun of the stock price is stationary.

Most financial studies works on Return rather than Price. Cambell, and Mackinlay (1997) explained two main reasons for using Return. First, Return is a complete and scale-free summary of the investment.Second, Return series has most manageable statistical properties than Price. Return series has two key properties such as Stationarity and Ergodicity. Due to the advantages of Return, we proceed our analysis with Return.

Auto Correlation Function

acf(na.omit(data$Return), lag.max = 40, main='ACF of Return Values',col='red')

From the ACF of the Return series, we do not see any significant spikes outside the blue lines except the one at 0 lag due to the series is correlated with itself.Therefore, we conclude that the Return series is not depends on previous days error.

pacf(na.omit(data$Return), main='Partial Auto Correlation of Return Values',col='red')

The PACF of the Return series shows some significant spikes at 2,3,4 and 32 lags. From this we conclude that the Return series is Partially auto correlated with lags.We conclude that the Return series has influenced of previous days Return.

Stylized Facts of Financial Data

  • Distributions of Returns is not normal.
  • Absence of significant auto correlation in returns.
  • Slowly decreasing auto correlation in squared or absolute returns.
  • Volatility clustering.
ggplot(aes(Return), data=data) + geom_histogram(bins = 100,col='black',fill='red') + ggtitle('Return of MSFt')

skewness(data$Return); kurtosis(data$Return)
## [1] -0.5931499
## [1] 15.06746

The Skewness of the Return is -0.5931499 and Kurtosis is 15.06746. It depicts that the Return series is negatively skewed and follows Leptokurtic distributions.

ggplot(data=data, aes(sample = Return)) +
  stat_qq() +
  stat_qq_line(col='red') + ggtitle('QQ plot of MSFT Returns')

Normality Test

jarque.bera.test(na.omit(data$Return))
## 
##  Jarque Bera Test
## 
## data:  na.omit(data$Return)
## X-squared = 84474, df = 2, p-value < 2.2e-16

The P-value of the Jarque Bera Test is smaller than 0.05 at 5% level of significance. Therefore, we can reject null hypothesis and conclude that the Return series is not normally distributed.

Absence of Auto Correlation

Box.test(na.omit(data$Return), type = "Ljung-Box")
## 
##  Box-Ljung test
## 
## data:  na.omit(data$Return)
## X-squared = 2.8142, df = 1, p-value = 0.09344

The P-value of the Ljung-Box Test is 0.09344.Therefore, we can reject the null hypothesis at 1% level of significance and make a conclusion that the Return series is not independent.

Absolute Return or Squared of Return are auto correlated.

a<- ggAcf(abs(na.omit(data$Return)), col='red',main='Acf of Absolute Return of MSFT')
p<- ggPacf(abs(na.omit(data$Return)),col='steelblue',main='PAcf of Absolute Return of MSFT')
grid.arrange(a,p, ncol = 2, nrow = 1)

c <- ggAcf(na.omit(data$Return)^2, lag.max = 40, col='red', main='ACF of squared Return Values')
d<- ggPacf(na.omit(data$Return)^2,lag.max = 40, col='steelblue',main= 'PACF of squared Return Values')
grid.arrange(c,d, ncol = 2, nrow = 1)

Both Absolute Return series and Squared Return series show that Auto correlation is decaying very slowly.

Volatility Clustering

Large changes of Return follow the large changes. Small changes follow small changes.

chart.RollingPerformance(na.omit(data$Return),width = 22,FUN = 'sd.annualized',scale=252, main = 'Rolling 1 month Volatility')

Since our Return series is fail to follow the financial stylized facts. We may improve our ARIMA model by using GARCH (Generalized Auto Regressive Heteroskedasticity) model.

GARCH Model

The generalized Autoregressive conditional Heteroskedasticity (GARCH) process is an econometric term developed in 1982 by Robert F. Engle. GARCH describes an approach to estimate volatility in financial markets.GARCH process provides more real world view for predicting the returns of financial instruments than other model.

Model 1: Fit ARMA(0,0)-gjrGARCH(1,1) model with Student t-distribution

MSF_garch_1 <- ugarchspec(mean.model = list(armaOrder=c(0,0)),variance.model = list(model = 'eGARCH', 
                          garchOrder = c(1, 1)),distribution = 'std')
fit_garch_1 <- ugarchfit(spec = MSF_garch_1, data= na.omit(data$Return))
fit_garch_1
## 
## *---------------------------------*
## *          GARCH Model Fit        *
## *---------------------------------*
## 
## Conditional Variance Dynamics    
## -----------------------------------
## GARCH Model  : eGARCH(1,1)
## Mean Model   : ARFIMA(0,0,0)
## Distribution : std 
## 
## Optimal Parameters
## ------------------------------------
##         Estimate  Std. Error  t value Pr(>|t|)
## mu      0.000674    0.000165   4.0927 0.000043
## omega  -0.096264    0.047872  -2.0109 0.044340
## alpha1 -0.026744    0.009783  -2.7338 0.006261
## beta1   0.987962    0.006245 158.2018 0.000000
## gamma1  0.169737    0.100940   1.6816 0.092653
## shape   5.176175    0.295077  17.5418 0.000000
## 
## Robust Standard Errors:
##         Estimate  Std. Error  t value Pr(>|t|)
## mu      0.000674    0.001012  0.66596 0.505439
## omega  -0.096264    0.576343 -0.16703 0.867350
## alpha1 -0.026744    0.085814 -0.31165 0.755310
## beta1   0.987962    0.075266 13.12631 0.000000
## gamma1  0.169737    1.222933  0.13880 0.889612
## shape   5.176175    1.523611  3.39731 0.000681
## 
## LogLikelihood : 23205.35 
## 
## Information Criteria
## ------------------------------------
##                     
## Akaike       -5.2280
## Bayes        -5.2232
## Shibata      -5.2280
## Hannan-Quinn -5.2264
## 
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
##                         statistic p-value
## Lag[1]                   0.003928  0.9500
## Lag[2*(p+q)+(p+q)-1][2]  0.831722  0.5562
## Lag[4*(p+q)+(p+q)-1][5]  2.541918  0.4970
## d.o.f=0
## H0 : No serial correlation
## 
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
##                         statistic p-value
## Lag[1]                     0.1161  0.7333
## Lag[2*(p+q)+(p+q)-1][5]    0.5043  0.9570
## Lag[4*(p+q)+(p+q)-1][9]    1.1417  0.9796
## d.o.f=2
## 
## Weighted ARCH LM Tests
## ------------------------------------
##             Statistic Shape Scale P-Value
## ARCH Lag[3]    0.3974 0.500 2.000  0.5284
## ARCH Lag[5]    0.5973 1.440 1.667  0.8546
## ARCH Lag[7]    1.1316 2.315 1.543  0.8913
## 
## Nyblom stability test
## ------------------------------------
## Joint Statistic:  5.6875
## Individual Statistics:             
## mu     0.6969
## omega  2.3936
## alpha1 1.2314
## beta1  2.3481
## gamma1 0.2524
## shape  1.6691
## 
## 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           2.1581 0.03095  **
## Negative Sign Bias  1.9100 0.05617   *
## Positive Sign Bias  0.6805 0.49620    
## Joint Effect        5.7845 0.12258    
## 
## 
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
##   group statistic p-value(g-1)
## 1    20     33.90     0.018876
## 2    30     48.98     0.011602
## 3    40     62.41     0.010049
## 4    50     82.23     0.002062
## 
## 
## Elapsed time : 1.040843
#fit_garch_1@model
#fit_garch_1@fit
plot(fit_garch_1,which='all')
## 
## please wait...calculating quantiles...

Model 2: Fit ARMA(1,1)-gjrGARCH(1,1) model with Student t-distribution

#egarch
MSF_garch_2 <- ugarchspec(mean.model = list(armaOrder=c(1,1)),variance.model = list(model = 'eGARCH', 
                                                                                  garchOrder = c(1, 1)),distribution = 'std')

fit_garch_2 <- ugarchfit(spec = MSF_garch_2, data= na.omit(data$Return))

fit_garch_2
## 
## *---------------------------------*
## *          GARCH Model Fit        *
## *---------------------------------*
## 
## Conditional Variance Dynamics    
## -----------------------------------
## GARCH Model  : eGARCH(1,1)
## Mean Model   : ARFIMA(1,0,1)
## Distribution : std 
## 
## Optimal Parameters
## ------------------------------------
##         Estimate  Std. Error  t value Pr(>|t|)
## mu      0.000722    0.000118   6.0939 0.000000
## ar1     0.737737    0.039310  18.7672 0.000000
## ma1    -0.760336    0.037691 -20.1727 0.000000
## omega  -0.095740    0.037935  -2.5238 0.011610
## alpha1 -0.024422    0.003469  -7.0393 0.000000
## beta1   0.988036    0.004954 199.4546 0.000000
## gamma1  0.169540    0.080073   2.1173 0.034232
## shape   5.172223    0.251331  20.5793 0.000000
## 
## Robust Standard Errors:
##         Estimate  Std. Error   t value Pr(>|t|)
## mu      0.000722    0.000688   1.04996  0.29374
## ar1     0.737737    0.041052  17.97097  0.00000
## ma1    -0.760336    0.032498 -23.39630  0.00000
## omega  -0.095740    0.368302  -0.25995  0.79490
## alpha1 -0.024422    0.053229  -0.45880  0.64638
## beta1   0.988036    0.048013  20.57844  0.00000
## gamma1  0.169540    0.769785   0.22024  0.82568
## shape   5.172223    0.947173   5.46070  0.00000
## 
## LogLikelihood : 23210.44 
## 
## Information Criteria
## ------------------------------------
##                     
## Akaike       -5.2287
## Bayes        -5.2223
## Shibata      -5.2287
## Hannan-Quinn -5.2265
## 
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
##                         statistic p-value
## Lag[1]                      3.073 0.07959
## Lag[2*(p+q)+(p+q)-1][5]     3.800 0.10824
## Lag[4*(p+q)+(p+q)-1][9]     5.036 0.44557
## d.o.f=2
## H0 : No serial correlation
## 
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
##                         statistic p-value
## Lag[1]                     0.1421  0.7062
## Lag[2*(p+q)+(p+q)-1][5]    0.4960  0.9583
## Lag[4*(p+q)+(p+q)-1][9]    1.1290  0.9803
## d.o.f=2
## 
## Weighted ARCH LM Tests
## ------------------------------------
##             Statistic Shape Scale P-Value
## ARCH Lag[3]    0.3350 0.500 2.000  0.5627
## ARCH Lag[5]    0.5332 1.440 1.667  0.8738
## ARCH Lag[7]    1.0736 2.315 1.543  0.9013
## 
## Nyblom stability test
## ------------------------------------
## Joint Statistic:  6.608
## Individual Statistics:             
## mu     0.7876
## ar1    0.7664
## ma1    0.7501
## omega  2.4014
## alpha1 1.1778
## beta1  2.3568
## gamma1 0.2407
## shape  1.6613
## 
## 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           1.7757 0.07582   *
## Negative Sign Bias  1.7679 0.07711   *
## Positive Sign Bias  0.4926 0.62230    
## Joint Effect        4.3445 0.22659    
## 
## 
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
##   group statistic p-value(g-1)
## 1    20     31.35      0.03689
## 2    30     37.78      0.12734
## 3    40     47.43      0.16653
## 4    50     59.80      0.13874
## 
## 
## Elapsed time : 1.62516
plot(fit_garch_2,which='all')
## 
## please wait...calculating quantiles...

Model 3: Fit ARMA(2,2)-gjrGARCH(1,1) model with Student t-distribution

#egarch
MSF_garch_3 <- ugarchspec(mean.model = list(armaOrder=c(2,2)),variance.model = list(model = 'eGARCH', 
                                                                                  garchOrder = c(1, 1)),distribution = 'std')

fit_garch_3 <- ugarchfit(spec = MSF_garch_3, data= na.omit(data$Return))
fit_garch_3
## 
## *---------------------------------*
## *          GARCH Model Fit        *
## *---------------------------------*
## 
## Conditional Variance Dynamics    
## -----------------------------------
## GARCH Model  : eGARCH(1,1)
## Mean Model   : ARFIMA(2,0,2)
## Distribution : std 
## 
## Optimal Parameters
## ------------------------------------
##         Estimate  Std. Error     t value Pr(>|t|)
## mu      0.000718    0.000132      5.4268 0.000000
## ar1    -0.251937    0.006270    -40.1797 0.000000
## ar2     0.733549    0.007703     95.2305 0.000000
## ma1     0.228470    0.001754    130.2737 0.000000
## ma2    -0.754878    0.000017 -45601.2946 0.000000
## omega  -0.095910    0.034693     -2.7646 0.005700
## alpha1 -0.024574    0.004654     -5.2799 0.000000
## beta1   0.988015    0.004520    218.5971 0.000000
## gamma1  0.169683    0.072821      2.3301 0.019799
## shape   5.169010    0.271710     19.0240 0.000000
## 
## Robust Standard Errors:
##         Estimate  Std. Error     t value Pr(>|t|)
## mu      0.000718    0.000857  8.3803e-01  0.40201
## ar1    -0.251937    0.029737 -8.4723e+00  0.00000
## ar2     0.733549    0.022725  3.2279e+01  0.00000
## ma1     0.228470    0.009469  2.4129e+01  0.00000
## ma2    -0.754878    0.000020 -3.7447e+04  0.00000
## omega  -0.095910    0.307994 -3.1140e-01  0.75549
## alpha1 -0.024574    0.041211 -5.9629e-01  0.55098
## beta1   0.988015    0.040048  2.4671e+01  0.00000
## gamma1  0.169683    0.639055  2.6552e-01  0.79061
## shape   5.169010    0.926521  5.5789e+00  0.00000
## 
## LogLikelihood : 23210.8 
## 
## Information Criteria
## ------------------------------------
##                     
## Akaike       -5.2283
## Bayes        -5.2204
## Shibata      -5.2284
## Hannan-Quinn -5.2256
## 
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
##                          statistic p-value
## Lag[1]                       3.348 0.06729
## Lag[2*(p+q)+(p+q)-1][11]     6.187 0.36705
## Lag[4*(p+q)+(p+q)-1][19]     9.824 0.49781
## d.o.f=4
## H0 : No serial correlation
## 
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
##                         statistic p-value
## Lag[1]                     0.1409  0.7074
## Lag[2*(p+q)+(p+q)-1][5]    0.4969  0.9582
## Lag[4*(p+q)+(p+q)-1][9]    1.1324  0.9801
## d.o.f=2
## 
## Weighted ARCH LM Tests
## ------------------------------------
##             Statistic Shape Scale P-Value
## ARCH Lag[3]    0.3403 0.500 2.000  0.5597
## ARCH Lag[5]    0.5416 1.440 1.667  0.8713
## ARCH Lag[7]    1.0833 2.315 1.543  0.8996
## 
## Nyblom stability test
## ------------------------------------
## Joint Statistic:  7.0743
## Individual Statistics:             
## mu     0.7985
## ar1    0.1645
## ar2    0.4126
## ma1    0.1633
## ma2    0.4456
## omega  2.4022
## alpha1 1.1664
## beta1  2.3571
## gamma1 0.2406
## shape  1.6641
## 
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic:          2.29 2.54 3.05
## Individual Statistic:     0.35 0.47 0.75
## 
## Sign Bias Test
## ------------------------------------
##                    t-value    prob sig
## Sign Bias           1.9258 0.05416   *
## Negative Sign Bias  1.8304 0.06723   *
## Positive Sign Bias  0.5817 0.56081    
## Joint Effect        4.8859 0.18034    
## 
## 
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
##   group statistic p-value(g-1)
## 1    20     27.93      0.08488
## 2    30     42.04      0.05564
## 3    40     44.86      0.23944
## 4    50     63.23      0.08326
## 
## 
## Elapsed time : 2.932308
plot(fit_garch_3,which='all')
## 
## please wait...calculating quantiles...

Model 4: Fit ARMA(0,0)-eGARCH(1,2) model with Student t-distribution

#egarch
MSF_garch_4 <- ugarchspec(mean.model = list(armaOrder=c(1,2)),variance.model = list(model = 'eGARCH', 
                                                                                  garchOrder = c(1, 1)),distribution = 'std')

fit_garch_4 <- ugarchfit(spec = MSF_garch_4, data= na.omit(data$Return))
fit_garch_4
## 
## *---------------------------------*
## *          GARCH Model Fit        *
## *---------------------------------*
## 
## Conditional Variance Dynamics    
## -----------------------------------
## GARCH Model  : eGARCH(1,1)
## Mean Model   : ARFIMA(1,0,2)
## Distribution : std 
## 
## Optimal Parameters
## ------------------------------------
##         Estimate  Std. Error    t value Pr(>|t|)
## mu      0.000722    0.000119   6.071822 0.000000
## ar1     0.737177    0.036047  20.450184 0.000000
## ma1    -0.759672    0.036463 -20.833873 0.000000
## ma2    -0.000167    0.009724  -0.017215 0.986265
## omega  -0.095675    0.035433  -2.700162 0.006931
## alpha1 -0.024455    0.004145  -5.900204 0.000000
## beta1   0.988044    0.004626 213.603865 0.000000
## gamma1  0.169475    0.074795   2.265863 0.023460
## shape   5.174282    0.252134  20.521969 0.000000
## 
## Robust Standard Errors:
##         Estimate  Std. Error    t value Pr(>|t|)
## mu      0.000722    0.000650   1.110621  0.26673
## ar1     0.737177    0.011370  64.835172  0.00000
## ma1    -0.759672    0.014449 -52.576420  0.00000
## ma2    -0.000167    0.031586  -0.005299  0.99577
## omega  -0.095675    0.321272  -0.297802  0.76585
## alpha1 -0.024455    0.045421  -0.538413  0.59029
## beta1   0.988044    0.041859  23.604220  0.00000
## gamma1  0.169475    0.670562   0.252736  0.80047
## shape   5.174282    0.877205   5.898600  0.00000
## 
## LogLikelihood : 23210.37 
## 
## Information Criteria
## ------------------------------------
##                     
## Akaike       -5.2285
## Bayes        -5.2213
## Shibata      -5.2285
## Hannan-Quinn -5.2260
## 
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
##                          statistic p-value
## Lag[1]                       3.062 0.08014
## Lag[2*(p+q)+(p+q)-1][8]      4.808 0.29572
## Lag[4*(p+q)+(p+q)-1][14]     7.104 0.53977
## d.o.f=3
## H0 : No serial correlation
## 
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
##                         statistic p-value
## Lag[1]                     0.1438  0.7046
## Lag[2*(p+q)+(p+q)-1][5]    0.4975  0.9581
## Lag[4*(p+q)+(p+q)-1][9]    1.1291  0.9803
## d.o.f=2
## 
## Weighted ARCH LM Tests
## ------------------------------------
##             Statistic Shape Scale P-Value
## ARCH Lag[3]    0.3346 0.500 2.000  0.5629
## ARCH Lag[5]    0.5322 1.440 1.667  0.8741
## ARCH Lag[7]    1.0710 2.315 1.543  0.9017
## 
## Nyblom stability test
## ------------------------------------
## Joint Statistic:  8.2121
## Individual Statistics:             
## mu     0.7879
## ar1    0.7681
## ma1    0.7518
## ma2    0.2596
## omega  2.4068
## alpha1 1.1699
## beta1  2.3618
## gamma1 0.2409
## shape  1.6681
## 
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic:          2.1 2.32 2.82
## Individual Statistic:     0.35 0.47 0.75
## 
## Sign Bias Test
## ------------------------------------
##                    t-value    prob sig
## Sign Bias           1.7767 0.07565   *
## Negative Sign Bias  1.7687 0.07697   *
## Positive Sign Bias  0.4914 0.62316    
## Joint Effect        4.3496 0.22611    
## 
## 
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
##   group statistic p-value(g-1)
## 1    20     31.37      0.03677
## 2    30     38.39      0.11397
## 3    40     48.17      0.14893
## 4    50     60.25      0.13013
## 
## 
## Elapsed time : 1.653885
plot(fit_garch_4,which='all')
## 
## please wait...calculating quantiles...

Model 5: Fit ARMA(1,1)-eGARCH(2,1) model with Student t-distribution

#egarch
MSF_garch_5 <- ugarchspec(mean.model = list(armaOrder=c(2,1)),variance.model = list(model = 'eGARCH', 
                                                                                  garchOrder = c(1, 1)),distribution = 'std')

fit_garch_5 <- ugarchfit(spec = MSF_garch_5, data= na.omit(data$Return))
fit_garch_5
## 
## *---------------------------------*
## *          GARCH Model Fit        *
## *---------------------------------*
## 
## Conditional Variance Dynamics    
## -----------------------------------
## GARCH Model  : eGARCH(1,1)
## Mean Model   : ARFIMA(2,0,1)
## Distribution : std 
## 
## Optimal Parameters
## ------------------------------------
##         Estimate  Std. Error    t value Pr(>|t|)
## mu      0.000721    0.000120   5.991600 0.000000
## ar1     0.734690    0.034931  21.032555 0.000000
## ar2    -0.000549    0.010063  -0.054603 0.956455
## ma1    -0.756857    0.035534 -21.299298 0.000000
## omega  -0.095739    0.038172  -2.508075 0.012139
## alpha1 -0.024491    0.003552  -6.894191 0.000000
## beta1   0.988036    0.004983 198.278199 0.000000
## gamma1  0.169513    0.080573   2.103851 0.035391
## shape   5.174384    0.249678  20.724233 0.000000
## 
## Robust Standard Errors:
##         Estimate  Std. Error    t value Pr(>|t|)
## mu      0.000721    0.000741   0.974079  0.33002
## ar1     0.734690    0.011581  63.440149  0.00000
## ar2    -0.000549    0.030044  -0.018289  0.98541
## ma1    -0.756857    0.013241 -57.158710  0.00000
## omega  -0.095739    0.372348  -0.257123  0.79708
## alpha1 -0.024491    0.053055  -0.461618  0.64436
## beta1   0.988036    0.048526  20.361093  0.00000
## gamma1  0.169513    0.778327   0.217792  0.82759
## shape   5.174384    0.996785   5.191071  0.00000
## 
## LogLikelihood : 23210.3 
## 
## Information Criteria
## ------------------------------------
##                     
## Akaike       -5.2285
## Bayes        -5.2213
## Shibata      -5.2285
## Hannan-Quinn -5.2260
## 
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
##                          statistic p-value
## Lag[1]                       2.971 0.08479
## Lag[2*(p+q)+(p+q)-1][8]      4.730 0.33948
## Lag[4*(p+q)+(p+q)-1][14]     7.022 0.55593
## d.o.f=3
## H0 : No serial correlation
## 
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
##                         statistic p-value
## Lag[1]                     0.1428  0.7055
## Lag[2*(p+q)+(p+q)-1][5]    0.4967  0.9582
## Lag[4*(p+q)+(p+q)-1][9]    1.1290  0.9803
## d.o.f=2
## 
## Weighted ARCH LM Tests
## ------------------------------------
##             Statistic Shape Scale P-Value
## ARCH Lag[3]    0.3350 0.500 2.000  0.5627
## ARCH Lag[5]    0.5331 1.440 1.667  0.8738
## ARCH Lag[7]    1.0724 2.315 1.543  0.9015
## 
## Nyblom stability test
## ------------------------------------
## Joint Statistic:  8.265
## Individual Statistics:             
## mu     0.7869
## ar1    0.7816
## ar2    0.2611
## ma1    0.7653
## omega  2.4056
## alpha1 1.1721
## beta1  2.3608
## gamma1 0.2412
## shape  1.6682
## 
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic:          2.1 2.32 2.82
## Individual Statistic:     0.35 0.47 0.75
## 
## Sign Bias Test
## ------------------------------------
##                    t-value    prob sig
## Sign Bias           1.7765 0.07568   *
## Negative Sign Bias  1.7679 0.07711   *
## Positive Sign Bias  0.4916 0.62302    
## Joint Effect        4.3471 0.22634    
## 
## 
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
##   group statistic p-value(g-1)
## 1    20     32.39      0.02822
## 2    30     37.56      0.13254
## 3    40     47.98      0.15330
## 4    50     61.10      0.11510
## 
## 
## Elapsed time : 1.680486
plot(fit_garch_5,which='all')
## 
## please wait...calculating quantiles...

Model 6: Fit ARMA(3,1)-eGARCH(1,1) model with Student t-distribution

#egarch
MSF_garch_6 <- ugarchspec(mean.model = list(armaOrder=c(3,1)),variance.model = list(model = 'eGARCH', 
                                                                                  garchOrder = c(1, 1)),distribution = 'std')

fit_garch_6 <- ugarchfit(spec = MSF_garch_6, data= na.omit(data$Return))
fit_garch_6
## 
## *---------------------------------*
## *          GARCH Model Fit        *
## *---------------------------------*
## 
## Conditional Variance Dynamics    
## -----------------------------------
## GARCH Model  : eGARCH(1,1)
## Mean Model   : ARFIMA(3,0,1)
## Distribution : std 
## 
## Optimal Parameters
## ------------------------------------
##         Estimate  Std. Error   t value Pr(>|t|)
## mu      0.000721    0.000107   6.75237 0.000000
## ar1     0.720058    0.026824  26.84377 0.000000
## ar2     0.001883    0.011016   0.17097 0.864248
## ar3    -0.003586    0.009728  -0.36861 0.712417
## ma1    -0.742411    0.026782 -27.72025 0.000000
## omega  -0.095848    0.035359  -2.71069 0.006714
## alpha1 -0.024569    0.004295  -5.72046 0.000000
## beta1   0.988022    0.004613 214.16474 0.000000
## gamma1  0.169638    0.074652   2.27239 0.023063
## shape   5.173317    0.251486  20.57103 0.000000
## 
## Robust Standard Errors:
##         Estimate  Std. Error    t value Pr(>|t|)
## mu      0.000721    0.000728   0.991325  0.32153
## ar1     0.720058    0.009713  74.132352  0.00000
## ar2     0.001883    0.024206   0.077808  0.93798
## ar3    -0.003586    0.044132  -0.081252  0.93524
## ma1    -0.742411    0.025442 -29.180679  0.00000
## omega  -0.095848    0.319760  -0.299749  0.76437
## alpha1 -0.024569    0.044313  -0.554433  0.57928
## beta1   0.988022    0.041640  23.727612  0.00000
## gamma1  0.169638    0.667513   0.254134  0.79939
## shape   5.173317    0.889105   5.818566  0.00000
## 
## LogLikelihood : 23210.31 
## 
## Information Criteria
## ------------------------------------
##                     
## Akaike       -5.2282
## Bayes        -5.2202
## Shibata      -5.2282
## Hannan-Quinn -5.2255
## 
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
##                          statistic p-value
## Lag[1]                       3.005 0.08303
## Lag[2*(p+q)+(p+q)-1][11]     5.652 0.71041
## Lag[4*(p+q)+(p+q)-1][19]     9.218 0.60135
## d.o.f=4
## H0 : No serial correlation
## 
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
##                         statistic p-value
## Lag[1]                     0.1422  0.7061
## Lag[2*(p+q)+(p+q)-1][5]    0.4933  0.9587
## Lag[4*(p+q)+(p+q)-1][9]    1.1257  0.9804
## d.o.f=2
## 
## Weighted ARCH LM Tests
## ------------------------------------
##             Statistic Shape Scale P-Value
## ARCH Lag[3]    0.3297 0.500 2.000  0.5658
## ARCH Lag[5]    0.5277 1.440 1.667  0.8754
## ARCH Lag[7]    1.0677 2.315 1.543  0.9023
## 
## Nyblom stability test
## ------------------------------------
## Joint Statistic:  8.3681
## Individual Statistics:             
## mu     0.7944
## ar1    0.8136
## ar2    0.2457
## ar3    0.2551
## ma1    0.7979
## omega  2.4063
## alpha1 1.1695
## beta1  2.3618
## gamma1 0.2410
## shape  1.6689
## 
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic:          2.29 2.54 3.05
## Individual Statistic:     0.35 0.47 0.75
## 
## Sign Bias Test
## ------------------------------------
##                    t-value    prob sig
## Sign Bias            1.748 0.08055   *
## Negative Sign Bias   1.752 0.07985   *
## Positive Sign Bias   0.479 0.63195    
## Joint Effect         4.239 0.23681    
## 
## 
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
##   group statistic p-value(g-1)
## 1    20     30.32      0.04788
## 2    30     37.82      0.12641
## 3    40     48.51      0.14147
## 4    50     64.25      0.07072
## 
## 
## Elapsed time : 1.960155
plot(fit_garch_6,which='all')
## 
## please wait...calculating quantiles...

Model 7: Fit ARMA(3,2)-eGARCH(1,1) model with Student t-distribution

#egarch
MSF_garch_7 <- ugarchspec(mean.model = list(armaOrder=c(3,2)),variance.model = list(model = 'eGARCH', 
                                                                                  garchOrder = c(1, 1)),distribution = 'std')

fit_garch_7 <- ugarchfit(spec = MSF_garch_7, data= na.omit(data$Return))
fit_garch_7
## 
## *---------------------------------*
## *          GARCH Model Fit        *
## *---------------------------------*
## 
## Conditional Variance Dynamics    
## -----------------------------------
## GARCH Model  : eGARCH(1,1)
## Mean Model   : ARFIMA(3,0,2)
## Distribution : std 
## 
## Optimal Parameters
## ------------------------------------
##         Estimate  Std. Error    t value Pr(>|t|)
## mu      0.000722    0.000124   5.832853 0.000000
## ar1     0.165257    0.025477   6.486593 0.000000
## ar2     0.424200    0.014572  29.111093 0.000000
## ar3     0.000615    0.009699   0.063398 0.949450
## ma1    -0.187523    0.025660  -7.308048 0.000000
## ma2    -0.437368    0.014326 -30.528708 0.000000
## omega  -0.095701    0.036738  -2.604948 0.009189
## alpha1 -0.024512    0.003858  -6.354288 0.000000
## beta1   0.988041    0.004797 205.991416 0.000000
## gamma1  0.169473    0.077582   2.184443 0.028930
## shape   5.173831    0.251046  20.609061 0.000000
## 
## Robust Standard Errors:
##         Estimate  Std. Error    t value Pr(>|t|)
## mu      0.000722    0.000678   1.066021  0.28641
## ar1     0.165257    0.024952   6.622963  0.00000
## ar2     0.424200    0.005908  71.799317  0.00000
## ar3     0.000615    0.029649   0.020738  0.98345
## ma1    -0.187523    0.011124 -16.857091  0.00000
## ma2    -0.437368    0.007152 -61.154651  0.00000
## omega  -0.095701    0.345118  -0.277299  0.78155
## alpha1 -0.024512    0.049174  -0.498475  0.61815
## beta1   0.988041    0.044977  21.967481  0.00000
## gamma1  0.169473    0.721197   0.234989  0.81422
## shape   5.173831    0.929696   5.565081  0.00000
## 
## LogLikelihood : 23210.27 
## 
## Information Criteria
## ------------------------------------
##                     
## Akaike       -5.2280
## Bayes        -5.2192
## Shibata      -5.2280
## Hannan-Quinn -5.2250
## 
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
##                          statistic p-value
## Lag[1]                       2.996 0.08346
## Lag[2*(p+q)+(p+q)-1][14]     6.999 0.79710
## Lag[4*(p+q)+(p+q)-1][24]    11.641 0.60297
## d.o.f=5
## H0 : No serial correlation
## 
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
##                         statistic p-value
## Lag[1]                     0.1426  0.7058
## Lag[2*(p+q)+(p+q)-1][5]    0.4986  0.9579
## Lag[4*(p+q)+(p+q)-1][9]    1.1311  0.9802
## d.o.f=2
## 
## Weighted ARCH LM Tests
## ------------------------------------
##             Statistic Shape Scale P-Value
## ARCH Lag[3]    0.3383 0.500 2.000  0.5608
## ARCH Lag[5]    0.5358 1.440 1.667  0.8730
## ARCH Lag[7]    1.0751 2.315 1.543  0.9010
## 
## Nyblom stability test
## ------------------------------------
## Joint Statistic:  8.4169
## Individual Statistics:             
## mu     0.7925
## ar1    1.3859
## ar2    0.1537
## ar3    0.2269
## ma1    1.3543
## ma2    0.1600
## omega  2.4018
## alpha1 1.1678
## beta1  2.3570
## gamma1 0.2413
## shape  1.6692
## 
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic:          2.49 2.75 3.27
## Individual Statistic:     0.35 0.47 0.75
## 
## Sign Bias Test
## ------------------------------------
##                    t-value    prob sig
## Sign Bias           1.7615 0.07819   *
## Negative Sign Bias  1.7604 0.07838   *
## Positive Sign Bias  0.4848 0.62783    
## Joint Effect        4.2935 0.23147    
## 
## 
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
##   group statistic p-value(g-1)
## 1    20     33.08      0.02353
## 2    30     37.44      0.13529
## 3    40     47.49      0.16519
## 4    50     62.30      0.09606
## 
## 
## Elapsed time : 2.153374

Model 8: Fit ARMA(3,1)-eGARCH(1,1) model with Student t-distribution

#egarch
MSF_garch_8 <- ugarchspec(mean.model = list(armaOrder=c(1,3)),variance.model = list(model = 'eGARCH', 
                                                                                  garchOrder = c(1, 1)),distribution = 'std')

fit_garch_8 <- ugarchfit(spec = MSF_garch_8, data= na.omit(data$Return))
fit_garch_8
## 
## *---------------------------------*
## *          GARCH Model Fit        *
## *---------------------------------*
## 
## Conditional Variance Dynamics    
## -----------------------------------
## GARCH Model  : eGARCH(1,1)
## Mean Model   : ARFIMA(1,0,3)
## Distribution : std 
## 
## Optimal Parameters
## ------------------------------------
##         Estimate  Std. Error   t value Pr(>|t|)
## mu      0.000720    0.000109   6.61357 0.000000
## ar1     0.720174    0.034734  20.73404 0.000000
## ma1    -0.742752    0.035512 -20.91543 0.000000
## ma2     0.001341    0.011700   0.11458 0.908781
## ma3    -0.002988    0.008777  -0.34049 0.733485
## omega  -0.095828    0.038726  -2.47454 0.013341
## alpha1 -0.024538    0.003383  -7.25318 0.000000
## beta1   0.988024    0.005056 195.42481 0.000000
## gamma1  0.169603    0.081774   2.07404 0.038075
## shape   5.174271    0.248934  20.78571 0.000000
## 
## Robust Standard Errors:
##         Estimate  Std. Error    t value Pr(>|t|)
## mu      0.000720    0.000725   0.993781  0.32033
## ar1     0.720174    0.012481  57.703425  0.00000
## ma1    -0.742752    0.032153 -23.100368  0.00000
## ma2     0.001341    0.019680   0.068119  0.94569
## ma3    -0.002988    0.028417  -0.105163  0.91625
## omega  -0.095828    0.382645  -0.250436  0.80225
## alpha1 -0.024538    0.054639  -0.449101  0.65336
## beta1   0.988024    0.049875  19.810130  0.00000
## gamma1  0.169603    0.800383   0.211902  0.83218
## shape   5.174271    1.026190   5.042216  0.00000
## 
## LogLikelihood : 23210.41 
## 
## Information Criteria
## ------------------------------------
##                     
## Akaike       -5.2283
## Bayes        -5.2203
## Shibata      -5.2283
## Hannan-Quinn -5.2255
## 
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
##                          statistic p-value
## Lag[1]                       3.074 0.07957
## Lag[2*(p+q)+(p+q)-1][11]     5.697 0.68330
## Lag[4*(p+q)+(p+q)-1][19]     9.279 0.59089
## d.o.f=4
## H0 : No serial correlation
## 
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
##                         statistic p-value
## Lag[1]                     0.1433  0.7050
## Lag[2*(p+q)+(p+q)-1][5]    0.4942  0.9586
## Lag[4*(p+q)+(p+q)-1][9]    1.1261  0.9804
## d.o.f=2
## 
## Weighted ARCH LM Tests
## ------------------------------------
##             Statistic Shape Scale P-Value
## ARCH Lag[3]    0.3300 0.500 2.000  0.5657
## ARCH Lag[5]    0.5278 1.440 1.667  0.8754
## ARCH Lag[7]    1.0671 2.315 1.543  0.9024
## 
## Nyblom stability test
## ------------------------------------
## Joint Statistic:  8.3505
## Individual Statistics:             
## mu     0.7922
## ar1    0.7853
## ma1    0.7695
## ma2    0.2577
## ma3    0.2609
## omega  2.4063
## alpha1 1.1697
## beta1  2.3617
## gamma1 0.2407
## shape  1.6655
## 
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic:          2.29 2.54 3.05
## Individual Statistic:     0.35 0.47 0.75
## 
## Sign Bias Test
## ------------------------------------
##                    t-value    prob sig
## Sign Bias           1.7751 0.07592   *
## Negative Sign Bias  1.7650 0.07760   *
## Positive Sign Bias  0.4925 0.62241    
## Joint Effect        4.3375 0.22725    
## 
## 
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
##   group statistic p-value(g-1)
## 1    20     30.48      0.04599
## 2    30     38.75      0.10650
## 3    40     47.54      0.16386
## 4    50     63.53      0.07936
## 
## 
## Elapsed time : 2.112146
Model = c('fit_garch_1','fit_garch_2','fit_garch_3','fit_garch_4','fit_garch_5','fit_garch_6','fit_garch_7','fit_garch_8')
AIC = c(-5.2280,-5.2287,-5.2283,-5.2285,-5.2285,-5.2282,-5.2280,-5.2283)
(model <- data.frame(Model,AIC))
##         Model     AIC
## 1 fit_garch_1 -5.2280
## 2 fit_garch_2 -5.2287
## 3 fit_garch_3 -5.2283
## 4 fit_garch_4 -5.2285
## 5 fit_garch_5 -5.2285
## 6 fit_garch_6 -5.2282
## 7 fit_garch_7 -5.2280
## 8 fit_garch_8 -5.2283
which.min(model[,'AIC'])
## [1] 2

Model Selection

Based on Information Criterion among different models we selected ARMA(1,1) and GARCH(1,1).

  • All the coefficients of mean model of EGARCH are highly significant.
  • The Coefficients of variance model are also highly significant.
  • The Shape parameter is higly significant as P value is smaller than 5% level of significance. Which suggest that choosing the Student t distribution is a good choice.
  • The variance model parameter \(\alpha\) coefficient value is -0.024422 and \(\gamma\) coefficient is 0.169540. It is evident that leverage effect is exist and Negative shocks is larger than the impulse of Positive shocks.
  • The persistence of volatility is 0.9880358 .Volatility is said to be persistent if today’s return has a large effect on the unconditional variance of many periods in the future.
  • All the P-values for the Ljung Box Test of residuals are > 0.05, thus indicating that there is no evidence of serial correlation in the squared residuals. Hence it behaves as White Noise.

The Selected Model

fit_garch_2    #arma(1,1) & egarch(1,1)
## 
## *---------------------------------*
## *          GARCH Model Fit        *
## *---------------------------------*
## 
## Conditional Variance Dynamics    
## -----------------------------------
## GARCH Model  : eGARCH(1,1)
## Mean Model   : ARFIMA(1,0,1)
## Distribution : std 
## 
## Optimal Parameters
## ------------------------------------
##         Estimate  Std. Error  t value Pr(>|t|)
## mu      0.000722    0.000118   6.0939 0.000000
## ar1     0.737737    0.039310  18.7672 0.000000
## ma1    -0.760336    0.037691 -20.1727 0.000000
## omega  -0.095740    0.037935  -2.5238 0.011610
## alpha1 -0.024422    0.003469  -7.0393 0.000000
## beta1   0.988036    0.004954 199.4546 0.000000
## gamma1  0.169540    0.080073   2.1173 0.034232
## shape   5.172223    0.251331  20.5793 0.000000
## 
## Robust Standard Errors:
##         Estimate  Std. Error   t value Pr(>|t|)
## mu      0.000722    0.000688   1.04996  0.29374
## ar1     0.737737    0.041052  17.97097  0.00000
## ma1    -0.760336    0.032498 -23.39630  0.00000
## omega  -0.095740    0.368302  -0.25995  0.79490
## alpha1 -0.024422    0.053229  -0.45880  0.64638
## beta1   0.988036    0.048013  20.57844  0.00000
## gamma1  0.169540    0.769785   0.22024  0.82568
## shape   5.172223    0.947173   5.46070  0.00000
## 
## LogLikelihood : 23210.44 
## 
## Information Criteria
## ------------------------------------
##                     
## Akaike       -5.2287
## Bayes        -5.2223
## Shibata      -5.2287
## Hannan-Quinn -5.2265
## 
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
##                         statistic p-value
## Lag[1]                      3.073 0.07959
## Lag[2*(p+q)+(p+q)-1][5]     3.800 0.10824
## Lag[4*(p+q)+(p+q)-1][9]     5.036 0.44557
## d.o.f=2
## H0 : No serial correlation
## 
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
##                         statistic p-value
## Lag[1]                     0.1421  0.7062
## Lag[2*(p+q)+(p+q)-1][5]    0.4960  0.9583
## Lag[4*(p+q)+(p+q)-1][9]    1.1290  0.9803
## d.o.f=2
## 
## Weighted ARCH LM Tests
## ------------------------------------
##             Statistic Shape Scale P-Value
## ARCH Lag[3]    0.3350 0.500 2.000  0.5627
## ARCH Lag[5]    0.5332 1.440 1.667  0.8738
## ARCH Lag[7]    1.0736 2.315 1.543  0.9013
## 
## Nyblom stability test
## ------------------------------------
## Joint Statistic:  6.608
## Individual Statistics:             
## mu     0.7876
## ar1    0.7664
## ma1    0.7501
## omega  2.4014
## alpha1 1.1778
## beta1  2.3568
## gamma1 0.2407
## shape  1.6613
## 
## 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           1.7757 0.07582   *
## Negative Sign Bias  1.7679 0.07711   *
## Positive Sign Bias  0.4926 0.62230    
## Joint Effect        4.3445 0.22659    
## 
## 
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
##   group statistic p-value(g-1)
## 1    20     31.35      0.03689
## 2    30     37.78      0.12734
## 3    40     47.43      0.16653
## 4    50     59.80      0.13874
## 
## 
## Elapsed time : 1.62516
persistence(fit_garch_2)    #Persistence of valatility
## [1] 0.9880358
plot(fit_garch_2,which='all')   
## 
## please wait...calculating quantiles...

Convergence of the Model

print(convergence(fit_garch_2))   # The model converge
## [1] 0

Forecasting

for_cast1 <-ugarchforecast(fit_garch_2,data=data,n.ahead=20)
for_cast1
## 
## *------------------------------------*
## *       GARCH Model Forecast         *
## *------------------------------------*
## Model: eGARCH
## Horizon: 20
## Roll Steps: 0
## Out of Sample: 0
## 
## 0-roll forecast [T0=2021-05-28]:
##         Series   Sigma
## T+1  0.0007120 0.01446
## T+2  0.0007146 0.01450
## T+3  0.0007165 0.01454
## T+4  0.0007180 0.01458
## T+5  0.0007190 0.01462
## T+6  0.0007198 0.01466
## T+7  0.0007204 0.01470
## T+8  0.0007208 0.01474
## T+9  0.0007211 0.01478
## T+10 0.0007213 0.01481
## T+11 0.0007215 0.01485
## T+12 0.0007216 0.01489
## T+13 0.0007217 0.01493
## T+14 0.0007218 0.01496
## T+15 0.0007218 0.01500
## T+16 0.0007219 0.01503
## T+17 0.0007219 0.01507
## T+18 0.0007219 0.01510
## T+19 0.0007219 0.01514
## T+20 0.0007219 0.01517

Rolling Forecast

fit_roll <- ugarchfit(MSF_garch_2, data= na.omit(data$Return),out.sample =500)
fore_roll <- ugarchforecast(fit_roll, n.ahead=20, n.roll=50)
fore_roll
## 
## *------------------------------------*
## *       GARCH Model Forecast         *
## *------------------------------------*
## Model: eGARCH
## Horizon: 20
## Roll Steps: 50
## Out of Sample: 20
## 
## 0-roll forecast [T0=2019-06-05]:
##         Series   Sigma
## T+1  0.0004230 0.01750
## T+2  0.0004722 0.01751
## T+3  0.0005099 0.01751
## T+4  0.0005387 0.01752
## T+5  0.0005607 0.01753
## T+6  0.0005775 0.01754
## T+7  0.0005904 0.01754
## T+8  0.0006003 0.01755
## T+9  0.0006078 0.01756
## T+10 0.0006136 0.01756
## T+11 0.0006180 0.01757
## T+12 0.0006213 0.01758
## T+13 0.0006239 0.01759
## T+14 0.0006259 0.01759
## T+15 0.0006274 0.01760
## T+16 0.0006286 0.01761
## T+17 0.0006294 0.01761
## T+18 0.0006301 0.01762
## T+19 0.0006306 0.01763
## T+20 0.0006310 0.01763
par(mfrow=c(1,2))
plot(fore_roll,which=1)
plot(fore_roll,which=2)

par(mfrow=c(1,2))
plot(fore_roll,which=3)
plot(fore_roll,which=4)

Forecasting using Bootstrap

par(mfrow=c(1,2))
fore_boot <- ugarchboot(fit_garch_5,data = na.omit(data$Return), method = c("Partial", "Full")[1], n.ahead = 20, n.bootpred = 500)
plot(fore_boot,which=2)
plot(fore_boot,which=3)

head(sigma(for_cast1))
##     2021-05-28
## T+1 0.01446054
## T+2 0.01450130
## T+3 0.01454168
## T+4 0.01458170
## T+5 0.01462134
## T+6 0.01466061