EViews代写-ECON 3371
时间:2021-04-28
ECON 3371 FINANCIAL ECONOMETRICS
INDICATIVE SOLUTIONS: PRACTICAL 3

Part I: Testing for ARCH effects First, we need to prepare our data for analysis in EViews. The data contained in the file
“SPDDailyreturns.xls” are daily log returns from the S&P 500 index. It is good practice to understand the properties of your data through visualization and inspecting sample summary statistics, so this is what we will be doing.

'Change working directory - adjust this to the directory where your data file is stored
cd J:\teaching\p3
' Import data
import SPDailyreturns.xls range="data" @rename DLs_p500 sp500
sp500.displayname Daily S&P 500 Returns
'Inspect data
sp500.line
-.12
-.08
-.04
.00
.04
.08
.12
250 500 750 1000 1250 1500 1750 2000 2250
Daily S&P 500 Returns



We can see periods of high and low volatility. These “volatility clusters” are indicative of ARCH effects can be captured by ARCH/GARCH models.







sp500.hist
0
100
200
300
400
500
600
700
800
900
-0.10 -0.05 0.00 0.05 0.10
Series: SP500
Sample 1 2262
Observations 2262
Mean -0.000211
Median 0.000413
Maximum 0.109572
Minimum -0.094695
Std. Dev. 0.013607
Skewness -0.127892
Kurtosis 11.90835
Jarque-Bera 7485.717
Probability 0.000000
The Jarque-Bera statistic indicates that our return series does not follow a normal distribution, rejecting the null hypothesis of a normal distribution at 1% significance.
Question 1 i) We run the OLS regression as specified and save the estimation results:
' Run OLS regression
equation est_ols.ls sp500 c sp500(-1) sp500(-2)
show est_ols
Dependent Variable: SP500
Method: Least Squares
Sample (adjusted): 3 2262
Included observations: 2260 after adjustments
Variable Coefficient Std. Error t-Statistic Prob.
C -0.000238 0.000283 -0.841010 0.4004
SP500(-1) -0.092581 0.020927 -4.424025 0.0000
SP500(-2) -0.110442 0.020904 -5.283339 0.0000
R-squared 0.019063 Mean dependent var -0.000195
Adjusted R-squared 0.018193 S.D. dependent var 0.013588
S.E. of regression 0.013464 Akaike info criterion -5.776256
Sum squared resid 0.409152 Schwarz criterion -5.768659
Log likelihood 6530.169 Hannan-Quinn criter. -5.773484
F-statistic 21.93011 Durbin-Watson stat 1.990220
Prob(F-statistic) 0.000000
ii) First, we save the residuals of the model, square them and inspect their properties visually
'Create residuals
est_ols.makeresid resid_ols
series resid_ols_sq = resid_ols^2
' Visually inspect residual series
est_ols.resids(s)
-8
-6
-4
-2
0
2
4
6
8
250 500 750 1000 1250 1500 1750 2000 2250
Standardized ResidualsThe residuals appear not like a white noise series – the volatility clusters are still visible. These clusters are also visible in the squared residual series:
resid_ols_sq.line
.000
.002
.004
.006
.008
.010
.012
250 500 750 1000 1250 1500 1750 2000 2250
RESID_OLS_SQ
Second, we regress the squared residual series on their own lags; q indicates the order of the lags to include in the regression.
' Regress residuals on two lags of itself and show results
equation est_resid.ls resid_ols_sq c resid_ols_sq(-1) resid_ols_sq(-2)
show est_resid
Dependent Variable: RESID_OLS_SQ
Method: Least Squares
Sample (adjusted): 5 2262
Included observations: 2258 after adjustments
Variable Coefficient Std. Error t-Statistic Prob.
C 8.41E-05 1.15E-05 7.293471 0.0000
RESID_OLS_SQ(-1) 0.122616 0.019177 6.393975 0.0000
RESID_OLS_SQ(-2) 0.412616 0.019179 21.51427 0.0000
R-squared 0.206431 Mean dependent var 0.000181
Adjusted R-squared 0.205727 S.D. dependent var 0.000569
S.E. of regression 0.000507 Akaike info criterion -12.33552
Sum squared resid 0.000579 Schwarz criterion -12.32791
Log likelihood 13929.80 Hannan-Quinn criter. -12.33274
F-statistic 293.2965 Durbin-Watson stat 2.061663
Prob(F-statistic) 0.000000
The auxiliary model is a linear model (because it is linear in parameters) but it is a nonlinear equation. Given that it is linear in model, we can use OLS to estimate it.
iii) We can compute the test statistic and the associated p-value manually:
' Obtain R-squared and number of observation from regression results
scalar r2 = est_resid.@r2
scalar T = est_resid.@regobs
' Compute test statistic and associated p-value
scalar Tr2 = T*r2 ' test statistic (= 466.1213)
scalar Tr2_p = @chisq(Tr2, 2) ' p-value (= 0.0000) In actual practice, we use pre-written commands to do this for us. In our case, this is EViews test for ARCH effects:
est_ols.hettest(type=ARCH, lags=2)
Heteroskedasticity Test: ARCH
F-statistic 293.2965 Prob. F(2,2255) 0.0000
Obs*R-squared 466.1213 Prob. Chi-Square(2) 0.0000
You can see that it yields the same result as our manual computation. Alternatively, we could have used the routine est_ols.archtest(2) to get the equivalent result.
iv) The null of no arch effects is rejected at the 1% significance level.
v) Determine the number of lags of the squared residual that should appear in the model. This could bedone using a likelihood ratio test that would compare an unrestricted version of the squared residual model with, say, four or five variables, and a restricted version with fewer variables.
Specify the nature of the AR model to be used for the estimation process of the model for the returns. It may be that more lags are required than was the case in the OLS model estimated above. In both cases for deriving the variance and mean equations, a general-to-specific modelling approach for the models can be adopted in which the initial model is estimated with a large number of variables that are then tested for restrictions.
PART II: Modelling conditional mean and conditional variance
1) We estimate the ARMA(5, 0) model with ARCH(1) variance process:
smpl @all ' not required but useful for contrasting with next step
equation est_ar5arch1.arch(1, 0) sp500 c AR(1 to 5)
show est_ar5arch1
Dependent Variable: SP500
Method: ML ARCH - Normal distribution (BFGS / Marquardt steps)
Sample (adjusted): 6 2262
Included observations: 2257 after adjustments
Convergence achieved after 36 iterations
Coefficient covariance computed using outer product of gradients
Presample variance: backcast (parameter = 0.7)
GARCH = C(7) + C(8)*RESID(-1)^2
Variable Coefficient Std. Error z-Statistic Prob.
C -0.000141 0.000178 -0.795535 0.4263
AR(1) -0.226978 0.011772 -19.28175 0.0000
AR(2) -0.109372 0.012877 -8.493355 0.0000
AR(3) 0.023995 0.008865 2.706577 0.0068
AR(4) -0.022661 0.008414 -2.693187 0.0071
AR(5) 0.057594 0.010497 5.486941 0.0000
Variance Equation
C 0.000108 2.62E-06 41.19644 0.0000
RESID(-1)^2 0.439309 0.030829 14.24981 0.0000
R-squared -0.004349 Mean dependent var -0.000212
Adjusted R-squared -0.006580 S.D. dependent var 0.013583
S.E. of regression 0.013628 Akaike info criterion -5.936011
Sum squared resid 0.418058 Schwarz criterion -5.915730
Log likelihood 6706.789 Hannan-Quinn criter. -5.928610
Durbin-Watson stat 1.730620
Inverted AR Roots .49 .12+.54i .12-.54i -.48-.40i
-.48+.40i
The mean equation is appears well-specified with significant coefficients on the AR term. The variance equation is also appears well-specified with values on the coefficients that meet the restrictions placed on them by the ARCH model.
2) Next, we estimate the ARMA(2, 0) model with ARCH(1) variance process, which can be viewed as arestricted version of the previous model.
smpl @first+5 @last ' adjust sample period to make models comparable
equation est_ar2arch1.arch(1, 0) sp500 c AR(1 to 2)
smpl @all
show est_ar2arch1
Dependent Variable: SP500
Method: ML ARCH - Normal distribution (BFGS / Marquardt steps)
Sample: 6 2262
Included observations: 2257
Convergence achieved after 20 iterations
Coefficient covariance computed using outer product of gradients
Presample variance: backcast (parameter = 0.7)
GARCH = C(4) + C(5)*RESID(-1)^2
Variable Coefficient Std. Error z-Statistic Prob.
C -0.000138 0.000163 -0.844887 0.3982
AR(1) -0.241872 0.010140 -23.85300 0.0000
AR(2) -0.110732 0.011905 -9.301113 0.0000
Variance Equation
C 0.000108 2.71E-06 39.91425 0.0000
RESID(-1)^2 0.451482 0.029376 15.36930 0.0000
R-squared -0.002721 Mean dependent var -0.000212
Adjusted R-squared -0.003610 S.D. dependent var 0.013583
S.E. of regression 0.013608 Akaike info criterion -5.933075
Sum squared resid 0.417381 Schwarz criterion -5.920399
Log likelihood 6700.475 Hannan-Quinn criter. -5.928449
Durbin-Watson stat 1.702477
Inverted AR Roots -.12+.31i -.12-.31i
We manually compute the Likelihood Ratio test and contrast it with the EViews routines.
' Compute lrtest and associated p-value
scalar lrtest = -2 * (est_ar2arch1.@logl - est_ar5arch1.@logl) ' test statistic
scalar lrtest_p = @chisq(lrtest, 3) ' p-value
There are two ways of computing the same Likelihood Ratio test, depending on whether you test
adding or dropping terms from the respective model:
' Again, in practice, we would use a pre-programmed routine
est_ar5arch1.testdrop AR(3 to 5)
est_ar2arch1.testadd AR(3 to 5)
All of these computations give us the same answer: there is significant evidence against the
restricted ARMA(2, 0) model. Therefore, our preferred model is the ARMA(5, 0) one:


