# EF 5070辅导、辅导R编程语言

- 首页 >> Database作业
PS 3 EF 5070: Financial Econometrics
EF 5070: Financial Econometrics
Problem Set 3
Due 5:00 pm, Dec 1st, 2022
Notes
1. Due 5:00pm, Dec 1st.
2. Please submit your problem set zip files which contains all related material into CANVAS by
the deadline. Late submissions will not be accepted.
3. Hand in your problem set together with the i) R codes that you used to generate
the results (print out your script file), ii) the associated R log file (print out your
console window output), and iii) your written (typed) solution.
4. Each student needs to write his/her own solutions, even though discussions of the assignments
between students are encouraged.
5. If not specifically specified, use 5% significance level (the associated critical value is 1.96 for
standard normal distribution) to draw conclusions in this problem set.
6. For this problem set, you may use the following R packages: (See R demo codes provided in
Chapter 4 from Canvas for details).
library('TSA')
library('fGarch')
library('parallel')
library('rugarch')
1. Consider the daily VIX index. VIX, calculated and published by the Chicago Board Op-
tions Exchange (CBOE), is widely used as a measure for market level uncertainty.
(a) Please download the daily VIX index from January 1, 2006 to Oct 22, 2022 using the
quantmod command in R.
hint
Page 1
PS 3 EF 5070: Financial Econometrics
#To use a specific column of your dataset, say the 6th column in
this question, and transform it into numeric format, consider
the following command:
vix<-as.numeric(VIX[,6])
(b) Use ARCH(q) model with the default Gaussian distribution as a baseline model to fit
the VIX dataset. (1) Write down an equivalent AR representation for the ARCH(q)
process. (2) Explain and show how the best order q can be determined. (3) Write
down the fitted ARCH(q) and its equivalent AR representation.
(c) Now, use GARCH(1,1) model with the default Gaussian distribution to fit the VIX
data. (1) Write down an equivalent ARMA representation for the GARCH(m,s)
process. (2) Write down the fitted GARCH(1,1) model.(3) Do you observe significant
GARCH effect at 5% level?
(d) Next, use GARCH(1,1) model with a student-t distribution to fit the VIX data. Write
down the fitted model. Hint, consider the following R commands.
model<-garchFit(~garch(m,s),data=,cond.dist='std',trace=F)
(e) Fit the dataset with a ARMA(p,q)-GARCH(1,1) model. (1) Please explain and show
how to choose the ARMA orders, (p,q). (2) Write down the fitted model. (3) Please
briefly explain why we would prefer GARCH(1,1) over ARCH(q) when modeling the
latent dynamic volatility process here.
(f) Which model would you prefer to explain the evolutions of the market volatility, VIX
dataset? Briefly explain.
2. Consider the daily returns of Walmart stock from January 2, 2017 to Nov 1, 2022. Down-
load the Walmart data using the ’quantmod’ package in R. Using daily closing price to
construct simple returns so as to form log returns. Multiply the log returns by 100 to
obtain the percentage returns. Let rt be the percentage log returns.
(a) Is the expected value of rt zero? Write down the null and alternative hypothesis and
the test statistics. Write down your conclusion.
Method 1: First, consider the following R command and draw your conclusion.
Page 2
PS 3 EF 5070: Financial Econometrics
t.test(rt)
Method 2: Second, consider a regression model to testify whether rt has zero mean.
rt = α + ?t.
(b) Are there any serial correlations in rt and r2t ? Performance a test and justify your
conclusion.
(c) Fit a Gaussian ARMA(p,q)-GARCH(1,1) model to the rt series. Obtain the normal
QQplot of the standardized residuals (hint: plot(model)), and write down the fitted
model. Is the model adequate? Why?
(d) Let zt = rt ? rˉt, where rˉt = 1n
∑n
i=1 rt is the sample mean of rt. Fit an IGARCH(1,1)
model with a constant term to the at series zt. Write down the fitted model.
(e) Let σt be the fitted volatility of the IGARCH(1,1) model. Define the standardized
residuals as ?t = ztσt . Is there any serial correlation in the standardized residuals?
Why? (Hint: consider the LB test). Consider the following R command:
sresi=zt/model\$volatility
(f) Using the provided package (garchM.R), fit a GARCH-M model to rt. Write down the
fitted mode. Do the mean evolutions of log returns statistically significantly depend
on conditional volatility? Why? What is estimated level of risk premium?
> source("garchM.R")
> model=garchM(data)
(g) Using the provided package (Tgarch11.R), fit a TGARCH(1,1) model to the log re-
turns rt. Write down the fitted model. Is the leverage effect statistically significant?
Why? I introduce two methods to implement and estimate a threshold GARCH model
as follows:
Approach 1:
Page 3
PS 3 EF 5070: Financial Econometrics
> source("Tgarch11.R")
> model=Tgarch11(data)
Please redo (g) using another R build-in package:
Approach 2:
model=garchFit(~garch(1,1),data=data,trace=F,leverage=T)
3. Consider the daily returns of Walmart stock from January 2, 2018 to Nov 15, 2022 again.
Download the Walmart data using the ’quanmod’ package in R. Using daily closing price
to construct simple returns so as to form log returns. Multiply the log returns by 100 to
obtain the percentage returns. Let rt be the percentage log returns.
Download the S&P500 time series during the same sampling period from Yahoo Finance
via the quantmod package in R. Using daily closing price to construct simple returns of
S&P500 index so as to form log returns. Multiply the log returns by 100 to obtain the
percentage returns. Let rm,t be the percentage log returns of S&P500, which is used to as
the market return.
getSymbols('^GSPC',env=sp500,src='yahoo',from='',end='')
(a) Now, let’s empirically investigate the CAPM theory by running the following simple
market regression:
rt = α + βrm,t + ?t,where ? ～ i.i.d.N(0, σ2). (1)
Write down the fitted model.
(b) Based on part (a), are you able to confirm the CAPM theory statistically significantly
at 1% significance level? Write down your hypothesis, test statistics, rejection rule
and conclusion.
Next, we are about to investigate the role nonlinearity play in determining equity
prices. 1) Create a dummy variable C1 that takes on value one if current market
return is positive and zero otherwise. 2) Create a variable nspt that is equal to the
multiplication of market returns rm,t and the dummy variable C1.
Page 4
PS 3 EF 5070: Financial Econometrics
(c) Based on the simple market regression model (1), while holding other factors un-
changed, please design a new threshold market regression model that allows you to
examine whether nonlinearity only affects the abnormal return in (1). Write down
your regression model, fit it to the rt series and write down your fitted model. Is there
a statistically significant asymmetric pattern in mean at 5% level? Write down your
hypothesis, test statistics, rejection rule and conclusion.
(d) Based on the simple market regression model (1), while holding other factors un-
changed, please design another threshold market regression model that allows you
to examine whether there is any asymmetric pattern only in marginal effects in (1).
Write down your regression model, fit it to the rt series and write down your fitted
model. Is there a statistically significant asymmetric pattern in mean at 5% level?
Write down your hypothesis, test statistics, rejection rule and conclusion.
(e) Based on the simple market regression model (1), while holding other factors un-
changed, please design another threshold market regression model that allows you
to examine whether there is any asymmetric pattern in both constant and marginal
effects in (1). Write down your regression model, fit it to the rt series and write down
your fitted model. Is there a statistically significant asymmetric pattern in mean at
5% level? Write down your hypothesis, test statistics, rejection rule and conclusion.
4. Consider the same Walmart stock returns studied in Question 3, and we are about to
investigate the role the market return S&P play in determining equity returns using a
Markov-Chain Regime Switching model.
(a) Please describe the Markov-chain regime switching model using two sentences.
(b) Please name two appealing features that Markov-chain regime switching model has
compared to the threshold modelling procedure.
(c) Now, we consider a simple two-stage Regime Switching model. Please modify the
simple market return regression in (1) into a two-stage Regime Switching model (2).
Fit the model to the rt series and write down the fitted model.
rt =α1 + β1rm,t + γ1nspt + ?1,t, where?1,t ～ i.i.d.N(0, σ21),α2 + β2rm,t + γ2nspt + ?2,t, where?2,t ～ i.i.d.N(0, σ22), (2)
(d) Please interpret α1, β1, α2, β2, σ21 and σ22.
(e) Do you observe any statistically significant asymmetric pattern in marginal effects in
any regime?
Page 5
PS 3 EF 5070: Financial Econometrics
(f) Please write down the estimated probability transition matrix, and interpret each
element in that matrix.
(g) How long do you expect the Walmart stock to stay within each regime? Form your
answer based on expected duration within each regime.