capture clear capture log close set more off cd c:\DATA\LotteryNeighbors\Anonymized log using 3_Own&Social, replace set memory 20m *All these specifications: * -look at the effects of the amount won and neighbors' winnings, with controls * for the number of tickets bought (including zero). use FinalAnon *CHOOSE OVERALL SAMPLE: *To restrict to postcodes with at least Q addresses: *keep if NperPstk>=16 & NperPstk~=. *Adriaan's definition: replace winner=0 replace winner=1 if buyer==1 & win_code==1 replace winnings=0 if winner==0 /* "winnings" is cash only */ replace sumwinnings =0 if winner==0 /* "sumwinnings" includes the BMW value (25K) */ *For the regressions, winnings are measured in euros/10000: replace winnings=winnings/10000 sum winner winnings sumwinnings *Since it's not clear what is true for winners who report no winnings, drop these obs: sum winnings if winner==1 drop if winner==1 & winnings==0 sum winnings if winner==1 drop if winner==1 & sumwinnings==0 sum sumwinnings if winner==1 *NON-LOTTERY INCOME VARIABLE: *(note we use income last year, to avoid the problem that some hh included lottery winnings in current income) *rescale own income to be in same units as lottery winnings (euro/10000): replace inc_now=inc_now/10000 replace inc_then=inc_then/10000 *CHOOSE COVARIATES: global covariates "partner_now persons_now kids kids_sq age_fam age_famsq ed2-ed8" ******SPECIFICATION FOR ALL THE REGRESSIONS (arguments are the dependent variable and the winner density measure (NW)) capture program drop runregs program define runregs args depvar NW display " " display " " display "Sample Restriction: " "$condition1" *reg `depvar' sumwinnings inc_then `NW' $covariates buyer numtix numtixsq $condition1 , cluster (pstk) areg `depvar' sumwinnings inc_then `NW' $covariates buyer numtix numtixsq $condition1 , absorb(codegroup) cluster (pstk) test sumwinnings = inc_then display " " display " " end *********************** *RUN THE REGRESSIONS: *****TOP HALF OF THE TABLE: *******TOP HALF OF TABLE USES win_code as the INDICATOR OF NEIGHBORS' WINNINGS: local NW "win_code" ******************************* capture erase Table6A.txt capture erase Table6A.doc *****CAR VARIABLES, NON-BMW WINNERS ONLY: global condition1 " if wonbmw~=1" *means: sum newcar numcars ageofmaincar totalcarunits $condition1 foreach dv in newcar numcars ageofmaincar totalcarunits { runregs `dv' `NW' outreg2 using Table6A.doc, bdec(4) keep(sumwinnings inc_then `NW') } ****ALL OTHER VARIABLES, INCLUDING BMW WINNERS: global condition1 " " *means: ****MONTHLY EXPENDITURES, IN LEVELS****: sum foodhome foodaway transpo other total $condition1 ******OCCASIONAL EXPENDITURES****** sum ext_reno int_reno vacation_spending durable_spending $condition1 ******HAPPINESS, CURRENT LOTTERY PARTICIPATION and GIVE SURVEY FEE TO CHARITY?*** sum happy_now PCLnow charity $condition1 ************ foreach dv in foodhome foodaway transpo other total ext_reno int_reno /// vacation_spending durable_spending happy_now PCLnow charity { runregs `dv' `NW' if "`dv'" == "foodhome" |"`dv'" == "foodaway" | "`dv'" =="transpo" | "`dv'" == "other" | "`dv'" == "total" /// |"`dv'" == "vacation_spending" | "`dv'" == "durable_spending" { outreg2 using Table6A.doc, bdec(2) keep(sumwinnings inc_then `NW') } if "`dv'" == "ext_reno" | "`dv'" =="int_reno" | "`dv'" == "happy_now" /// |"`dv'" == "PCLnow" | "`dv'" == "charity" { outreg2 using Table6A.doc, bdec(4) keep(sumwinnings inc_then `NW') } } *****BOTTOM HALF OF THE TABLE: *******LIST OF NEIGHBORS' WINNINGS INDICATORS (neighwin): *shorthand for the measures of neighbors' winnings: gen B=num_winning_hh gen C=W_le_25 gen D=neighbor_won foreach NW in B C D { capture erase Table6`NW'.txt capture erase Table6`NW'.doc *****CAR VARIABLES, NON-BMW WINNERS ONLY: global condition1 " if wonbmw==0" foreach dv in newcar numcars ageofmaincar totalcarunits { runregs `dv' `NW' outreg2 using Table6`NW'.doc, bdec(4) keep(`NW') } ****ALL OTHER VARIABLES, INCLUDING BMW WINNERS: global condition1 " " foreach dv in foodhome foodaway transpo other total ext_reno int_reno /// vacation_spending durable_spending happy_now PCLnow charity { runregs `dv' `NW' ***outreg, getting decimals right: if "`dv'" == "foodhome" |"`dv'" == "foodaway" | "`dv'" =="transpo" | "`dv'" == "other" | "`dv'" == "total" /// |"`dv'" == "vacation_spending" | "`dv'" == "durable_spending" { outreg2 using Table6`NW'.doc, bdec(2) keep(`NW') } if "`dv'" == "ext_reno" | "`dv'" =="int_reno" | "`dv'" == "happy_now" /// |"`dv'" == "PCLnow" | "`dv'" == "charity" { outreg2 using Table6`NW'.doc, bdec(4) keep(`NW') } ***** } }