/***************************** * Private Health * * Author(s): Comfort Sumida * *****************************/ /*************************************************************************************************** * Product: Age profiles of private health expenditures (CFH) * * Data requirements: Individual data on health usage, household data on health expenditures * * dayshosp = # of days hospitalized (individual) * * outpatn = # outpatient visits (individual) * * tx810 = household medical care and sanitation expenditures * * tx814 = household personal accident and medical premiums * * tx816 = household medical consumption of NHI * * Methodology: Regression method with prices as a cubic in age * **************************************************************************************************/ /***************************************************************************************************************************************** * note(s): - do-files are for all years (loops) (two do-files below) * * - estimated age profiles are not adjusted to aggregate controls * * - years prior to 1995 do not have individual data on health usage -- smoothed age profiles from 1996 are used as indicators * *****************************************************************************************************************************************/ # delimit ; set more off; /*********************************************** * earlier years without individual usage data * ***********************************************/ /* creating usage profiles from 1996 data */ use "C:\mind1996", clear; recode age (90/max = 90); sort age; lowess dayshosp age, nograph bwidth(0.1) gen(sdayshosp); lowess outpatn age, nograph bwidth(0.1) gen(soutpatn); collapse (mean) dayshosp outpatn sdayshosp soutpatn [w = mult], by(age); save "C:\usage profiles 1996.dta", replace; forval i = 1976(1)1994 {; log using "C:\testquad-CFH `i'-earlier years", replace; /* merging individual and household data, and 1996 usage data */ use "C:\mind`i'.dta", clear; sort savehhid; save "C:\temp1.dta", replace; use "C:\hhitem`i'.dta", clear; sort savehhid; merge savehhid using "C:\temp1.dta"; tab _merge; drop _merge; save "C:\testquad-CFH `i'-earlier years.dta", replace; use "C:\usage profiles 1996.dta", clear; sort age; save "C:\temp2.dta", replace; use "C:\testquad-CFH `i'-earlier years.dta", clear; recode age (90/max = 90); sort age; merge age using "C:\temp2.dta"; tab _merge; drop _merge; save "C:\testquad-CFH `i'-earlier years.dta", replace; /* household health expenditures (non-NHI) */ gen health1 = tx810 - tx814 - tx816; sort savehhid; by savehhid: egen hosp1 = sum(dayshosp); by savehhid: egen out1 = sum(outpatn); by savehhid: egen ahosp = sum(age*dayshosp); by savehhid: egen aout = sum(age*outpatn); gen agesq = age^2; by savehhid: egen a2hosp = sum(agesq*dayshosp); by savehhid: egen a2out = sum(agesq*outpatn); gen age3 = age^3; by savehhid: egen a3hosp = sum(age3*dayshosp); by savehhid: egen a3out = sum(age3*outpatn); /* did not use age 0 dummy because of collinearity problems */ reg health1 hosp1 out1 ahosp aout a2hosp a2out a3hosp a3out [w = mult] if rel == 1, robust noconstant; gen a0 = _b[hosp1]; gen b0 = _b[out1]; gen a1 = _b[ahosp]; gen b1 = _b[aout]; gen a2 = _b[a2hosp]; gen b2 = _b[a2out]; gen a3 = _b[a3hosp]; gen b3 = _b[a3out]; /* estimated outpatient and inpatient benefits */ gen inpatient = (a0 + a1 * age + a2 * agesq + a3 * age3) * dayshosp; gen outpatient = (b0 + b1 * age + b2 * agesq + b3 * age3) * outpatn; recode inpatient outpatient (. = 0); sort savehhid; egen sum = rsum(inpatient outpatient); by savehhid: egen total1 = sum(sum); gen share1 = sum/total1; gen health3 = share1 * health1; recode health3 (. = 0); lowess inpatient1 age, bwidth(0.1) nograph gen(sinpatient1); lowess outpatient1 age, bwidth(0.1) nograph gen(soutpatient1); egen smooth1 = rsum(sinpatient1 soutpatient1); save "C:\testquad-CFH `i'-earlier years", replace; log close; }; /****************************************** * later years with individual usage data * ******************************************/ /* prices as a cubic in age with dummy for age 0 */ /* private health consumption */ /* FIES years 1995 and later contain individual health usage data */ forval i = 1995(1)2003 {; log using "C:\testquad-CFH `i'", replace; /* merging individual and household data */ use "C:\mind`i'", clear; sort savehhid; save "C:\temp1.dta", replace; use "C:\hhitem`i'.dta", clear; sort savehhid; merge savehhid using "C:\temp1.dta"; save "C:\testquad-CFH `i'.dta", replace; recode age (90/max = 90); /* household health expenditures (non-NHI) */ sort savehhid; gen health1 = tx810 - tx814 - tx816; by savehhid: egen hosp1 = sum(dayshosp); by savehhid: egen out1 = sum(outpatn); by savehhid: egen ahosp = sum(age*dayshosp); by savehhid: egen aout = sum(age*outpatn); gen agesq = age^2; by savehhid: egen a2hosp = sum(agesq*dayshosp); by savehhid: egen a2out = sum(agesq*outpatn); gen age3 = age^3; by savehhid: egen a3hosp = sum(age3*dayshosp); by savehhid: egen a3out = sum(age3*outpatn); gen age0 = age == 0; by savehhid: egen a0hosp = sum(age0*dayshosp); by savehhid: egen a0out = sum(age0*outpatn); reg health1 hosp1 out1 ahosp aout a2hosp a2out a3hosp a3out a0hosp a0out [w = mult2] if rel == 1, robust noconstant; gen a0 = _b[hosp1]; gen b0 = _b[out1]; gen a1 = _b[ahosp]; gen b1 = _b[aout]; gen a2 = _b[a2hosp]; gen b2 = _b[a2out]; gen a3 = _b[a3hosp]; gen b3 = _b[a3out]; gen a4 = _b[a0hosp]; gen b4 = _b[a0out]; /* estimated outpatient and inpatient benefits */ gen inpatient = (a0 + a1 * age + a2 * agesq + a3 * age3 + a4 * age0) * dayshosp; gen outpatient = (b0 + b1 * age + b2 * agesq + b3 * age3 + b4 * age0) * outpatn; recode inpatient outpatient (. = 0); sort savehhid; egen sum = rsum(inpatient outpatient); by savehhid: egen total1 = sum(sum); gen share1 = sum/total1; gen health3 = share1 * health1; recode health3 (. = 0); lowess inpatient1 age, bwidth(0.1) nograph gen(sinpatient1); lowess outpatient1 age, bwidth(0.1) nograph gen(soutpatient1); egen smooth1 = rsum(sinpatient1 soutpatient1); save "C:\testquad-CFH `i'", replace; log close; };