/*olsreg.prg runs ols regressions a la st. lois fed for EP article */ library pgraph; convt = 1; output file = olsreg.out reset; load x[] = marty.dat; x = reshape(x,rows(x)/8,8); y = x[.,1]; p = x[.,2]; pcom = x[.,3]; nbr = x[.,4]; tr = x[.,5]; ff = x[.,6]; m1 = x[.,7]; m2 = x[.,8]; dates = seqb(65.5,95.25,0.25); /* OLS regression of y on lags of ff */ T = rows(ff); k = 13; dy = -999|(100*ln(y[2:T]./y[1:T-1])); /* remember not to use 1st element */ lhs = dy[k:T]; rhs = ff[k:T]; let __altnam = "ff(t)"; i = 1; do while i <= k-1; rhs = rhs~ff[k-i:T-i]; __altnam = __altnam | ("ff(t-" $+ ftos(i,"*.*lf",1,0) $+ ")"); i = i+1; endo; __altnam = __altnam | "Dy(t)"; { vnam,m,b,stb,vc,stderr,sigma,cx,rsq,resid,dwstat } = OLS("",lhs,rhs); graphjc; title("Effect of federal funds rate blip on GDP growth"); ylabel("% GDP" ); xlabel("Lag in quarters"); ytics(-0.3,0.3,0.1,0); _pcolor = 15; _psymsiz = 3; _plctrl = 0|1|0|0; _pltype = 6|6|3|3; xy(seqa(0,1,rows(b)-1), zeros(rows(b)-1,1)~(b[2:rows(b)]+stderr[2:rows(b)].*(0~-1~1))); if convt; dos pqgrun graphic.tkf -c=2 -cf=fig1.pic; endif; /* OLS regression of y on lags of dff */ dy = -999|(100*ln(y[2:T]./y[1:T-1])); /* remember not to use 1st element */ dff = -999|(ff[2:T]-ff[1:T-1]); lhs = dy[k+1:T]; rhs = dff[k+1:T]; let __altnam = "dff(t)"; i = 1; do while i <= k-1; rhs = rhs~dff[k+1-i:T-i]; __altnam = __altnam | ("dff(t-" $+ ftos(i,"*.*lf",1,0) $+ ")"); i = i+1; endo; __altnam = __altnam | "Dy(t)"; { vnam,m,b2,stb2,vc,stderr2,sigma,cx,rsq,resid,dwstat } = OLS("",lhs,rhs); /* graph */ graphjc; title("Effect of federal funds rate change on GDP growth\L= "$+ "Effect of funds rate blip on GDP level"); ylabel("% GDP" ); xlabel("Lag in quarters"); ytics(-0.3,0.3,0.1,0); _pcolor = 15; _plctrl = 0|1|0|0; _pltype = 6|6|3|3; xy(seqa(0,1,rows(b)-1), zeros(rows(b)-1,1)~ (b2[2:rows(b2)]+stderr2[2:rows(b2)].*(0~-1~1))); if convt; dos pqgrun graphic.tkf -c=2 -cf=fig1b.pic; endif; graphjc; title("Effect of federal funds rate change on GDP level"); ylabel("% GDP" ); xlabel("Lag in quarters"); _pcolor = 15; _plctrl = 0|1|0|0; _pltype = 6|6|3|3; xy(seqa(0,1,rows(b)-1), zeros(rows(b)-1,1)~cumsumc(b2[2:rows(b2)])); if convt; dos pqgrun graphic.tkf -c=2 -cf=fig1c.pic; endif; output off;