/***************************** * National Health Insurance * * Author(s): Comfort Sumida * *****************************/ /**************************************************************************** * Product: Age profiles of NHI * * Data requirements: Individual data on health usage, data on NHI benefits * * dayshosp = # of days hospitalized (individual) * * outpatn = # outpatient visits (individual) * * tx940 = household NHI benefits * * tx94 = individual NHI benefits (only available for those aged 14+ * * Methodology: Regression method with prices as a cubic in age * ****************************************************************************/ /**************************************************************************** * note(s): - do-files are for all years (loops) * * - estimated age profiles are not adjusted to aggregate controls * ****************************************************************************/ /* NHI */ /* adding cubic and dummy for age 0 */ # delimit ; set more off; forval i = 1995(1)2003 {; log using "C:\testquad4 `i'", replace; /* merging individual and household data sets */ 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"; save "C:\testquad4 `i'.dta", replace; /* unallocated portion of NHI */ sort savehhid; by savehhid: egen nhi = sum(tx94); gen health1 = tx940 - nhi; /* generating usage variables */ 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 z0 = _b[a3hosp]; gen z1 = _b[a3out]; gen x0 = _b[a0hosp]; gen x1 = _b[a0out]; /* estimated outpatient and inpatient expenditures */ gen inpatient = (a0 + a1 * age + a2 * agesq + z0 * age3 + x0 * age0) * dayshosp; gen outpatient = (b0 + b1 * age + b2 * agesq + z1 * age3 + x1 * 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); /* total NHI expenditure is allocated portion + individual reported */ recode tx94 (. = 0); egen health4 = rsum(health3 tx94); lowess tx94 age1, bwidth(0.1) nograph gen(stx94); egen health5 = rsum(smooth1 stx94); save "C:\testquad4 `i'.dta", replace; log close; };