From: <Saved by Windows Internet Explorer 7>
Subject: 
Date: Wed, 9 Dec 2009 11:39:28 -0600
MIME-Version: 1.0
Content-Type: text/html;
	charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable
Content-Location: http://www.chicagofed.org/economic_research_and_data/research_resources/files/rr_french_incprof.do
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3350

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dwindows-1252">
<META content=3D"MSHTML 6.00.6000.16915" name=3DGENERATOR></HEAD>
<BODY><PRE># delimit ;=20
clear;=20
set mem 300m;=09
set more 1 ; =20
drop _all;
program drop _all;
capture log close;
log using c:\research\hrs\wealth\incprof.log, replace ;=20
use c:\research\hrs\wealth\dataprep2;
gen useheal=3D0 ;
********************************************;
* IMPORTANT NOTE ABOUT THE DATA             ;
* WAVE 1 OF THE AHEAD IS PRETTY SCREWED UP  ;
* THE QUESTIONS ASKED ARE LESS COMPREHENSIVE;
* THAN IN OTHER WAVES, AND SO THE MEANS OF  ;
* DIFFERENT VARIABLES ARE LOWER             ;
********************************************;
*drop if (wave=3D=3D2);
*drop if (wave=3D=3D3);

replace lhhinc=3D. if (wave=3D=3D2|wave=3D=3D3);
replace lanninc=3D. if (wave=3D=3D2|wave=3D=3D3);
replace lsocy=3D. if (wave=3D=3D2|wave=3D=3D3);
*replace linc=3D. if (wave=3D=3D2|wave=3D=3D3);




sort HHID  realyear female;
drop if HHID=3D=3DHHID[_n-1] &amp; realyear=3D=3Drealyear[_n-1];

gen healage=3Dage1*heal;
gen maleage=3Dage1*male;


******************PROCEDURES HERE ***********************;
*this program generates a polynomial in adist;
program define makedist;
        version 3.1;
drop PI2 PI3 PIage;
gen PI2=3DPI*PI;
gen PI3=3D PI2*PI;
gen PIage=3DPI*age1;
end;
set trace off ;
makedist;


*this program generates average income at different percentiles of the =
income distribution;
program define genPIshift;
        version 3.1;
	replace PI=3DPip1;
	makedist;
	gen lannincp1=3Dageshiftvarc+PI*bPI+PI2*bPI2+(PIage*bPIage);
	replace PI=3DPip2;
	makedist;
	gen lannincp2=3Dageshiftvarc+PI*bPI+PI2*bPI2+(PIage*bPIage);
	replace PI=3DPip3;
	makedist;
	gen lannincp3=3Dageshiftvarc+PI*bPI+PI2*bPI2+(PIage*bPIage);
	replace PI=3DPip4;
	makedist;
	gen lannincp4=3Dageshiftvarc+PI*bPI+PI2*bPI2+(PIage*bPIage);

	gen _20th_percentile=3Dexp(lannincp1);
	gen _40th_percentile=3Dexp(lannincp2);
	gen _60th_percentile=3Dexp(lannincp3);
	gen _80th_percentile=3Dexp(lannincp4);
	drop lannincp*;
end;

if FE=3D=3D0{;
* OLS;
reg lhhinc age1 age2 age3 age4 age5;
predict lhhincp;

reg lanninc age1 age2 age3 age4 age5;
predict lannincp;

reg lsocy age1 age2 age3 age4 age5;
predict lsocyp;

reg linc age1 age2 age3 age4 if lfpr=3D=3D0;
replace lfpr=3D0;
predict lincpl;
};

