讲解:EF 5070、Financial Econometrics、R、RR|C/C++

PS 2 EF 5070: Financial EconometricsEF 5070: Financial EconometricsProblem Set 2Due 5:00 pm, Nov 1st, 2019Notes1. Due Friday, 5:00pm, Nov 1st.2. Han Zhang, the TA of this course, will collect problem sets in her office, (AC3) 9-233,on Friday Oct 11th from 3:30 pm-5:00 pm.3. If you cannot hand in your problem set in person, please scan and send your problem set tothe TA at hzhang368@cityu.edu.hk before the deadline.4. Hand in your problem set together with the i) R codes that you used to generate the results,ii) the associated R log file, and iii) your written solution.5. Each student needs to write his/her own solutions, even though discussions of the assignmentsbetween students are encouraged.6. If not specifically specified, use 5% significance level (the associated critical value is 1.96 forstandard normal distribution) to draw conclusions in this problem set.7. Some useful R strategies:(1) For LB test, first using the R commandtsdiag(model)to examine whether there are any serial dependency in residuals.(2) For LB test, now use another R build-in command,Box.test(model$residuals,lag=12,type=’Ljung’)Compare the reported p-value with 5% significance level.(3) To fit the data with an AR model, consider the build-in R codem=ar(data,method=mle)m_order=m$orderm_aic=m$aicm_1=arima(data,order=c(m_order,0,0))m_1Page 1PS 2 EF 5070: Financial Econometricspar(mfrow=c(2,1))plot(data,xlab=’Time’,ylab=’Returns’)plot(m_aic)(4) To plot the ACF and PACF of a series, consider the build-in commanddata_acfdata_pacf(5) To fit the data with an MA model, consider the build-in R codem_1=arima(data,order=c(0,0,m_order))(6) To perform forecast and construct the 95% confidence interval, consider the following commandR codes:predlines(pred$pred,col=blue, lwd=5)lines(pred$pred+2*pred$se,col=red,lty=3, lwd=5)lines(pred$pred-2*pred$se,col=red,lty=3, lwd=5)(7) Plot several graphs, say m × n, in one page with the same scale and arrange them into mrows and n columns.par(mfcol=c(m,n))plot(...)plot(...)Page 2PS 2 EF 5070: Financial Econometrics(8) To detect a unit root process in the series, consider the following R code (the value of m inthe option k=m can be any reasonable positive integer):library(tseries)adf.test(data, k=10)1. Suppose that simple return of a monthly bond index follows an MA(2) model,Rt = 0.1 + νt − 0.8νt−1 + 0.1νt−2, (1)where νt ∼ N(0, 4).(a) What is the mean of the simple return of this monthly bond?(b) What is the variance of the simple return of this monthly bond?(c) Consider the forecast origin h = 100 with ν100 = 0.2, ν99 = −0.1 and ν98 = 1.Compute the 1-step-ahead forecast of the simple return at the forecast origin h = 100and the variance of your forecast error.(d) Based on part (c), compute the 2-step-ahead forecast of the simple return at theforecast origin h = 100 and the variance of your forecast error.(e) Based on part (c), how long do you expect the forecast value converge to its meanlevel? Explain it briefly.2. SEF 5070代写、代做Financial Econometuppose the simple daily log return of a stock follows the dynamics,rt = −0.3 + 0.1rt−3 + �t, (2)where �t ∼ N(0, 2).(a) What is the mean of the simple daily log return of this stock?(b) What is the variance of the simple daily log return of this stock?(c) Based on Part (a) and (b), is the stock simple log return stationary (with E(rt) =µ 2 (d) Consider the forecast origin h = 100 with r100 = 0.5, r99 = 0.5, r98 = −1 andr97 = −0.2. Compute the 1-step-ahead forecast (hint: rh(1) = E(rh+1|Ih))of thesimple return at the forecast origin h = 100 and the variance of your forecast error.Page 3PS 2 EF 5070: Financial Econometrics(e) Based on part (d), compute the 2-step-ahead forecast (hint: ˆrh(2) = E(rh+2|Ih)) ofthe simple return at the forecast origin h = 100 and the variance of your forecasterror.(f) Based on part (d), compute the 3-step-ahead forecast (hint: ˆrh(3) = E(rh+3|Ih)) ofthe simple return at the forecast origin h = 100 and the variance of your forecasterror.3. Consider the simple log returns of Starbucks stock from 2009 Jan 1st to 2019 Oct 1st.(a) Download the according data using the quantmod command in R.(b) Report summary statistics, including sample mean, sample variance, skewness, kurtosis,minimum and maximum of the raw data.(c) Build an AR model for the series and decide the best order p using AIC and PACF,respectively.(d) Estimate your proposed AR(p) model and provide forecasts from Oct to Oct 17th andcompare your forecast with the actual stock returns during that period.(e) Build an MA model for the series and decide the best order q using ACF. Brieflyexplain why we can choose the best order using ACF?(f) Estimate your proposed MA(q) model and provide forecast from Oct to Oct 17th andcompare your forecast with the actual stock returns during that period.(g) Is your AR(p) or MA(q) model adequate? Perform Ljung-Box test separately.4. Consider the daily VIX index. VIX, calculated and published by the Chicago Board OptionsExchange (CBOE), is widely used as a measure for market level uncertainty.(a) Please download the daily VIX index from January 1, 2009 to Oct 1, 2018 using thequantmod command in R.hint#To use a specific column of your dataset, say the 6th column inthis question, and transform it into numeric format, considerthe following command:vix(b) Plot the daily VIX index, the distribution of VIX index and its ACF in one page.(c) Is the series a nonstationary process? Why? (Consider the ADF test)Page 4PS 2 EF 5070: Financial Econometrics(d) Is the differenced series a stationary process? Why? (Consider the ADF test)(e) Build a ARMA model for the differenced VIX index, including your analysis on modeladequacy.Now, we introduce another way to identify the best order for a ARIMA model byusing a build-in command in R:auto.arima(vix)(f) Write down the fitted model.(g) Obtain 1-step to 20-step ahead forecast of the VIX index based on your model in part(c) at the forecast origin May 01, 2019. Plot your forecasting result and compare withthe true data.Page 5转自:http://www.3daixie.com/contents/11/3444.html

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 7,434评论 0 10
  • The Inner Game of Tennis W Timothy Gallwey Jonathan Cape ...
    网事_79a3阅读 12,236评论 3 20
  • 今天晚上的火车去北京,面签美国签证,临行前告诉我快六岁的女儿,晚上爸爸妈妈要出差,不能陪你睡觉了,明天就能回来。看...
    向杨而生阅读 390评论 2 6
  • 作家常写人生苦难,把生活撕给大家看,而林清玄却不,苦难出身而他却只说美好。在我们习以为常却忽略的美好中,他总能...
    眩紫水晶阅读 211评论 0 1
  • 最近吃饭、买东西省了不少钱 其实也不算内幕,叫套路或潜规则更合适一点 总结成一句话:线下消费先问优惠额,网上购物先...
    Jeffzzf_6d22阅读 150评论 0 0