3) First, we compute our model residuals and visualize the standardized residuals. From the graph,
it is clear that the volatility clusters are still present in the residual series; however, they also appear
less pronounced.
' generate standardized residuals
est_ar5arch1.makeresids(s) resids_ar5arch1
' Autocorrelation test
resids_ar5arch1.correl(12)
There appears to be serial dependence in the residuals, indicative of unmodelled influences (like
omitted variables). The Q-statistic indicates, at all lags, rejection of the null that the residuals
follow a white noise process.


' normality test
resids_ar5arch1.hist

The Jarque-Bera statistic indicates that the null of the residuals following a normal distribution is
rejected at the 1% significance level.

' ARCH test
est_ar5arch1.archtest(5)
The test for ARCH effects rejects the null hypothesis of no ARCH effects in the residual series:

4) First, we estimate the ARMA(5, 0) mean model with the ARCH(3) variance process:
equation est_ar5arch3.arch(3, 0) sp500 c AR(1 to 5)
show est_ar5arch3


The coefficients in both the mean and variance equation appear appropriate in magnitude and
Heteroskedasticity Test: ARCH
F-statistic 38.50401 Prob. F(5,2246) 0.0000
Obs*R-squared 177.7944 Prob. Chi-Square(5) 0.0000
Test Equation:
Dependent Variable: WGT_RESID^2
Method: Least Squares
Sample (adjusted): 11 2262
Included observations: 2252 after adjustments
Variable Coefficient Std. Error t-Statistic Prob.
C 0.574736 0.063846 9.001945 0.0000
WGT_RESID^2(-1) -0.089438 0.020950 -4.269167 0.0000
WGT_RESID^2(-2) 0.143249 0.020917 6.848346 0.0000
WGT_RESID^2(-3) 0.140747 0.020923 6.726793 0.0000
WGT_RESID^2(-4) 0.113029 0.020916 5.403938 0.0000
WGT_RESID^2(-5) 0.119448 0.020969 5.696555 0.0000
R-squared 0.078950 Mean dependent var 1.001150
Adjusted R-squared 0.076899 S.D. dependent var 2.467253
S.E. of regression 2.370491 Akaike info criterion 4.566732
Sum squared resid 12620.79 Schwarz criterion 4.581971
Log likelihood -5136.140 Hannan-Quinn criter. 4.572294
F-statistic 38.50401 Durbin-Watson stat 2.017424
Prob(F-statistic) 0.000000
Dependent Variable: SP500
Method: ML ARCH - Normal distribution (BFGS / Marquardt steps)
Sample (adjusted): 6 2262
Included observations: 2257 after adjustments
Convergence achieved after 52 iterations
Coefficient covariance computed using outer product of gradients
Presample variance: backcast (parameter = 0.7)
GARCH = C(7) + C(8)*RESID(-1)^2 + C(9)*RESID(-2)^2 + C(10)*RESID(
-3)^2
Variable Coefficient Std. Error z-Statistic Prob.
C 0.000188 0.000158 1.190416 0.2339
AR(1) -0.084313 0.020163 -4.181618 0.0000
AR(2) -0.086865 0.018701 -4.644999 0.0000
AR(3) -0.028070 0.015027 -1.868011 0.0618
AR(4) 0.035926 0.014127 2.543090 0.0110
AR(5) -0.075986 0.014675 -5.178003 0.0000
Variance Equation
C 5.48E-05 2.67E-06 20.56119 0.0000
RESID(-1)^2 0.117557 0.017352 6.774857 0.0000
RESID(-2)^2 0.349902 0.027200 12.86393 0.0000
RESID(-3)^2 0.239821 0.027562 8.701097 0.0000
R-squared 0.008994 Mean dependent var -0.000212
Adjusted R-squared 0.006793 S.D. dependent var 0.013583
S.E. of regression 0.013537 Akaike info criterion -6.135706
Sum squared resid 0.412504 Schwarz criterion -6.110355
Log likelihood 6934.144 Hannan-Quinn criter. -6.126454
Durbin-Watson stat 2.023685
Inverted AR Roots .43-.34i .43+.34i -.15+.61i -.15-.61i
-.63
highly significant. Next, we generate the standardized residuals and visually inspect them
generate standardized residuals
est_ar5arch3.makeresids(s) resids_ar5arch3
' Visually inspect residuals
est_ar5arch3.resids(s)
' autocorrelation and omitted variables
resids_ar5arch3.correl(12)
' normality test
resids_ar5arch3.hist
' ARCH test
est_ar5arch3.archtest(5)



