讲解: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

©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 213,558评论 6 492
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 91,002评论 3 387
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 159,036评论 0 349
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 57,024评论 1 285
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 66,144评论 6 385
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 50,255评论 1 292
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 39,295评论 3 412
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 38,068评论 0 268
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 44,478评论 1 305
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 36,789评论 2 327
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 38,965评论 1 341
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 34,649评论 4 336
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 40,267评论 3 318
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 30,982评论 0 21
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 32,223评论 1 267
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 46,800评论 2 365
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 43,847评论 2 351

推荐阅读更多精彩内容

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