open "H:\Program Files\gretl\data\ETM\tbrate.gdt" diff r y smpl 1950:4 1996:4 # ETM 2.23 ols d_r const infl(-1) d_y(-1) d_r(-1 to -2) --robust # Get predictions and residuals series yhat1 = $yhat series uhat1 = $uhat # regress predictions on residuals and a constant ols yhat1 const uhat1 # regress residuals on predictions and a constant ols uhat1 const yhat1 # 2.24 ETM ols d_r const d_y(-1) d_r(-1 to -2) --robust series ehat = $uhat lags 1; infl # get residuals for d_r ols d_r const d_y(-1) d_r(-1 to -2) genr ehat = $uhat # get residuals for lagged inflation ols infl_1 const d_y(-1) d_r(-1 to -2) genr vhat = $uhat # Verify FWL ols ehat vhat # 2.25 ETM matrix X = { const infl_1 d_y_1 d_r_1 d_r_2 } matrix hat = X*inv(X'X)*X' matrix ht=diag(hat) series hatt = ht gnuplot hatt --time-series # 2.26 ETM matrix et = zeros($nobs,1) matrix et[20,1]=1 # set 20th obs of et to 1 series ett = et # convert it to a series list X1 = const infl_1 d_y_1 d_r_1 d_r_2 # Residuals for full sample ols d_r X1 genr u_full = $uhat genr y_full = $yhat # Run regression omitting obs 20. ols d_r X1 ett genr u_omit = $uhat alpha = $coeff(ett) genr a1 = u_full/(1-hatt) smpl 1955:3 1955:3 print "u_omit should be zero, a1 and the coefficient on et should be the same " print u_full u_omit a1 alpha # 2.27 ETM # Run regression of omit 1 residuals on the full set residuals smpl 1950:4 1996:4 ols a1 u_full