The correlograms shows that there is no autocorrelation, which is indicative of our model doing
better in capturing serial dependence.
However, significant evidence against normality of the residuals remains.
5) A GARCH (1,1) model captures the effects of all past squared residuals (an infinite number)
from the ARCH (q) model but in a way that is more parsimonious. This makes estimation more
straightforward than it would be in an ARCH (q) model where q is large and difficult to determine.
GARCH (1,1) models have also been found to provide a good representation for a wide range of
financial data.
6) We estimate an ARMA(5, 0) model with a GARCH(1, 1) variance process:
equation est_ar5garch11.arch(1, 1) sp500 c AR(1 to 5)
show est_ar5garch11
Failure to improve likelihood (non-zero gradients) after 0 interactions
However, our results indicate that the Maximum Likelihood routine failed. This can sometimes
happen with complex models. We adopt the ad-hoc fix of moving to an ARMA(4, 0) model with
a GARCH(1, 1) variance process.
equation est_ar4garch11.arch(1, 1) sp500 c AR(1 to 4)
show est_ar4garch11

This model could be successfully fitted, and the results indicate that AR lags of order higher than
2 appear redundant after moving to the GARCH(1, 1) variance process specification. These
insignificant AR terms are likely to have caused the convergence problems in our previous
Maximum Likelihood estimation, illustrating that often encountering failures in numerical
optimization routines is indicative of a statistical model that warrants further improvements.

