The file m sp500ret 3mtcm.txt contains three columns. The second column gives the monthly returns of the S&P 500 index from January 1994 to December 2006. The third column gives the monthly rates of the 3-month U.S. Treasury bill in the secondary market, which are obtained from the Federal Reserve Bank of St. Louis and used as the risk-free rate here. Consider the ten monthly log returns in the file m logret 10stocks.txt.
(a) For each stock, fit CAPM for the period from January 1994 to June 1998 and for the subsequent period from July 1998 to December 2006. Are your estimated betas significantly different for the two periods?
(b) Consider the dynamic linear model (5.40) for CAPM with time-varying betas. Use the Kalman filter with sw = 0.2 to estimate ßt sequentially during the period July 1998–December 2006. The estimated beta and error variance 2 obtained in (a) for the period from January 1994 to June 1998 can be used to initialize 0 and to substitute for s2 in the Kalman filter.
(c) Compare and discuss your sequential estimates with the estimate of beta in (a) for the period July 1998 to December 2006.
Please use R-studio to solve the problems and the data set can be found from followings: