讲解:data、nberShade、R、RR| Statistics、、

Assignment #6Question 1: Probit Recession ForecastForecast 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 the10-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 lengthusing the window() command. Plot the yield spread and use ‘nberShade’ from the ‘tis’ packageto add recession shading to your graph.3. Find the best lag odata课程作业代做、代写nberShade作业、代做R课程设计作业、代写R编程语言作业 代写R语言编程|代写留学生 Sf the yield spread. In a loop, regress the recession variable on lag 0 to the 10thlag of the yield spread using a probit model. Create an empty vector ‘GF’ outside the loop with11 elements. In each loop save the loglikelihood as a goodness of fit measure in the i’th elementof the vector. Plot the Loglikelihood on the respective number of lags, which lag has the highestexplanatory 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 agraph of the forecast.转自:http://www.6daixie.com/contents/18/4562.html

你可能感兴趣的:(讲解:data、nberShade、R、RR| Statistics、、)