if FE=3D=3D1{;
* fixed effects ;

* do fixed-effects regression and get predictions;
/*
xtreg lanninc age1 age2 age3 heal healage PIage maleage, fe i(HHID);
predict lannincp;
gen lannincres=3Dlanninc-lannincp;
gen ageshift=3D_b[_cons]+(_b[age1]*age1)+(_b[age2]*age2) =
+(_b[age3]*age3);
gen bheal=3D_b[heal];
gen healshift=3D_b[heal]+_b[healage]*age1;
gen maleshift=3D_b[maleage]*age1;
gen PIshift=3D_b[PIage]*age1;
gen bPIage=3D_b[PIage];
*/
if useheal=3D=3D1{;
xtreg lanninc age1 age2 age3 heal healage , fe i(HHID);
predict lannincp;
gen lannincres=3Dlanninc-lannincp;
gen ageshift=3D_b[_cons]+(_b[age1]*age1)+(_b[age2]*age2) =
+(_b[age3]*age3);
gen bheal=3D_b[heal];
gen healshift=3D_b[heal]+_b[healage]*age1;
gen maleshift=3D0;
gen PIshift=3D0;
gen bPIage=3D0;
};
if useheal=3D=3D0{;
xtreg lanninc age1 age2 age3, fe i(HHID);
predict lannincp;
gen lannincres=3Dlanninc-lannincp;
gen ageshift=3D_b[_cons]+(_b[age1]*age1)+(_b[age2]*age2) =
+(_b[age3]*age3);
gen bheal=3D0;
gen healshift=3D0;
gen maleshift=3D0;
gen PIshift=3D0;
gen bPIage=3D0;
};

*sort age;
*by age: sum lanninc* age*;
*exit;

* now run a regression on the residuals;
reg lannincres PI PI2 male;
predict respred;
replace ageshift=3Dageshift+_b[_cons];
gen ageshiftFINAL=3Dageshift;
replace maleshift=3Dmaleshift+_b[male];
replace PIshift=3DPIshift+_b[PI];
gen bPI =3D_b[PI];
gen bPI2=3D_b[PI2];
gen bmale=3D_b[male];

* see if cohort effects are important to worry about;
reg lannincres PI PI2 male cohort2 cohort3 cohort4 cohort5 cohort6 =
cohort7; * now generate percentiles of the distribution;

* figure out variance of residual;
gen resres=3Dlannincres-respred;
egen sdres=3Dsd(resres);
gen varc=3D(sdres*sdres)/2;
sum varc;
gen ageshiftvarc=3Dageshift+varc;

* regress some other income measures on age;
xtreg lsocy age1 age2 age3 age4 age5, fe i(HHID);
predict lsocyp;

xtreg lhhinc age1 age2 age3 age4 age5, fe i(HHID);
predict lhhincp;

xtreg lhhinc age1 age2 age3 age4 age5 if lfpr=3D=3D0, fe i(HHID);
replace lfpr=3D0;
predict lincpl;
};

gen hhincp=3Dexp(lhhincp);
gen incp=3Dexp(lincp);
gen annincp=3Dexp(lannincp);
gen socyp=3Dexp(lsocyp);
gen incpl=3Dexp(lincpl);



drop if age1&gt;102|age1&lt;70;
sort age1;
sort age1;
drop if age1=3D=3Dage1[_n-1];
save c:\research\hrs\wealth\incprof, replace;
drop if age&gt;100;

***********************************;
* GRAPHS                           ;
***********************************;

set scheme s1mono;

