

use "$data2/poverty_full_data", clear
capture log close
log using "$output/panel3.log", replace

ssc install outreg2

local outopts "label bracket noaster"
foreach y in 65 66 67 68 {
	//gen fed`y'_m=rpt_dol_caa`y'/1000
	gen fed`y'_m=fed`y'/1000000		// nara data
}

#delimit ;
local datacond `"stcode!="AK" & stcode!="HI" & stcode!="DC" "';

gen fed6568_m_real =
	fed65_m*34.8/31.5		// 1968 dollars
	+ fed66_m*34.8/32.4		// ftp://ftp.bls.gov/pub/special.requests/cpi/cpiai.txt
	+ fed67_m*34.8/33.4
	+fed68_m
	;


local r "replace";
foreach y in 6568 65 66 67 68{;
	reg fed`y'_m pred_fund_`y' if `datacond', robust;
		
	assert _b[pred_fund_`y']>0;
	test pred_fund_`y'==1; 	// test won't do one-sided directly
	local test1=ttail(`r(df_r)',sqrt(`r(F)')); // test >1 one-sided
	
	test pred_fund_`y'=1.2;
	local test2=`r(p)';
	
	outreg2 using "$output/table2A.txt",
		`r'
		`outopts'
		ctitle("FY19`y' \$ Mil.")
		addstat("P-value, slope<=1", `test1',
			"P-value, slope==1.2", `test2'
		)
	;
	local r "append";
};



		// WITH REGION EFFECTS

local r "replace";
foreach y in 6568 65 66 67 68{;
	reg fed`y'_m pred_fund_`y'  _region2 _region3 _region4 
		if `datacond', robust;
		
	assert _b[pred_fund_`y']>0;
	test pred_fund_`y'==1; 	// test won't do one-sided directly
	local test1=ttail(`r(df_r)',sqrt(`r(F)')); // test >1 one-sided
	
	test pred_fund_`y'=1.2;
	local test2=`r(p)';
	
	outreg2 pred_fund_`y'  _region2 _region3 _region4 
		using "$output/table1B.txt",
		`r'
		`outopts'
		ctitle("FY19`y' \$ Mil.")
		addstat("P-value, slope<=1", `test1',
			"P-value, slope==1.2", `test2'
		)
	;
	local r "append";
};


log close;