7) Again, we create the series of standardized residuals and investigate its properties.
' generate standardized residuals
est_ar4garch11.makeresids(s) resids_ar4garch11
' Visually inspect residuals
est_ar4garch11.resids(s)
' autocorrelation and omitted variables
resids_ar4garch11.correl(12)
' normality test
resids_ar4garch11.hist
' ARCH test
est_ar4garch11.archtest(5)

Dependent Variable: SP500
Method: ML ARCH - Normal distribution (BFGS / Marquardt steps)
Sample (adjusted): 5 2262
Included observations: 2258 after adjustments
Convergence achieved after 37 iterations
Coefficient covariance computed using outer product of gradients
Presample variance: backcast (parameter = 0.7)
GARCH = C(6) + C(7)*RESID(-1)^2 + C(8)*GARCH(-1)
Variable Coefficient Std. Error z-Statistic Prob.
C 0.000271 0.000176 1.539616 0.1237
AR(1) -0.071080 0.024101 -2.949272 0.0032
AR(2) -0.052565 0.021830 -2.407930 0.0160
AR(3) 0.006720 0.022324 0.301013 0.7634
AR(4) -0.006057 0.020664 -0.293115 0.7694
Variance Equation
C 1.12E-06 2.21E-07 5.052269 0.0000
RESID(-1)^2 0.078791 0.009091 8.666937 0.0000
GARCH(-1) 0.915381 0.009691 94.45748 0.0000
R-squared 0.014953 Mean dependent var -0.000207
Adjusted R-squared 0.013205 S.D. dependent var 0.013582
S.E. of regression 0.013492 Akaike info criterion -6.272731
Sum squared resid 0.410150 Schwarz criterion -6.252457
Log likelihood 7089.913 Hannan-Quinn criter. -6.265332
Durbin-Watson stat 2.032934
Inverted AR Roots .15-.20i .15+.20i -.18-.26i -.18+.26i