* GRAPHS;
* by type of income;
twoway connected hhincp annincp incp socyp age, msymbol(T S D O) =
lpattern(solid longdash shortdash longdash_dot) c(ll) ti("Income, by =
type") saving(income, replace);
graph use income.gph;
graph display, ysize(6) xsize(8.25);
graph export c:\research\papers\wealth\incomebytype.eps, replace;

*for anninc, by asset quantile;
* by type of income;
if FE=3D=3D1{;

****************** healthy women;
genPIshift;

twoway connected _20th_percentile _40th_percentile _60th_percentile =
_80th_percentile age, ysc(r(7000 20000)) ylabel(7000 10000 15000 20000) =
msymbol(T S D O) lpattern(solid longdash shortdash longdash_dot) =
ti("Income, by Permanent Income Percentile, Healthy =
Women",size(medlarge)) l1(1998 dollars) ytitle("") saving(income, =
replace);
graph use income.gph;
graph display, ysize(6) xsize(8.25);
graph export c:\research\papers\wealth\incomegw.eps, replace;
graph export c:\research\papers\wealth\incomegw.emf, replace;
**********numbers behind the graphs****************;
sort age;
by age: sum _20th_percentile _40th_percentile _60th_percentile =
_80th_percentile age;

*************** unhealthy women;
drop _*;
replace ageshiftvarc=3Dageshiftvarc+healshift;
genPIshift;
replace ageshiftvarc=3Dageshiftvarc-healshift;

twoway connected _20th_percentile _40th_percentile _60th_percentile =
_80th_percentile age, legend(off) ysc(r(7000 20000)) ylabel(7000 10000 =
15000 20000) msymbol(T S D O) lpattern(solid longdash shortdash =
longdash_dot) ti("Income, by Permanent Income Percentile, Unhealthy =
Women", size(medlarge)) l1(1998 dollars) ytitle("") saving(income, =
replace);
graph use income.gph;
graph display, ysize(6) xsize(8.25);
graph export c:\research\papers\wealth\incomebw.eps, replace;
graph export c:\research\papers\wealth\incomebw.emf, replace;
**********numbers behind the graphs****************;
sort age;
by age: sum _20th_percentile _40th_percentile _60th_percentile =
_80th_percentile age;

******************** healthy men;
drop _*;
replace ageshiftvarc=3Dageshiftvarc+maleshift;
genPIshift;
replace ageshiftvarc=3Dageshiftvarc-maleshift;

twoway connected _20th_percentile _40th_percentile _60th_percentile =
_80th_percentile age, legend(off) ysc(r(7000 20000)) ylabel(7000 10000 =
15000 20000) msymbol(T S D O) lpattern(solid longdash shortdash =
longdash_dot) ti("Income, by Permanent Income Percentile, Healthy Men", =
size(medlarge)) l1(1998 dollars) ytitle("") saving(income, replace);
graph use income.gph;
graph display, ysize(6) xsize(8.25);
graph export c:\research\papers\wealth\incomegm.eps, replace;
graph export c:\research\papers\wealth\incomegm.emf, replace;
**********numbers behind the graphs****************;
sort age;
by age: sum _20th_percentile _40th_percentile _60th_percentile =
_80th_percentile age;

******************* unhealthy men;
drop _*;
replace ageshiftvarc=3Dageshiftvarc+healshift+maleshift;
genPIshift;
replace ageshiftvarc=3Dageshiftvarc-healshift-maleshift;

twoway connected _20th_percentile _40th_percentile _60th_percentile =
_80th_percentile age, legend(off) ysc(r(7000 20000)) ylabel(7000 10000 =
15000 20000) msymbol(T S D O) lpattern(solid longdash shortdash =
longdash_dot) ti("Income, by Permanent Income Percentile, Unhealthy =
Men", size(medlarge)) l1(1998 dollars) ytitle("") saving(income, =
replace);
graph use income.gph;
graph display, ysize(6) xsize(8.25);
graph export c:\research\papers\wealth\incomebm.eps, replace;
graph export c:\research\papers\wealth\incomebm.emf, replace;
**********numbers behind the graphs****************;
sort age;
by age: sum _20th_percentile _40th_percentile _60th_percentile =
_80th_percentile age;

};

*replace ageshift=3Dageshift;
*keep age ageshift bPI bPI2;
*order age ageshift bPI bPI2;

use c:\research\hrs\wealth\incprof, replace;


keep age ageshiftFINAL healshift maleshift PIshift bPI2;
order age ageshiftFINAL healshift maleshift PIshift bPI2;

sum;


outsheet using c:\research\hrs\wealth\incprof,nonames replace;
drop _all;
program drop _all;
log close;


</PRE></BODY></HTML>
