* * Chapter 9 Exercise * pp 613-618 * * sample size is 200 * calendar 1791 allocate 200 * * Read data file * open data lt.xls data(org=columns,format=xls) / year s uswpi ukwpi * column 1: year * column 2: $/pound exchange rate * column 3: US CPI * column 4: UK CPI * * Generate real exchange rate * set z 1791:1 1990:1 = log(s)-log(uswpi)+log(ukwpi) set dz 1791:1 1990:1 = z-z{1} * * Do graph from page 605. Normalize the data to have a 0 value in 1914. * set znorm = z-z(1914:1) graph(footer="Figure 9.4: Dollar/Sterling Real Exchange Rate, 1791-1900") # znorm * * (a) ADF on real exchange rate. Up to 14 lagged changes. This runs the * regressions and displays the Akaike and Schwarz criteria and (for lags > 0) the * t-stat on the final lag. Scan the first column for the minimum AIC, the second * for the minimum BIC and the third from end to start, looking for the first * significant t-stat. * * Both for computational efficiency, and to ensure that the regressions are run * over the same range, CMOM and LINREG(CMOM) are used for computing the * regressions. * compute pmax=14 cmom # dz{0 to pmax} constant z{1} * report(action=define,hlabels=||"Lag","Akaike","Schwarz","Final t"||) linreg(noprint,cmom) dz # constant z{1} compute akaike = log(%rss/%nobs)+%nreg*2.0/%nobs compute schwarz = log(%rss/%nobs)+%nreg*log(%nobs)/%nobs report(row=new,atcol=1) 0 akaike schwarz * * Run ADF with 1 through 14 lagged changes. * do maxlag=1,pmax linreg(noprint,cmom) dz # constant z{1} dz{1 to maxlag} compute akaike = log(%rss/%nobs)+%nreg*2.0/%nobs compute schwarz = log(%rss/%nobs)+%nreg*log(%nobs)/%nobs report(row=new,atcol=1) maxlag akaike schwarz %tstats(maxlag+2) end do report(action=format,atcol=2,tocol=3,width=8) report(action=format,atcol=4,width=8) report(action=show) * linreg z # constant z{1} disp "T-mu=" (%beta(2)-1)/%stderrs(2) * * (b) DF test on floating period, 1974-1990 * * For DFUNIT, you give the range of usable data, and the regression end points * are adjusted to take lags into account. DFUNIT (with the ttest option) also * shows more exact critical values for the sample size than are provided by a * typical table. * @dfunit(ttest,lags=0) z 1974:1 1990:1 * * (c) DF on gold standard, 1870-1913 * @dfunit(ttest,lags=0) z 1870:1 1913:1 * * (d) To do Chow, estimate AR(1) on the two subsamples, and the full sample. The * SSR for the unrestricted regression will just be the sum from the two subsample * regressions. * linreg dz 1975:1 1990:1 ;# constant z{1} compute ssr0=%rss linreg dz 1792:1 1974:1 ;# constant z{1} compute ssr1=%rss linreg dz 1792:1 1990:1 ;# constant z{1} compute ssrr=%rss compute kf=(ssrr-(ssr0+ssr1))/((ssr0+ssr1)/(%nobs-4)) cdf(title="Chow test for structural break at 1975") chisquared kf 2 * * (e) ADF-GLS * * Step 1: GLS demeaning * compute rhobar=1-7.0/(123-80+1) set(first=z(1870:1)) zt 1870:1 1913:1 = z-rhobar*z{1} set(first=1.0) ct 1870:1 1913:1 = (1-rhobar) linreg zt 1870:1 1913:1;# ct set ztilde 1870:1 1913:1 = z-%beta(1) * * Step 2: DF with demeaned variable * @dfunit(ttest,lags=0,nointercept) ztilde * * Finding BIC minimum lag length * set dztilde = ztilde-ztilde{1} compute pmax=9 cmom # dztilde{0 to pmax} constant ztilde{1} linreg(cmom,noprint) dztilde # constant ztilde{1} compute schwarz = log(%rss/%nobs)+%nreg*log(%nobs)/%nobs display "Schwarz Criterion for ADF-GLS, Gold Standard Subsample" report(action=define,hlabels=||"Lags","Schwarz"||) report(row=new,atcol=1) 0 schwarz do maxlag=1,pmax linreg(cmom,noprint) dztilde # constant ztilde{1} dztilde{1 to maxlag} compute schwarz = log(%rss/%nobs)+%nreg*log(%nobs)/%nobs report(row=new,atcol=1) maxlag schwarz end do report(action=format,atcol=2,width=8) report(action=show)