Advanced Statistics with R code 90% doen just check it and make a summary
CSC425 – Time series analysis and forecasting
Homework 5 – not be submitted
The goal of this assignment is to provide students with some practical training on
GARCH/EGARCH/TGARCH models for the analysis of the volatility of a stock return.
Solutions will be posted on Thursday November 7th 2013
Reading assignment:
1. Read Chapter 4 in short book and Chapter 3 in long book on volatility models 2. Review course documents posted under week 7 and 8.
Problem
Use the datafile nordstrom_w_00_13.csv that contains the Nordstrom (JWN ) stock weekly prices
from January 2000 to October 2013. The data file contains dates (date), daily prices (price). You
can also use the code and the analysis of the S&P500 returns used in week 7 and 8 lectures as
your reference for the analysis of this data. Analyze the Nordstrom stock log returns following
the steps below.
1. Compute log returns, and analyze their time plot.
Moments
N 693 Sum Weights 693
Mean 0.00268299 Sum Observations 1.85931229
Std Deviation 0.06068019 Variance 0.00368209
Skewness -0.2804891 Kurtosis 7.55351876
Uncorrected SS 2.55299156 Corrected SS 2.54800304
Coeff Variation 2261.66262 Std Error Mean 0.00230505
Time plot of returns show that Nordstrom stock returns shows periods of high volatility at
various times, and consistently high volatility from 2007 to 2010. Most returns are
between +/- 10%. Sample moments show that distribution of log returns is somewhat
symmetric with very fat tails (kurtosis = 7.55).
return
-0.5
-0.4
-0.3
-0.2
-0.1
0.0
0.1
0.2
0.3
0.4
date
01/01/2000 01/01/2002 01/01/2004 01/01/2006 01/01/2008 01/01/2010 01/01/2012 01/01/2014 01/01/2016
2. Is there evidence of serial correlations in the log returns? Use autocorrelations and 5% significance level to answer the question.
Log returns are not serially correlated as shown by the Ljung-Box test with p-values >
0.05 and the autocorrelation plot. .
Name of Variable = return
Mean of Working Series 0.002683
Standard Deviation 0.060636
Number of Observations 693
Autocorrelation Check for White Noise
To Chi- Pr >
Lag Square DF ChiSq --------------------Autocorrelations--------------------
6 6.16 6 0.4050 -0.009 0.011 -0.048 -0.009 0.078 -0.006
12 9.08 12 0.6957 -0.042 -0.038 -0.019 0.011 -0.015 0.016
18 26.17 18 0.0960 0.033 -0.026 0.088 -0.032 0.101 -0.056
24 31.58 24 0.1377 0.029 -0.037 0.025 -0.042 -0.026 -0.048
30 33.84 30 0.2871 -0.029 -0.003 -0.037 0.023 0.011 -0.016
3. Is there evidence of ARCH effects in the log returns? Use appropriate tests at 5% significance level to answer this question.
The analysis below shows a strong ARCH effect. The squared returns are strongly
correlated. The Ljung-Box tests on squared residuals are highly significant with p-values
< 0.001, and autocorrelation plots shows large autocorrelations for the first 10 lags.
Name of Variable = returnsq
Mean of Working Series 0.003684
Standard Deviation 0.011302
Number of Observations 693
Autocorrelation Check for White Noise
To Chi- Pr >
Lag Square DF ChiSq --------------------Autocorrelations--------------------
6 331.56 6 <.0001 0.534 0.281 0.123 0.101 0.167 0.240
12 407.05 12 <.0001 0.246 0.187 0.053 0.036 0.032 0.082
18 469.70 18 <.0001 0.069 0.072 0.128 0.127 0.156 0.145
24 494.90 24 <.0001 0.149 0.090 0.050 0.035 0.014 0.031
30 501.01 30 <.0001 0.033 0.064 0.051 0.023 0.010 -0.004
4. Fit an GARCH(1,1) model for the log returns using a t- distribution for the error terms. Perform model checking (analyze if residuals are white noise, if squared residuals are
white noise, and check if t-distribution is a good fit for the data) and write down the fitted
model.
The GARCH model with t-distribution is an adequate model for the volatility of the
returns. All parameters are significant and the squared residuals are white noise (LB
tests on squared residuals are non significant).
Fitted GARCH model can be expressed as follows:
rt=0.005 +at
at=σtet with σt 2 =0.1483 a
2 t-1+0.836 σ
2 t-1
(Intercept ARCH0 can be considered equal to zero)
Where error term et has t-distribution with 1/0.185=5 degrees of freedom.
The AUTOREG Procedure
GARCH Estimates
SSE 2.55069233 Observations 693
MSE 0.00368 Uncond Var 0.00531549
Log Likelihood 1102.73026 Total R-Square .
SBC -2172.7554 AIC -2195.4605
MAE 0.04086373 AICC -2195.3732
MAPE 113.334007 HQC -2186.6796
Normality Test 126.0152
Pr > ChiSq <.0001
Parameter Estimates
Standard Approx
Variable DF Estimate Error t Value Pr > |t|
Intercept 1 0.004653 0.001570 2.96 0.0030
ARCH0 1 0.0000848 0.0000429 1.98 0.0482
ARCH1 1 0.1483 0.0369 4.01 <.0001
GARCH1 1 0.8358 0.0359 23.30 <.0001
TDFI 1 0.1851 0.0448 4.14 <.0001
Inverse of t DF
R output Robust Standard Errors: Estimate Std. Error t value Pr(>|t|)
mu 0.004729 0.001465 3.2281 0.001246 omega 0.000086 0.000050 1.7302 0.083590 alpha1 0.145749 0.052318 2.7858 0.005340 beta1 0.836471 0.051967 16.0962 0.000000 shape 5.345569 1.009241 5.2966 0.000000
5. Fit and EGARCH(1,1) model for the NDX log returns using a normal distribution for the
error terms. Perform model checking and write down the fitted model.
The EGARCH model is adequate although the Gaussian distribution on the error terms is
not sufficient to describe most extreme events. No ARCH effects are shown in residuals.
The leverage parameter “theta” is significant showing that volatility of Nordstrom stock
returns is affected more heavily by negative shocks.
The fitted model can be written as follows:
rt=0.0012 +at
at=σtet with ln σt 2 =-0.194+0.213 g(et-1) +0.996 ln σ
2 t-1
g(et-1)= -0.47et-1+[|et-1|-E(et-1)]
The AUTOREG Procedure
Exponential GARCH Estimates
SSE 2.54945444 Observations 693
MSE 0.00368 Uncond Var .
Log Likelihood 1093.55049 Total R-Square .
stres
-7
-6
-5
-4
-3
-2
-1
0
1
2
3
4
5
6
7
quantiles
-7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7
t-distribution QQplot for residuals of GARCH model
SBC -2154.3958 AIC -2177.101
MAE 0.04095052 AICC -2177.0136
MAPE 101.222881 HQC -2168.32
Normality Test 71.9939
Pr > ChiSq <.0001
Parameter Estimates
Standard Approx
Variable DF Estimate Error t Value Pr > |t|
Intercept 1 0.001236 0.001752 0.71 0.4806
EARCH0 1 -0.1940 0.0636 -3.05 0.0023
EARCH1 1 0.2133 0.0316 6.75 <.0001
EGARCH1 1 0.9662 0.0106 91.41 <.0001
THETA 1 -0.4748 0.1121 -4.23 <.0001
R output
Robust Standard Errors: Estimate Std. Error t value Pr(>|t|) mu 0.001271 0.001774 0.71655 0.473654 omega -0.169047 0.110169 -1.53443 0.124924 alpha1 -0.095670 0.035615 -2.68620 0.007227 beta1 0.970507 0.018820 51.56682 0.000000 gamma1 0.194542 0.059579 3.26526 0.001094
In R model is written as
rt=0.0012 +at
at=σtet with ln σt 2 =-0.169-0.095( et-1 +0.194(|et-1|-E(et-1))+0.970 ln σ
2 t-1
where error term has t-distribution with 6 degrees of freedom.
Note that the leverage coefficients of et-1 in SAS and R are equivalent.
6. Fit and EGARCH(1,1) model for the Nordstrom log returns using a t- distribution for the error terms. Perform model checking and write down the fitted model.
The EGARCH model t-distributed errors is a good model for the data. No ARCH effects
are shown in residuals. The leverage parameter “theta” is significant and negative
showing that volatility of Nordstrom stock returns is affected more heavily by negative
shocks.
The fitted model can be written as follows:
rt=0.0032 +at
at=σtet with ln σt 2 =-0.191+0.158 g(et-1) +0.974 ln σ
2 t-1
g(et-1)= -0.55et-1+[|et-1|-E(et-1)]
et has t-distribution with 6 degrees of freedom.
The MODEL Procedure
Nonlinear Liklhood Summary of Residual Errors
DF DF Adj
Equation Model Error SSE MSE Root MSE R-Square R-Sq
7 686 2.5482 0.00371 0.0609 -0.0001 -0.0088
nresid.y 686 1028.4 1.4991 1.2244
Nonlinear Liklhood Parameter Estimates
Approx Approx
Parameter Estimate Std Err t Value Pr > |t|
intercept 0.003273 0.00160 2.05 0.0410
earch0 -0.19123 0.0932 -2.05 0.0405
earch1 0.158378 0.0490 3.23 0.0013
egarch1 0.974881 0.0139 70.01 <.0001
theta -0.55013 0.1969 -2.79 0.0053
df 5.993367 1.3083 4.58 <.0001 R output
Robust Standard Errors: Estimate Std. Error t value Pr(>|t|) mu 0.003374 0.001552 2.1743 0.029681 omega -0.137932 0.098212 -1.4044 0.160191 alpha1 -0.104435 0.034086 -3.0638 0.002185 beta1 0.977603 0.016446 59.4433 0.000000 gamma1 0.180592 0.075474 2.3928 0.016722 shape 5.783774 1.169335 4.9462 0.000001
In R model is written as
rt=0.0033 +at
at=σtet with ln σt 2 =-0.138-0.104( et-1 +0.180(|et-1|-E(et-1))+0.978 ln σ
2 t-1
where error term has t-distribution with 6 degrees of freedom.
Note that the leverage coefficients of et-1 in SAS and R are equivalent.
Name of Variable = resid2
Mean of Working Series 1.483942
Standard Deviation 2.819517
Number of Observations 693
Autocorrelation Check for White Noise
To Chi- Pr >
Lag Square DF ChiSq --------------------Autocorrelations--------------------
6 5.11 6 0.5299 0.026 0.020 -0.044 -0.061 0.024 -0.004
12 13.61 12 0.3261 0.025 0.088 0.014 -0.041 0.017 -0.039
18 19.28 18 0.3748 0.043 -0.032 -0.038 -0.028 -0.049 0.020
24 23.55 24 0.4873 0.004 0.028 -0.025 -0.051 -0.039 -0.021
7. Find a GJK-TGARCH(1,1) model for the Nordstrom log returns using a t-distribution for the innovations. Perform model checking and write down the fitted model.
Similar to the AR(0)- EGARCH(1,1) model, the AR(0)-GJR(1,1) model is also a good
model for the data. No ARCH effects are shown in residuals. The leverage parameter is
significant and positive showing that volatility of Nordstrom stock returns is affected
more heavily by negative shocks.
The fitted model can be written as follows:
rt=0.0036 +at
at=σtet with σt 2 =(0.034 +0.13Nt-1)a
2 t-1 +0.800 σ
2 t-1
with Nt-1 = 1 if at-1<0, and Nt-1 = 0 if at-1>0
et has t-distribution with 5 degrees of freedom.
The MODEL Procedure
Nonlinear Liklhood Parameter Estimates
Approx Approx
Parameter Estimate Std Err t Value Pr > |t|
intercept 0.003589 0.00157 2.28 0.0226
df 5.028263 0.9762 5.15 <.0001
arch0 0.000095 0.000044 2.18 0.0297
arch1 0.034154 0.0259 1.32 0.1869
garch1 0.800444 0.0584 13.71 <.0001
gamma 0.129939 0.0496 2.62 0.0090
R output
Robust Standard Errors: Estimate Std. Error t value Pr(>|t|) mu 0.003880 0.001519 2.5535 0.010665 omega 0.000083 0.000053 1.5798 0.114152 alpha1 0.039211 0.032406 1.2100 0.226283 beta1 0.858372 0.058370 14.7058 0.000000 gamma1 0.153341 0.074560 2.0566 0.039723 shape 5.767186 1.177356 4.8984 0.000001
The fitted model can be written as follows:
rt=0.0039 +at
at=σtet with σt 2 =(0.039 +0.15Nt-1)a
2 t-1 +0.858 σ
2 t-1
with Nt-1 = 1 if at-1<0, and Nt-1 = 0 if at-1>0
et has t-distribution with 6 degrees of freedom.
8. Is the leverage effect significant at the 5% level?
The leverage parameters in both the EGARCH and the GJR models are significant, and
have values that indicate that volatility react more heavily to negative shocks.
9. What model provides the best fit for the data? Explain. Since the leverage parameters in the AR(0)-EGARCH(1,1) and AR(0) – GJR(1,1) models
are significant, and residuals are white noise with no ARCH effect, we can conclude that
both models provide a good explanation of the volatility behavior for Nordstrom stock
returns. Either models can be chosen, there is no clear winner. (Note that in SAS, PROC
MODEL does not compute BIC criterion – backtesting can be used to compare models.)
In R the egarch(1,1) and the GJR-GARCH(1,1) models have very similar BIC values-
garch11.t egarch11 gjrgarch11 Akaike -3.172122 -3.186143 -3.183976 Bayes -3.139358 -3.146827 -3.144660
10. Use the selected model to compute up to 5 step-ahead forecasts of the simple returns and its volatility.
The following predictions are based on the AR(0)-EGARCH(1,1) model. sigma is the
predicted conditional standard deviation or volatility, and series is the predicted return
(note that predicted returns are the sample mean returns since returns are white noise)
R output for forecasts sigma series 2013-10-29 0.02732 0.003374 2013-10-30 0.02764 0.003374 2013-10-31 0.02796 0.003374 2013-11-01 0.02827 0.003374 2013-11-04 0.02858 0.003374
SAS code
*import data from file;
proc import datafile='nordstrom_w_00_13.csv' out=myd replace;
resid
-7
-6
-5
-4
-3
-2
-1
0
1
2
3
4
5
6
7
quantiles
-7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7
t-distribution QQplot of residuals for GJRGARCH model