首页 > > 详细

data讲解、辅导nberShade、讲解R设计、辅导R编程语言辅导R语言编程|辅导留学生 Statistics统计、回归、迭代

Assignment #6
Question 1: Probit Recession Forecast
Forecast the recession probability in the US by regressing a binary recession variable on the yield spread.
1. Get data. Using the ‘quantmod’ library, read in the monthly recession variable ‘USREC’ and the
10-year to 3-month yield spread ‘T10Y3MM’ from FRED into R.
2. Produce a nice graph. Convert both variables into time series and cut them to the same length
using the window() command. Plot the yield spread and use ‘nberShade’ from the ‘tis’ package
to add recession shading to your graph.
3. Find the best lag of the yield spread. In a loop, regress the recession variable on lag 0 to the 10th
lag of the yield spread using a probit model. Create an empty vector ‘GF’ outside the loop with
11 elements. In each loop save the loglikelihood as a goodness of fit measure in the i’th element
of the vector. Plot the Loglikelihood on the respective number of lags, which lag has the highest
explanatory power? Remember that your X-axis should start at 0, not 1.
4. Use this lag to forecast the probability of recession in the US for the next 6 months. Produce a
graph of the forecast.

联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!