The ARCH effect is rejected. However, the null of normality in the standardized residuals is still
rejected.
8) A variety of approaches could be adopted:
• Search for outliers in the data and the residuals and then create dummy variables for these dates.

Then re-estimate the model with the dummy variables in the mean equation. 

• Obtain other possible explanatory variables for the mean equation, including the addition of

further autoregressive terms. 

• Re-specify the model as a GARCH (p, q) with different values for p and q. 

• Adopt alternative GARCH models such as GARCH-M or EGARCH. 


9) Now we estimate an ARMA(5, 0) process with a GARCH(2, 2) conditional variance process.
The logic of interpreting the estimation results follows the above.
equation est_ar5garch22.arch(2, 2) sp500 c AR(1 to 5)
show est_ar5garch22

Heteroskedasticity Test: ARCH
F-statistic 1.125856 Prob. F(5,2247) 0.3443
Obs*R-squared 5.630205 Prob. Chi-Square(5) 0.3439
Test Equation:
Dependent Variable: WGT_RESID^2
Method: Least Squares
Sample (adjusted): 10 2262
Included observations: 2253 after adjustments
Variable Coefficient Std. Error t-Statistic Prob.
C 1.003429 0.062090 16.16091 0.0000
WGT_RESID^2(-1) -0.041160 0.021096 -1.951067 0.0512
WGT_RESID^2(-2) 0.016114 0.021110 0.763349 0.4453
WGT_RESID^2(-3) -0.002569 0.021113 -0.121670 0.9032
WGT_RESID^2(-4) 0.021122 0.021112 1.000496 0.3172
WGT_RESID^2(-5) 0.004711 0.021099 0.223265 0.8233
R-squared 0.002499 Mean dependent var 1.001665
Adjusted R-squared 0.000279 S.D. dependent var 1.855364
S.E. of regression 1.855105 Akaike info criterion 4.076419
Sum squared resid 7732.857 Schwarz criterion 4.091652
Log likelihood -4586.086 Hannan-Quinn criter. 4.081979
F-statistic 1.125856 Durbin-Watson stat 1.999743
Prob(F-statistic) 0.344328
' generate standardized residuals
est_ar5garch22.makeresids resids_ar5garch22
' Visually inspect residuals
est_ar5garch22.resids(s)
' autocorrelation and omitted variables
resids_ar5garch22.correl(12)
' normality test
resids_ar5garch22.hist
' ARCH test
est_ar5garch22.archtest(5)





