There is now a separate procedure which does this calculation. See
http://www.estima.com/forum/viewtopic.php?f=7&t=993
Code: Select all
*
* Example of calculation of Hodrick(1992) standard errors.
* "Dividend Yields and Expected Stock Returns: Alternative Procedures
* for Inference and Measurement", Review of Financial Studies, vol 5, no
* 3, 357-386.
*
* Note that the calculation is specific to multiple step predictability
* regressions. It uses the residuals from a one-step regression to
* compute the covariance matrix for a k-step regression.
*
calendar(m) 1988:11
open data aluminum.xls
data(format=xls,org=columns) 1988:11 2007:05 pzalul pzalul3
*
set logspot = log(pzalul)
set logforw = log(pzalul3)
set ret3 = logspot{-3}-logspot
set ret1 = logspot{-1}-logspot
set xchange = logforw-logspot
*
* To compute Hodrick(1992) standard errors, first compute a one-period
* predictability regression. Residuals here should be serially
* uncorrelated.
*
linreg ret1 / eps
# constant xchange
*
linreg ret3
# constant xchange
*
compute k=3
dec symm s0
dec vect wk
compute s0=%zeros(%nreg,%nreg)
do time=%regstart()+k,%regend()
compute wk=%zeros(%nreg,1)
do i=0,k-1
compute wk=wk+eps(time)*%eqnxvector(0,time-i)
end do i
compute s0=s0+%outerxx(wk)
end do time
*
* Same regression with Hodrick standard errors
*
linreg(lastreg,create,covmat=%xx*s0*%xx,form=chisq,$
title="Least Squares with Hodrick standard errors")
*
* And with Newey-West standard errors
*
linreg(lastreg,lwindow=newey,lags=k-1,$
title="Least Squares with Newey-West standard errors")