* * Example of bootstrapping an FMOLS estimate of cointegrating vectors. * Based upon the technique described in Li and Maddala, "Bootstrapping * cointegrating regressions", J. of Econometrics 80 (1997) pp 297-318 * open data kpswdata.rat calendar(q) 1947 all 1988:04 data(format=rats) / c in y mp dp r * @fm(lags=5,det=constant) 1954:1 * # mp y r * * Get the FM residuals and the estimated coefficient vector. Depending * upon how you're planning to use the bootstrap, you might want to make * b equal to something else (like the value the cointegrating vector * would take under a null hypothesis). * set u = %resids compute b=%beta * * Difference the RHS endogenous variables * diff y / dy diff r / dr compute [vector] betamean=%zeros(3,1) compute [symm] betacmom=%zeros(3,3) * compute ndraws=1000 do draws=1,ndraws * * Do a block bootstrap for the stationary elements. * boot(block=10,method=stationary) entries 1954:1 * * * The first differences and the residuals are resampled together. * Rebuild the RHS endogenous variables, and then the dependent * variable * set(first=0.0) resampy 1953:4 1988:4 = resampy{1}+dy(entries(t)) set(first=0.0) resampr 1953:4 1988:4 = resampr{1}+dr(entries(t)) set resampmp 1954:1 1988:4 = b(1)+b(2)*resampy+b(3)*resampr+u(entries(t)) * * Re-estimate and update the betamean and betacmom matrices * @fm(lags=5,det=constant,noprint) 1954:1 * # resampmp resampy resampr compute betamean=betamean+%beta-b compute betacmom=betacmom+%outerxx(%beta-b) end do draws compute betamean=betamean/ndraws compute betacmom=betacmom/ndraws linreg(create,coeffs=b,covmat=betacmom,noscale) mp # constant y r