import delimited "C:\Users\lberg\Box\logtrev\replication_package\regression_data_main.csv", clear

// August 9, 2021 Secretary of Defense sent message of intent for military vaccine mandate
// August 23, 2021 President Press Secretary announces more stringent vax mandates coming
// August 24, 2021 SoD memorandom to fully vaccinate
// September 9, 2021 President Biden announces vaccine mandate
gen fed_man = 0
// Ten percent of people impacted by announcement of intention
// 100 percent of people impacted by announcement at time of mandate
replace fed_man = .0023 if date == 22503 | date == 22510
replace fed_man = .1 if date == 22517
replace fed_man = .1211 if date == 22524 | date == 22531
replace fed_man = 1 if date > 22531

// from gallop December 2021 poll of employees with employer mandates
gen emp_man = .36
replace emp_man = .05 if wknum <=3
replace emp_man = .06 if wknum > 3 & wknum <=8
replace emp_man = .09 if wknum > 8 & wknum <=12
replace emp_man = .19 if wknum >12 & wknum <=16
replace emp_man = .29 if wknum >16 & wknum <=21

gen combo = fed_man + emp_man if wknum<=18
replace combo = 1 if wknum > 18

order fed_man emp_man combo, before(l)

xtset fips wknum

cd "C:\Users\lberg\Box\logtrev\app\lynn"
save regression_data.dta

////// Table 2 Regression Results //////

// Column 1
xtreg lc_vax new_infp combo l ca com vmse ivm mm bpv bmm, robust fe

// Column 2
xtreg lc_vax new_infp combo l ca com vmse ivm mm bpv bmm houserep rep2020 pop_dens hh_income foreignborn indpercent1600 indpercent2000 indpercent700 indpercent600 indpercent800, robust 

// Column 3
xtreg lnew_vax new_infp combo l ca com vmse ivm mm bpv bmm, robust fe

// Column 4
xtreg lnew_vax new_infp combo l ca com vmse ivm mm bpv bmm houserep rep2020 pop_dens hh_income foreignborn indpercent1600 indpercent2000 indpercent700 indpercent600 indpercent800, robust 

// Column 5
xtlogit club_1011 combo l ca com vmse ivm mm bpv bmm houserep rep2020 pop_dens hh_income foreignborn indpercent1600 indpercent2000 indpercent700 indpercent600 indpercent800, nolog

/////// Appendix Table 13 //////

// Column 1
xtlogit club_1011 combo l ca com vmse ivm mm bpv bmm, nolog
scalar l1 = e(ll)
quietly xtlogit `e(depvar)' if e(sample)
scalar l0 = e(ll)
scalar pr2 = 1-(l1/l0)
display "pseudo R2 model 4 =" pr2

// Column 2
xtlogit club_1011 combo l ca com vmse ivm mm bpv bmm houserep rep2020, nolog
scalar l1 = e(ll)
quietly xtlogit `e(depvar)' if e(sample)
scalar l0 = e(ll)
scalar pr2 = 1-(l1/l0)
display "pseudo R2 model 4 =" pr2

// Column 3
xtlogit club_1011 combo l ca com vmse ivm mm bpv bmm houserep rep2020 pop_dens hh_income foreignborn, nolog
disp _b[pop_dens]*1000
disp _b[hh_income]*10000
disp _b[foreignborn]/10
scalar l1 = e(ll)
quietly xtlogit `e(depvar)' if e(sample)
scalar l0 = e(ll)
scalar pr2 = 1-(l1/l0)
display "pseudo R2 model 4 =" pr2

// Column 4
xtlogit club_1011 combo l ca com vmse ivm mm bpv bmm houserep rep2020 pop_dens hh_income foreignborn indpercent1600 indpercent2000 indpercent700 indpercent600 indpercent800, nolog
disp _b[pop_dens]*1000
disp _b[hh_income]*10000
disp _b[foreignborn]/10
disp _b[indpercent1600]/100
disp _b[indpercent2000]/100
disp _b[indpercent700]/100
disp _b[indpercent600]/100
disp _b[indpercent800]/100
scalar l1 = e(ll)
quietly xtlogit `e(depvar)' if e(sample)
scalar l0 = e(ll)
scalar pr2 = 1-(l1/l0)
display "pseudo R2 model 4 =" pr2

// Column 5
xtlogit club_1011 combo l ca com vmse ivm mm bpv bmm houserep rep2020 pop_dens hh_income foreignborn nohsdegree hsdegree fourpluscollege, nolog
disp _b[pop_dens]*1000
disp _b[hh_income]*10000
disp _b[foreignborn]/10
scalar l1 = e(ll)
quietly xtlogit `e(depvar)' if e(sample)
scalar l0 = e(ll)
scalar pr2 = 1-(l1/l0)
display "pseudo R2 model 4 =" pr2

// Column 6
xtlogit club_1011 combo l ca com vmse ivm mm bpv bmm houserep rep2020 pop_dens hh_income foreignborn indpercent1600 indpercent2000 indpercent700 indpercent600 indpercent800 black hispanic, nolog
disp _b[pop_dens]*1000
disp _b[hh_income]*10000
disp _b[foreignborn]/10
disp _b[indpercent1600]/100
disp _b[indpercent2000]/100
disp _b[indpercent700]/100
disp _b[indpercent600]/100
disp _b[indpercent800]/100
scalar l1 = e(ll)
quietly xtlogit `e(depvar)' if e(sample)
scalar l0 = e(ll)
scalar pr2 = 1-(l1/l0)
display "pseudo R2 model 4 =" pr2

// Appendix Table 14

xtlogit club_1011 l2.combo l2.l l2.ca l2.com l2.vmse l2.ivm l2.mm l2.bpv l2.bmm houserep rep2020 pop_dens hh_income foreignborn indpercent1600 indpercent2000 indpercent700 indpercent600 indpercent800, nolog 
scalar l1 = e(ll)
quietly xtlogit `e(depvar)' if e(sample)
scalar l0 = e(ll)
scalar pr2 = 1-(l1/l0)
display "pseudo R2 model 1 =" pr2