Dependent Variable: SP500
Method: ML ARCH - Normal distribution (BFGS / Marquardt steps)
Sample (adjusted): 6 2262
Included observations: 2257 after adjustments
Convergence achieved after 49 iterations
Coefficient covariance computed using outer product of gradients
Presample variance: backcast (parameter = 0.7)
GARCH = C(7) + C(8)*RESID(-1)^2 + C(9)*RESID(-2)^2 + C(10)*GARCH(
+ C(11)*GARCH(-2)
Variable Coefficient Std. Error z-Statistic Prob.
C 0.000304 0.000170 1.788857 0.0736
AR(1) -0.074535 0.021483 -3.469536 0.0005
AR(2) -0.056015 0.023258 -2.408443 0.0160
AR(3) 0.004219 0.021518 0.196078 0.8445
AR(4) -0.009024 0.021700 -0.415835 0.6775
AR(5) -0.045592 0.021218 -2.148777 0.0317
Variance Equation
C 1.98E-06 4.24E-07 4.679584 0.0000
RESID(-1)^2 0.014761 0.014240 1.036634 0.2999
RESID(-2)^2 0.118604 0.020513 5.781780 0.0000
GARCH(-1) 0.407502 0.179895 2.265218 0.0235
GARCH(-2) 0.448450 0.164658 2.723526 0.0065
R-squared 0.016058 Mean dependent var -0.000212
Adjusted R-squared 0.013872 S.D. dependent var 0.013583
S.E. of regression 0.013489 Akaike info criterion -6.278137
Sum squared resid 0.409564 Schwarz criterion -6.250251
Log likelihood 7095.878 Hannan-Quinn criter. -6.267960
Durbin-Watson stat 2.027289
Inverted AR Roots .41-.33i .41+.33i -.19+.53i -.19-.53i
-.52
OPTIONAL: Visualization of the estimation results of the ARMA(5, 0) GARCH(2,2) process
' Visualize estimates
' Obtain series of fitted values of mean and conditional standard deviation
est_ar5garch22.fit yhat cstd
yhat.displayname Fitted values
cstd.displayname Estimated Conditional Variance
' Create confidence intervals
series CI_lower = yhat - 3*cstd
CI_lower.displayname Lower Confidence Interval
series CI_upper = yhat + 3*cstd
CI_upper.displayname Upper Confidence Interval
' Create graphs
delete gr* ' clear whatever graphs there are
graph gr0.line sp500
graph gr1.line sp500 yhat
graph gr2.line cstd
graph gr3.line sp500 CI_lower CI_upper
graph gr_all.merge gr0 gr1 gr2 gr3
show gr_all.align(2, 2, 2)
-.12
-.08
-.04
.00
.04
.08
.12
250 500 750 1000 1250 1500 1750 2000 2250
Daily S&P 500 Returns
-.12
-.08
-.04
.00
.04
.08
.12
250 500 750 1000 1250 1500 1750 2000 2250
Daily S&P 500 Returns
Fitted values
.00
.01
.02
.03
.04
.05
.06
250 500 750 1000 1250 1500 1750 2000 2250
Estimated Conditional Variance
-.20
-.15
-.10
-.05
.00
.05
.10
.15
.20
250 500 750 1000 1250 1500 1750 2000 2250
Daily S&P 500 Returns
Lower Confidence Interval
Upper Confidence Interval
































































































































































































































































































































































































































































































































学霸联盟


essay、essay代写