This is the program file for Kevin L. Kliesen and Frank A. Schmid's article "Inflation Expectations and Macro Data Releases" in the Federal Reserve Bank of St. Louis's Review, May/June 2004 issue. This file contains 2 Gauss programs: neweywest.prg and amemiya.prg (neweywest.prg) @ Gauss program to correct test statistics and perform significance tests.@ @ For a description of the program's functions see the program and comments below @ new; #lineson; library pgraph; output file=c:\prg\strips\neweywest.out reset; str=datestr(0); tr=timestr(0); "GAUSS time ";; tr;; " date (US) ";; str; ?;"input file: neweywest.prg"; _iv=0; @ 1: instrumental variables @ rob=0; @ 1: delete days on which a speech was given (not used in paper); 2: use core measures only @ match=0; @ shorten window for STRIPS/TIIS measure to make it comply with window of CM measure @ ig=0; do while ig.<2; ig=ig+1; if match.==1 and ig.==2; break; endif; @ do STRIPS/TIIS measure only @ white=1; @ see below for manual activation of newest @ vnames="xx"; dtset0="c:\\data\\strips\\gauss\\newey\\newey"; dtset0="c:\\data\\yield\\gauss\\regress"; declare bvar2; open f0=^dtset0; dat=readr(f0,rowsf(f0)); f0=close(f0); clear f0; @ obs are currently stacked like this: 1997|1998|...|2003 @ @ ----- define variables ----- @ if ig.==1; ?;?;"STRIPS (OTR) INFLATION MEASURE";?; if match./=1; dat=delif(dat,(dat[.,1].<=1).*(dat[.,2].<31).*(dat[.,3].==1997)); elseif match.==1; @ use criterion used when ig.==2 @ dat=delif(dat,dat[.,3].<1999); dat=delif(dat,(dat[.,1].<=1).*(dat[.,2].<5).*(dat[.,3].==1999)); endif; y__=dat[.,4]; @ STRIPS inflation measure @ /* format /rd 10,5; y__[1:10]; */ dtset1="c:\\data\\strips\\gauss\\kernel\\res_otr"; /* dat[.,44]=missrv(dat[.,44],-9999); ex=dat[.,44]./=-9999; sumc(ex); wait; */ elseif ig.==2; ?;?;"CONSTANT MATURITY INFLATION MEASURE";?;?; dat=delif(dat,dat[.,3].<1999); dat=delif(dat,(dat[.,1].<=1).*(dat[.,2].<5).*(dat[.,3].==1999)); y__=dat[.,5]; @ constant-maturity inflation measure @ /* format /rd 10,5; y__[1:10]; */ dtset1="c:\\data\\strips\\gauss\\kernel\\res_cm"; /* dat[.,44]=missrv(dat[.,44],-9999); ex=dat[.,44]./=-9999; sumc(ex); wait; */ endif; @ compile dataset @ @ dat=dat[.,1:43 45 46]; @ @ use all variables bar the trading day indicator @ x__=dat[.,7:cols(dat)]~ones(rows(dat),1); @ standardized macro announcement variables~const @ let seqa_=1 2 3 6 5 8 9 7 10 11 12 13 33 35 34 15 17 16 18 25 19 20 21 23 24 26 29 30 31 32 27 28 36 37 38 39 4 22 14 40 42; @ cols(x__); rows(seqa_); wait; @ @ do not use the core numbers @ x__=dat[.,7:12 14:35 37:39 41:cols(dat)]~ones(rows(dat),1); @ 12/13: CPI/Core; 35/36: PPI/Core; 39/40: Sales/ex.Auto @ let seqa_=1 2 3 6 5 8 7 10 11 12 13 33 35 34 15 17 16 18 25 19 20 21 23 24 26 29 30 31 27 28 36 38 39 4 22 14 40 42; @ 8/9: CPI/Core; 31/32: PPI/Core; 36/37: Sales/ex.Auto @ if rob.==2; @ use the core numbers @ x__=dat[.,7:11 13:34 36:38 40:cols(dat)]~ones(rows(dat),1); @ 12/13: CPI/Core; 35/36: PPI/Core; 39/40: Sales/ex.Auto @ let seqa_=1 2 3 6 5 9 7 10 11 12 13 33 35 34 15 17 16 18 25 19 20 21 23 24 26 29 30 32 27 28 37 38 39 4 22 14 40 42; @ 8/9: CPI/Core; 31/32: PPI/Core; 36/37: Sales/ex.Auto @ endif; x__=missrv(x__,0); @ turn empty cells into zeros @ y_=rev(y__); x_=rev(x__); @ obs are now stacked like this: 2003|2002|...|1997 @ @ now isolate missing observations (there was trading but we do not have the observation) @ @ note that days on which there is no trading have been eliminated from the dataset @ seqas=seqa(1,1,rows(dat)); @ index that includes missing observations @ y_=missrv(y_,-9); ymiss=indexcat(y_,-9); @ positions of missing values @ y=delif(y_,y_.==-9); x=delif(x_,y_.==-9); seqam=delif(seqas,y_.==-9); if rob.==1; y =delif(y,x[.,cols(x)-1].==1); seqam=delif(seqam,x[.,cols(x)-1].==1); ymiss=ymiss|indexcat(x[.,cols(x)-1],1); x =delif(x,x[.,cols(x)-1].==1); endif; wks=rows(seqas); @ number of obs in time, including missing values @ @ wks=rows(y); @ l=floor(4.*((wks./100).^(2./9))); @ lag for Ljung-Box and Newey-West @ /* ************** deal with speech/testimony indicator ************* */ /* z= x[.,cols(x)-2:cols(x)]; @ do not exlude speech/testimony indicator: next to last column @ seqaz=seqa_[cols(x)-2:cols(x)]; zex=(z[.,1].==0).*(z[.,1].==0); @ z=delif(z,zex); @ @ create intercept indicator variable @ z=z[.,1 2]~zex~z[.,3]; @ two regressors, 0/1 intercept indicator, intercept @ seqaz=seqaz[1 2]|41|seqaz[3]; */ x_= x[.,1:cols(x)-2 cols(x)]; @ exlude speech/testimony indicator: next to last column @ seqax=seqa_[1:cols(x)-2 cols(x)]; @ create intercept indicator variable @ xex=(stdc(x_[.,1:cols(x_)-1]').==0); @ xex=(xex.==0); @ x_=x_[.,1:cols(x_)-1]~xex~x_[.,cols(x_)]; seqax=seqax[1:rows(seqax)-1]|41|seqax[rows(seqax)]; @ "number of nonzero observations:" rows(xex)-sumc(xex); wait; @ /* ************************** core program ************************* */ x=x_; @ frequency distribution of conincidence in surprises @ /* e=x[.,1:cols(x)-2]; e_=(e./=0); sumc(e_'); e__=(sumc(e_')); format /rd 8,0; sumc((e__.==0)); sumc((e__.==1)); sumc((e__.==2)); sumc((e__.==3)); sumc((e__.==4)); sumc((e__.==5)); sumc((e__.==6)); sumc((e__.==7)); sumc((e__.==8)); sumc((e__.==9)); wait; */ @ for iv approach @ z=x_; posmed=median(selif(z[.,cols(x_)-2],z[.,cols(x_)-2].>0)); negmed=median(selif(z[.,cols(x_)-2],z[.,cols(x_)-2].<0)); @ posmed; negmed; wait; @ zpos_=z; zneg_=z; zpos_[.,cols(x_)-2]= (z[.,cols(x_)-2].>posmed); zneg_[.,cols(x_)-2]=-(z[.,cols(x_)-2].