/************************************************** For any information or questions, feel free to email me at zeeshan.samad@vanderbilt.edu Table of Contents 0. Preliminary code 1. Import Data + Clean (delete/rename/label etc) 2. Summary Statistics Table (with t-tests for that table) 3. T-tests for Treatment Effects 4. Regressions (Framing Effects) 5. MTurk Data (for appendix) ****************************************************/ /*************** 0. Preliminary ****************/ clear all set more off numlabel, add global data C:\Users\Zeeshan\Box Sync\Get Precise\Experiment Results global tables C:\Users\Zeeshan\Box Sync\Get Precise\Paper\Tables global figures C:\Users\Zeeshan\Box Sync\Get Precise\Paper\Figures // this code uses the following user-commands * ssc install estout * ssc install lars /**************** 1. Import + Clean *****************/ cd "$data" import excel "Final data.xlsx", sheet("Combined") firstrow clear gen id = _n gen genetic=1 if Treatment=="genetic" replace genetic=0 if Treatment=="investment" gen female=1 if gender=="Female" replace female=0 if gender=="Male" gen white=0 replace white=1 if race=="white" gen black=0 replace black=1 if race=="african american" gen hispanic=0 if ethnicity=="Non-Hispanic" replace hispanic=1 if ethnicity=="Hispanic" gen relig=0 if religious=="Not at all" replace relig=1 if religious=="Not very religious" replace relig=2 if religious=="Somewhat religious" replace relig=3 if religious=="Very religious" tab relig religious, missing drop religious rename relig religious gen order=213 if Order=="BAC" replace order=123 if Order=="ABC" replace order=213 if Order=="BAC" replace order=321 if Order=="CBA" replace order=14 if Order=="AD" replace order=41 if Order=="DA" tab order Order, missing drop Order replace control_failed=0 if control_failed==. drop if Treat_C_P1<0 // drops one obs of a subject from MTurk drop Sno ID Treatment date group gender education major payment drop control_1 control_2 control_3 race ethnicity // Label values label define amt_label 0 "Lab" 1 "AMT" label values AMT amt_label label define framing 0 "Investment" 1 "Genetic", replace label values genetic framing // Label variables label variable id "Player ID in experiment" label variable genetic "Genetic Frame" label variable female "% Female" label variable white "% White" label variable black "% Black" label variable hispanic "% Hispanic" label variable religious "Religiousness (0-3 scale)" label variable order "treament order" label variable victim "Victim of ID theft" label variable Treat_A_P1 "1's choice in Treat A" label variable Treat_A_P2 "2's choice in Treat A" label variable Treat_B_P1 "1's choice in Treat B" label variable Treat_C_P1 "1's choice in Treat C" label variable Treat_D_P2 "2's choice in Treat D" label variable A_P2binary "1=spent any amount, 0=spent nothing" label variable D_P2binary "1=spent any amount, 0= spent nothing" label variable control_failed "failed control questions" label variable player "player number" label variable session "session number" label variable AMT "0=lab experiment, 1=AMT" label variable D_P2binary "Altruism" label variable A_P2binary "Reciprocity" label variable you_invest "Real Life Investment/Genetic Test" label variable age "Age" // Save before dropping MTurk data save "$data\GetPrecise Dataset.dta", replace /************************ 2. Summary statistics ************************/ global data C:\Users\Zeeshan\Box Sync\Get Precise\Experiment Results global tables C:\Users\Zeeshan\Box Sync\Get Precise\Paper\Tables global figures C:\Users\Zeeshan\Box Sync\Get Precise\Paper\Figures use "$data\GetPrecise Dataset.dta", clear //Drop Mturk data drop if AMT==1 drop AMT // subject characteristics by frame (to highlight random assignment) global variables age victim you_invest female white hispanic religious mean $variables if genetic==0 estimates store sum1, title("Investment Frame") mean $variables if genetic==1 estimates store sum2, title("Genetic Frame") estpost ttest $variables, by(genetic) estimates store sum3, title("Difference") esttab sum1 sum2 sum3 using "$tables\sumstat.csv", replace label se mtitles nonumbers noobs star(* 0.10 ** 0.05 *** 0.01) /****************************** 3. T-tests for treatment effects *******************************/ // use these numbers to make Tables S6 and S7 manually // make matrix of p-values of t-tests forvalues x=0/1 { ttest Treat_A_P1 = Treat_B_P1 if genetic==`x' scalar AB = r(p) ttest Treat_B_P1 = Treat_C_P1 if genetic==`x' scalar BC = r(p) ttest Treat_A_P1 = Treat_C_P1 if genetic==`x' scalar AC = r(p) ttest Treat_C_P1 = 0 if genetic==`x' scalar C0 = r(p) ttest A_P2binary = D_P2binary if genetic==`x' scalar AD = r(p) ttest D_P2binary = 0 if genetic==`x' scalar D0 = r(p) matrix frame`x' = C0 \ BC \ AB \ AC \ D0 \ AD } putexcel set "$tables\Treatment effects.xlsx", modify putexcel B2 = "Comparison Between", bold putexcel B3 = "P1: Base vs. 0" putexcel B4 = "P1: Altruism vs. Base" putexcel B5 = "P1: Trust vs. Altruism" putexcel B6 = "P1: Trust vs. Base" putexcel B7 = "P2: Altruism vs. 0" putexcel B8 = "P2: Reciprocity vs. Altruism" putexcel C2 = "Genetic Frame", bold putexcel C3 = matrix(frame1) putexcel D2 = "Investment Frame", bold putexcel D3 = matrix(frame0) /******************************* 4. Regression Tables (for framing effects) ********************************/ global data C:\Users\Zeeshan\Box Sync\Get Precise\Experiment Results global tables C:\Users\Zeeshan\Box Sync\Get Precise\Paper\Tables global figures C:\Users\Zeeshan\Box Sync\Get Precise\Paper\Figures use "$data\GetPrecise Dataset.dta", clear drop if AMT==1 drop AMT // Player 1 (patient/investor): Y= % of subjects who invest X = genetic frame //Table S1 * P1 Base Treatment regress Treat_C_P1 i.genetic estimates store reg1, title("OLS") regress Treat_C_P1 i.genetic control_failed age victim female white hispanic religious estimates store reg2, title("OLS+Controls") probit Treat_C_P1 i.genetic control_failed age victim female white hispanic religious estimates store reg3, title("Probit") margins genetic, atmeans logit Treat_C_P1 i.genetic control_failed age victim female white hispanic religious, or estimates store reg3b, title("Logit O/R") esttab reg1 reg2 reg3 reg3b using "$tables\P1 Base (S1).tex", /// replace label se mtitles star(* 0.10 ** 0.05 *** 0.01) nonumbers r2 /// title("Framing effects for Player 1 in the base treatment") eform(0 0 0 1) /* make following replacements before pasting into overleaf: "[1em]" --> "& & & & \\" "\sym{**}" --> "{*}{*}" " " --> " " "%" --> "\%" */ //Table S2 * P1 Altruism Treatment regress Treat_B_P1 genetic estimates store reg4, title("OLS") regress Treat_B_P1 genetic control_failed age victim female white hispanic religious estimates store reg5, title("OLS+Controls") probit Treat_B_P1 genetic control_failed age victim female white hispanic religious estimates store reg6, title("Probit") logit Treat_B_P1 genetic control_failed age victim female white hispanic religious, or estimates store reg6b, title("Logit O/R") esttab reg4 reg5 reg6 reg6b using "$tables\P1 Altruism (S2).tex", /// replace label se mtitles star(* 0.10 ** 0.05 *** 0.01) nonumbers r2 /// title("Framing effects for Player 1 in the altruism treatment") eform(0 0 0 1) //Table S3 * P1 Trust Treatment regress Treat_A_P1 genetic estimates store reg7, title("OLS") regress Treat_A_P1 genetic control_failed age victim female white hispanic religious estimates store reg8, title("OLS+Controls") probit Treat_A_P1 genetic control_failed age victim female white hispanic religious estimates store reg9, title("Probit") logit Treat_A_P1 genetic control_failed age victim female white hispanic religious, or estimates store reg9b, title("Logit O/R") esttab reg7 reg8 reg9 reg9b using "$tables\P1 Trust (S3).tex", /// replace label se mtitles star(* 0.10 ** 0.05 *** 0.01) nonumbers r2 /// title("Framing effects for Player 1 in the trust treatment") eform(0 0 0 1) // Player 2 (patient/money manager): Y= % of subjects who spend, X= genetic frame //Table S4 * P2 Altruism Treatment regress D_P2binary genetic estimates store reg10, title("OLS") regress D_P2binary genetic control_failed age victim female white hispanic religious estimates store reg11, title("OLS+Controls") probit D_P2binary genetic control_failed age victim female white hispanic religious estimates store reg12, title("Probit") esttab reg10 reg11 reg12 using "$tables\P2 Altruism.tex", /// replace label se mtitles star(* 0.10 ** 0.05 *** 0.01) nonumbers r2 /// title("Framing effects for Player 2 in the recipient-altruism treatment") //Table S5 * P2 Reciprocity Treatment regress A_P2binary genetic estimates store reg10, title("OLS") regress A_P2binary genetic control_failed age victim female white hispanic religious estimates store reg11, title("OLS+Controls") probit A_P2binary genetic control_failed age victim female white hispanic religious estimates store reg12, title("Probit") esttab reg10 reg11 reg12 using "$tables\P2 Reciprocity.tex", /// replace label se mtitles star(* 0.10 ** 0.05 *** 0.01) nonumbers r2 /// title("Framing effects for Player 2 in the reciprocity treatment") // Stepwise and Lasso to check which variables are important and should be included * Stepwise quietly: stepwise, pe(.1) : regress Treat_C_P1 order religious hispanic white female genetic victim you_invest * Lasso quietly: lars Treat_C_P1 order religious hispanic white female genetic victim you_invest, a(lasso) /***************** 5. MTurk Analysis ******************/ global data C:\Users\Zeeshan\Box Sync\Get Precise\Experiment Results global tables C:\Users\Zeeshan\Box Sync\Get Precise\Paper\Tables global figures C:\Users\Zeeshan\Box Sync\Get Precise\Paper\Figures use "$data\GetPrecise Dataset.dta", clear // Keep only MTurk Data keep if AMT==1 drop AMT // regression tables //Table S8 * P1 Base Treatment regress Treat_C_P1 i.genetic estimates store reg1, title("OLS") regress Treat_C_P1 i.genetic control_failed age victim female white hispanic religious estimates store reg2, title("OLS+Controls") probit Treat_C_P1 i.genetic control_failed age victim female white hispanic religious estimates store reg3, title("Probit") margins genetic, atmeans esttab reg1 reg2 reg3 using "$tables\AMT P1 Base (Table S10).tex", /// replace label se mtitles star(* 0.10 ** 0.05 *** 0.01) nonumbers r2 /// title("Dep Variable: % of Player 1's who Invest") //Table S9 * P1 Altruism Treatment regress Treat_B_P1 genetic estimates store reg4, title("OLS") regress Treat_B_P1 genetic control_failed age victim female white hispanic religious estimates store reg5, title("OLS+Controls") probit Treat_B_P1 genetic control_failed age victim female white hispanic religious estimates store reg6, title("Probit") esttab reg4 reg5 reg6 using "$tables\AMT P1 Altruism (Table S11).tex", /// replace label se mtitles star(* 0.10 ** 0.05 *** 0.01) nonumbers r2 /// title("Dep Variable: % of Player 1's who Invest") //Table S10 * P1 Trust Treatment regress Treat_A_P1 genetic estimates store reg7, title("OLS") regress Treat_A_P1 genetic control_failed age victim female white hispanic religious estimates store reg8, title("OLS+Controls") probit Treat_A_P1 genetic control_failed age victim female white hispanic religious estimates store reg9, title("Probit") esttab reg7 reg8 reg9 using "$tables\AMT P1 Trust (Table S12).tex", /// replace label se mtitles star(* 0.10 ** 0.05 *** 0.01) nonumbers r2 /// title("Dep Variable: % of Player 1's who Invest") drop _est* /***************** End of Do File *****************/