*** FIGURES FOR Carrera, Royer, Stehr, Sydnor, and Taubinsky (2021) *********** ******************************************************************************* *** Initial set-up *** clear set more off *** Set directories for data and output *** cd "$main/Output" /* Note: all figures will output to the working directory. Uses a program from master_do_file_for_analysis.do */ *** (uniform_range.pdf) ******************************************************* set obs 500 *** Generate benefit values *** gen b = _n/500 *** Generate commitment contract demand regions for each beta *** forvalues beta = 1(1)500 { local B = `beta'/500 gen bindingcommit`beta' = ( ((2*b-1)/(2*(b^2))) > `B'*(1-.5*`B') ) } *** Reshape data for graphing *** reshape long bindingcommit, i(b) j(B) replace B = B/500 *** Produce Figure 1 *** twoway contour bindingcommit B b if B >= .75 & B <= .95, levels(2) /* */ ccolors(red blue) xlabel(0(.1)1) ylabel(.75(.05).95) /* */ xtitle("Benefit (share of time beneficial)") ytitle("Perceived short-run discount factor") /* */ graphr(color(white) fcolor(white)) bgcolor(white) plotregion(margin(zero)) clegend(off) *** Export figure graph export uniformrange.pdf, replace * with descriptive text superimposed in the paper *** Load and clean experimental data ****************************************** *** Load dataset *** use "$main/Data/cleaned_commitment_study_data", clear *** Variable Creation & Cleaning Steps *** *** Create an ID variable for use when reshaping long gen id = _n *** Generate info treatment indicators gen first_info = type_of_info=="1-onlygraph" gen new_info = type_of_info=="2-graphplus" gen control_info = (new_info == 0 & first_info == 0) *** Generate wave indicators gen wave1 = (wave == "fall") gen wave2 = (wave == "winter") gen wave3 = (wave == "spring") *** Define anticommitment/commitment variables for each threshold gen anticommit8 = q170 ==2 if q170<. gen commit8 = q169 ==2 if q169<. gen anticommit12 = chose_anticommit11 gen commit12 = chose_commit12 gen anticommit16 = q296==2 if q296<. gen commit16 = q295 ==2 if q295<. *** Restrict sample to those exogenously assigned incentives keep if flag_low_wtp == 0 & flag_exclude_exog == 0 *** (wtp_ev_tcbench.pdf) ****************************************************** *** Generate additional variables *** Expected value of earnings based on subjective "days" estimate for frequency of visits gen ev1 = days_1 gen ev2 = days_2*2 gen ev3 = days_3*3 gen ev5 = days_5*5 gen ev7 = days_7*7 gen ev12 = days_12*12 *** Generate values for the $0 incentive gen wtp0 = 0 gen ev0 = 0 *** Estimate means with 95% confidence intervals mat data = J(7, 7, .) // initialize matrix for storing values loc row = 1 foreach p in 0 1 2 3 5 7 12 { * Input incentive in first column mat data[`row', 1] = `p' * Input means & CI bounds of WTP in next three columns ci means wtp`p' mat data[`row', 2] = r(mean) mat data[`row', 3] = r(lb) mat data[`row', 4] = r(ub) * Input means & CI bounds of expected earnings in last three columns ci mean ev`p' mat data[`row', 5] = r(mean) mat data[`row', 6] = r(lb) mat data[`row', 7] = r(ub) loc ++row // increment row } *** Use data stored in matrix preserve clear svmat data ren (data*) (incentive wtp wtplb wtpub ev evlb evub) *** Store certain statistics *** * Average expected earnings under $1 incentive sum ev if incentive == 1 // EV equals exp. visits under this incentive loc avgexp : di %4.2f r(mean) latex_write avgexpincone `avgexp' numbers * Average WTP for $1 incentive sum wtp if incentive == 1 loc avgwtp : di %4.2f r(mean) latex_write avgwtpincone `avgwtp' numbers * Difference loc diff : di %4.2f `avgwtp'-`avgexp' latex_write avgdiffincone `diff' numbers *** Produce figure *** graph twoway (connected ev incentive, lc(black) msymbol(none) mc(none) lp(dash)) /* */ (rcap evub evlb incentive, lc(black) lw(*.5) msize(*2.25)) /* */ (connected wtp incentive, lc(cranberry) mlc(cranberry) mc(none) msymbol(circle) msize(vsmall)) /* */ (rcap wtpub wtplb incentive, lc(cranberry) lw(*.5) msize(*2.25)), /* */ xtitle("Per-visit incentive ($)", height(6)) ylabel(0(25)225, angle(0)) xlabel(1(1)12) /* */ graphr(color(white) fcolor(white)) bgcolor(white) plotregion(margin(zero)) /* */ ytitle("$", height(6)) legend(order(1 3) label(1 "Avg. subjective expected earnings") label(3 "Avg. WTP for that incentive") rows(3)) *** Export figure graph export wtp_ev_tcbench.pdf, replace restore *** (deltas.pdf) ************************************************************** *** Generate additional variables *** preserve *** Better measures of Commitment as per proposition /*** These are the amounts, per attendance, by which a person "overpays" for the increase in incentive. Second-order approximation */ gen delta1=(wtp1) - (days_1+days_0)/2 gen delta2 = (wtp2-wtp1) - (days_2+days_1)/2 gen delta3=(wtp3-wtp2) - (days_3+days_2)/2 gen delta5=(wtp5-wtp3)/(5-3) - (days_5+days_3)/2 gen delta7=(wtp7-wtp5)/(7-5) - (days_7+days_5)/2 gen delta12=(wtp12-wtp7)/(12-7) - (days_12+days_7)/2 gen avg_delta = (delta1 + delta2+delta3 + delta5 + delta7 + delta12)/6 gen avg_delta_ex1 = (delta2+delta3 + delta5 + delta7 + delta12)/5 // DELTA MEASURES DIFFERENCES FROM TC BENCHMARK *** Run the regressions and store results with model names quietly reg avg_delta, robust est store m1 loc avgbcp = _b[_cons] loc avg : di %4.2f `avgbcp' latex_write avgbcp `avg' numbers quietly reg avg_delta_ex1, robust est store m2 loc avgbcpex1 = _b[_cons] loc avg : di %4.2f `avgbcpex1' latex_write avgbcpexone `avg' numbers *** Produce figure: average delta with CI's for the info-control group *** coefplot (m1, aseq(Average across incentives))/* */ (m2, aseq(Average excluding $1 incentive)) /* */, xline(0) xlabel(-1(.5)2.5) legend(off) mc(black) offset(0) ciopts(lc(black) /* */ recast(rcap) lp(dash)) grid(none) aseq swap graphr(fcolor(white) color(white)) /* */ xtitle("Behavior change premium ($)", height(6)) plotregion(margin(zero)) *** Export figure graph export deltas.pdf, replace restore *** (overconfidence.pdf) ********************************************** *** Obtain coefficients for plot *** * Generate placeholder forval k = 0/12 { gen var`k' = . label variable var`k' `k' } * Generate estimates forval k = 0(1)12 { replace var`k' = 10 reg var`k' var`k', nocons eststo m_v_`k' if `k' != 4 & `k' != 6 & `k' != 8 & `k' != 9 & `k' != 10 & `k' != 11{ replace var`k' = (flag_exclude_exog==0&flag_low_wtp==0) reg days_`k' var`k', robust nocons est store m_days`k'_all } if `k' != 1 & `k' != 3 & `k' != 12 & `k' != 4 & `k' != 6 & `k' != 8 & `k' != 9 & `k' != 10 & `k' != 11{ replace var`k' = (incentive == `k' &flag_exclude_exog==0 /// &flag_low_wtp==0) reg visits var`k' if incentive == `k', robust nocons est store m_visits`k'_given * Store number of observations if `k' == 0 loc num "zero" else if `k' == 2 loc num "two" else if `k' == 5 loc num "five" else loc num "seven" latex_write incentive`num'obs `e(N)' numbers } } *** Produce figure: Overconfidence *** *** Beliefs vs reality coefplot (m_v_*, offset(0) m(none) lp(none)) /* */ (m_days0_all m_days1_all m_days2_all m_days3_all m_days5_all m_days7_all m_days12_all, offset(0) recast(connected) msize(small) mc(black) lp(dash) lc(black) ciopts(lc(black) recast(rcap) lp(solid)) )/* */ (m_visits0_given m_visits2_given m_visits5_given m_visits7_given, offset(0) recast(connected) msize(small) m(square) mc(red) lc(red) ciopts(lc(red) recast(rcap) lp(dash)) ) /* */, vertical plotregion(margin(zero)) xlabel(1 "0" 2 "1" 3 "2" 4 "3" 5 "4" 6 "5" 7 "6" 8 "7" 9 "8" 10 "9" 11 "10" 12 "11" 13 "12") /* */ graphr(color(white) fcolor(white)) bgcolor(white) xtitle("Per-visit incentive ($)", height(6)) ytitle("Visits", height(6))/* */ ylabel(0(5)22, angle(0)) legend(order(4 6) label(4 "Average expected visits") label(6 "Average realized visits")) legend(rows(2)) *** Export figure graph export overconfidence.pdf, replace *** (overconfidence_treatment.pdf) ******************************************** *** Obtain coefficients for plots *** foreach cdtn in "wave1 == 1" "(wave2 == 1 | wave3 == 1)"{ if "`cdtn'" == "wave1 == 1"{ loc treat "first_info" loc name "1" loc tlab "basic" loc excl "5" loc result5_c "" loc result5_t "" } else{ loc treat "new_info" loc name "23" loc tlab "enhanced" loc excl "100" loc result5_c "m_visits5_given_c" loc result5_t "m_visits5_given_t" } * Generate estimates forval k = 0(1)12 { replace var`k' = 10 reg var`k' var`k', nocons eststo m_v_`k' * Information treatment if `k' != 4 & `k' != 6 & `k' != 8 & `k' != 9 & `k' != 10 & `k' != 11{ replace var`k' = (flag_exclude_exog==0&flag_low_wtp==0& /// `cdtn'&`treat'==1) reg days_`k' var`k' if `cdtn'&`treat'==1, robust nocons est store m_days`k'_all_t } if `k' != 1 & `k' != 3 & `k' != 4 & `k' != 6 & `k' != 8 & `k' != 9 & `k' != 10 & `k' != 11 & `k' != 12 & `k' != `excl'{ replace var`k' = (incentive == `k' &flag_exclude_exog==0 /// &flag_low_wtp==0&`cdtn'&`treat'==1) reg visits var`k' if incentive == `k' & `cdtn'&`treat'==1, /// robust nocons est store m_visits`k'_given_t * Store number of observations loc treatobs = e(N) } * Information control if `k' != 4 & `k' != 6 & `k' != 8 & `k' != 9 & `k' != 10 & `k' != 11{ replace var`k' = (flag_exclude_exog==0&flag_low_wtp==0& /// `cdtn'&`treat'!=1) reg days_`k' var`k' if `cdtn'&`treat'!=1, robust nocons est store m_days`k'_all_c } if `k' != 1 & `k' != 3 & `k' != 4 & `k' != 6 & `k' != 8 & `k' != 9 & `k' != 10 & `k' != 11 & `k' != 12 & `k' != `excl'{ replace var`k' = (incentive == `k' &flag_exclude_exog==0 /// &flag_low_wtp==0&`cdtn'&`treat'!=1) reg visits var`k' if incentive == `k' & `cdtn'&`treat'!=1, /// robust nocons est store m_visits`k'_given_c * Store number of observations if `k' == 0 loc num "zero" else if `k' == 2 loc num "two" else if `k' == 5 loc num "five" else loc num "seven" loc bothobs = e(N) + `treatobs' latex_write incentive`num'obs`tlab' `bothobs' numbers } } * Store total observations used sum var0 if `cdtn'&`treat'==1 latex_write obs`tlab'treat `r(N)' numbers sum var0 if `cdtn'&`treat'!=1 latex_write obs`tlab'control `r(N)' numbers *** Produce figure: Overconfidence *** local jig = .1 *** Beliefs vs reality coefplot (m_v_*, offset(0) m(none) lp(none)) /* */ (m_days0_all_c m_days1_all_c m_days2_all_c m_days3_all_c m_days5_all_c m_days7_all_c m_days12_all_c, offset(-`jig') recast(connected) msize(small) mc(black) lp(dash) lc(black) ciopts(lc(black) recast(rcap) lp(solid)) )/* */ (m_visits0_given_c m_visits2_given_c `result5_c' m_visits7_given_c, offset(-`jig') recast(connected) msize(small) m(square) mc(black) lc(black) lp(solid) ciopts(lc(black) recast(rcap) lp(dash)) ) /* */ (m_days0_all_t m_days1_all_t m_days2_all_t m_days3_all_t m_days5_all_t m_days7_all_t m_days12_all_t, offset(`jig') recast(connected) m(Oh) msize(small) mc(blue) lp(dash) lc(blue) ciopts(lc(blue) recast(rcap) lp(solid)) )/* */ (m_visits0_given_t m_visits2_given_t `result5_t' m_visits7_given_t, offset(`jig') recast(connected) msize(small) m(Sh) mc(blue) lc(blue) lp(solid) ciopts(lc(blue) recast(rcap) lp(dash)) ) /* */, vertical plotregion(margin(zero)) xlabel(1 "0" 2 "1" 3 "2" 4 "3" 5 "4" 6 "5" 7 "6" 8 "7" 9 "8" 10 "9" 11 "10" 12 "11" 13 "12") /* */ graphr(color(white) fcolor(white)) bgcolor(white) xtitle("Per-visit incentive ($)", height(6)) ytitle("Visits", height(6))/* */ ylabel(0(5)22, angle(0)) legend(order(4 6 8 10) label(4 "Average expected visits, information control") label(6 "Average realized visits, information control") label(8 "Average expected visits, `tlab' information treatment") label(10 "Average realized visits, `tlab' information treatment")) legend(rows(4)) *** Export figure graph export overconfidence_treatment_wave`name'.pdf, replace eststo clear } *** (exp_actual_under_incentive.pdf) ****************************************** *** Expected attendance w/incentive given vs. actual attendance w/incentive * Generate variable for expected attendace w/incentive given gen days_exp = . foreach i in 0 1 2 3 5 7{ replace days_exp = days_`i' if incentive == `i' } * Plot with 45-degree line preserve binscatter visits days_exp, /// ytitle(Actual attendance, height(6)) /// xtitle(Expected attendance under assigned incentive, height(6)) /// xlab(0(5)30) ylab(0(5)30, angle(0)) plotregion(margin(zero)) /// graphregion(color(white)) savedata(binned) replace clear do binned graph addplot function y = x, range(0 30) lpattern(dash) lcolor(gs13) /// xlab(0(5)30) ylab(0(5)30, angle(0)) plotregion(margin(zero)) graph export "exp_actual_under_incentive.pdf", replace restore * Remove temporary files cap erase "binned.csv" cap erase "binned.do" *** (wtp_exp_attendance.pdf) ************************************************** preserve * Reshape to graph each incentive level separately reshape long wtp days_, i(id) j(incentive_level) * Store average increase in attendance per dollar of incentive reg days_ incentive_level, clus(id) loc incr = _b[incentive_level] loc avg : di %4.2f `incr' latex_write incrattinc `avg' numbers loc stderr : di %4.3f _se[incentive_level] latex_write incrattincse `stderr' numbers * Store behavior change premium per dollar of incentive loc bcpinc : di %4.2f `avgbcp'/`incr' latex_write avgbcpinc `bcpinc' numbers loc bcpincex1 : di %4.2f `avgbcpex1'/`incr' latex_write avgbcpexoneinc `bcpincex1' numbers * Produce plot binscatter wtp days_ if incentive_level != 0, by(incentive_level) /// ytitle(WTP for incentive ($), height(6)) /// xtitle(Expected attendance, height(6)) /// xlab(0(5)30) ylab(0(50)300, angle(0)) /// legend(order(1 "1" 2 "2" 3 "3" 4 "5" 5 "7" 6 "12") subtitle(Per-visit incentive ($), size(medsmall)) rows(1)) /// graphregion(color(white)) plotregion(margin(zero)) graph export "wtp_exp_attendance.pdf", replace restore *** Load and clean daily experimental data ************************************ *** Load dataset *** use "$main/Data/cleaned_commitment_study_daily_data", clear *** Variable Creation & Cleaning Steps *** *** Generate info treatment indicators gen first_info = type_of_info=="1-onlygraph" gen new_info = type_of_info=="2-graphplus" gen control_info = (new_info == 0 & first_info == 0) *** Generate wave indicators gen wave1 = (wave == "fall") gen wave2 = (wave == "winter") gen wave3 = (wave == "spring") *** Define anticommitment/commitment variables for each threshold gen anticommit8 = q170 ==2 if q170<. gen commit8 = q169 ==2 if q169<. gen anticommit12 = chose_anticommit11 gen commit12 = chose_commit12 gen anticommit16 = q296==2 if q296<. gen commit16 = q295 ==2 if q295<. *** Restrict sample to those exogenously assigned incentives keep if flag_low_wtp == 0 & flag_exclude_exog == 0 *** (daily_att_likelihood.pdf) ************************************************ preserve * Generate variables and restrict data keep if commit12 == 1 gen got_incentive = 1 if treatment == "threshold80_12" replace got_incentive = 0 if treatment == "control" keep if !missing(got_incentive) gen incentive_day = day*got_incentive * For trendline of increase in likelihood of attendance reg attended day got_incentive incentive_day wave2 wave3, clus(id) loc slope = _b[incentive_day] loc intercept = _b[got_incentive] * Average increase in likelihood of attendance from the contract each day reg attended ibn.day ibn.day#c.got_incentive, clus(id) nocons * Produce plot coefplot, nolabel vertical keep(*#c.got_incentive) yline(0) omitted baselevels /// ciopts(recast(rcap) lp(dash) lw(thin)) xlab(0(2)28) xtitle("Day", height(6)) /// ylab(-.2(.1).5, angle(0)) ytitle("Change in likelihood of going to the gym", height(4)) /// graphregion(color(white)) bgcolor(white) plotregion(margin(zero)) graph addplot function y = `slope'*x + `intercept', range(1 28) /// lw(medthick) lp(longdash) lcolor(ebblue*.7) /// xlab(0(2)28) ylab(-.2(.1).5, angle(0)) plotregion(margin(zero)) graph export "daily_att_likelihood.pdf", replace restore