anonymous-submission-acl2025's picture
add 37
14e8be8
**********
* Immigration and Redistribution
* Alesina, Miano, Stantcheva
* RESTUD
* Tables 4, 5 and 6
* You should install winsor2 and appendfile before running this dofile. Type "ssc install winsor2" and "ssc install appendfile".
**********
clear all
* Specify directory of the replication package
global dir "/Users/armandomiano/Dropbox/AMS_Redistribution/Data/Survey_Data/Replication RESTUD sharing"
cd "$dir"
* Declare output sub-directory
global outdir "Out/Tables"
* Load survey data
use "Data/survey_analysis.dta", clear
* Countries included in the analysis
global countries "US UK DE FR IT SE"
* Generate flags - To ensure answers quality
global videos t1 t2 t3
gen flag_1=0
gen flag_2=0
bysort country treatment_recod: egen min_duration = pctile(duration), p(2)
bysort country treatment_recod: egen max_duration = pctile(duration), p(98)
replace flag_1=1 if duration<min_duration
replace flag_2=1 if duration>max_duration
* Time spent on each video
* Gen time (in seconds) spent on each video treatment - based on page submit
foreach q in $videos{
bysort country: egen max_time_`q'= pctile(time_`q'), p(98)
}
foreach q in $videos{
gen flag_time_max_`q'=(time_`q'> max_time_`q')
replace flag_time_max_`q'=. if time_`q'==.
}
* Drop respondents that have spent too little or too much time (bottom/top 2%)
keep if flag_1==0 & flag_2==0
* Drop respondents who have spent too much time on the videos (top 2%)
foreach q in $videos{
drop if flag_time_max_`q'==1
}
* Drop the variables used to exclude inattentive respondents
drop flag_1 flag_2 min_duration max_duration max_time_t1 max_time_t2 max_time_t3 flag_time_max_t1 flag_time_max_t2 flag_time_max_t3
* Add data on actual immigrants statistics and generate misperceptions *
do "Do/misperceptions.do"
* Share of all immigrants for the US (legal and undocumented)
replace share_foreign=13.5 if country=="US"
* Redefing misperception share of all immigrants for the US, to keep into account above correction
replace mis_share_foreign=perc_share_foreign-share_foreign if country=="US"
****** Gen dummy for (almost) accurate perception of immigration
gen accurate_share_foreign=0
replace accurate_share_foreign=1 if mis_share_foreign>-1 & mis_share_foreign<1
replace accurate_share_foreign=. if mis_share_foreign==.
label var accurate_share_foreign "Accurate perception of the share of immigrants"
label val accurate_share_foreign binary
* Gen additional outcome variables
* Immigration is not a problem
gen imm_not_problem=(q_imm_problem==16 | q_imm_problem==17)
replace imm_not_problem=. if q_imm_problem==.
la var imm_not_problem "Immigration is not a problem"
label val imm_not_problem binary
* When should immigrants be entitled to get benefits?
gen imm_benefits_soon=(q_imm_benefits==1 | q_imm_benefits==2 | q_imm_benefits==4)
replace imm_benefits_soon=. if q_imm_benefits==.
la var imm_benefits_soon "Immigrants should get benefits in less than 3 years"
label val imm_benefits_soon binary
* When should immigrants be allowed to apply for citizenship?
gen imm_citizenship_soon=(q_imm_citizenship==1 | q_imm_citizenship==2)
replace imm_citizenship_soon=. if q_imm_citizenship==.
la var imm_citizenship_soon "Immigrants should get citizenship in 2 or 5 years"
label val imm_citizenship_soon binary
* When would you consider an immigrant "Truly American"?
gen trully_american_cit=(q_imm_american==7 | q_imm_american==1 | q_imm_american==4)
replace trully_american_cit=. if q_imm_american==.
la var trully_american_cit "Consider American at citizenship or sooner"
label val trully_american_cit binary
*Budget allocation
winsor2 budget_safetynet budget_health budget_education, s(_w) c(5 95) by(country)
la var budget_safetynet_w "% of the budget assigned to Income Support Program (winsorized)"
la var budget_health_w "% of the budget assigned to Public Spending on Health (winsorized)"
la var budget_education_w "% of the budget assigned to Spending on Schooling (winsorized)"
gen budget_social_w = budget_health_w + budget_safetynet_w
la var budget_social_w "% of the budget assigned to Income Support Program and Health (winsorized)"
* Inequality is a serious problem
gen ineq_problem_ser=(q_inequality_problem==4 | q_inequality_problem==5)
replace ineq_problem_ser=. if q_inequality_problem==.
la var ineq_problem_ser "Inequality is a serious problem"
label val ineq_problem_ser binary
* Total donation above 50th percentile within country
gen total_donation_d=0
foreach x in $countries {
su total_donation if country=="`x'", d
replace total_donation_d=1 if total_donation>r(p50) & country=="`x'"
}
replace total_donation_d=. if total_donation==.
la var total_donation_d "Donated more than the median of the country of reference"
label val total_donation_d binary
****************
* Gen controls *
****************
* Gen Left-right variables, based on vote or voting intentions *
gen left=(party_voted==4 | party_voted==5)
replace left=. if party_voted==. | party_voted==6 | party_voted==0
gen right=(party_voted==1 | party_voted==2)
replace right=. if party_voted==. | party_voted==6 | party_voted==0
gen center=(party_voted==3)
replace center=. if party_voted==. | party_voted==6 | party_voted==0
label var left "Left-wing"
label var right "Right-wing"
label var center "Center"
foreach i in left right center{
label val `i' binary
}
*Young
gen young=(age<45)
label var young "Is less than 45"
label val young binary
* Gender
gen male=(sex==1)
label var male "Male"
label val male binary
* Children dummy
gen children=(number_children>1)
replace children=. if number_children==.
label var children "Has children"
label val children binary
* Immigrant parent
gen immigrant_parent=(q_parent_same==2)
replace immigrant_parent=. if q_parent_same==.
label var immigrant_parent "At least one of the parents is an immigrant"
label val immigrant_parent binary
* Top income
gen top_income=0
foreach x in $countries{
su household_income if country=="`x'", d
replace top_income=1 if household_income>r(p75) & country=="`x'"
}
label var top_income "High Income"
label val top_income binary
* Immigration block first
label var immigfirst "Order/Salience T"
* Gen interacted treatments
gen treatment1_if = treatment1*immigfirst
gen treatment2_if = treatment2*immigfirst
gen treatment3_if = treatment3*immigfirst
label var treatment1_if "Share of Immigrants Treatment and saw first the Immigration Block"
label var treatment2_if "Origin of Immigrants Treatment and saw first the Immigration Block"
label var treatment3_if "Hard Work Treatment and saw first the Immigration Block"
foreach i in 1 2 3{
label val treatment`i'_if binary
}
********************************************
* Declare variables to be used as controls *
********************************************
global controls right left male young immigrant_parent children university_degree top_income sector_dummy
*******************************************************
* Declare variables to be included in the regressions *
*******************************************************
global treatments_int treatment1 treatment2 treatment3 treatment1_if treatment2_if treatment3_if
global treatments treatment1 treatment2 treatment3
global X $treatments $controls i.country
global X_int immigfirst $treatments_int $controls i.country
****************
*** TABLE 4: Second Stage - Support for Redistribution & Order treatment ***
****************
global table_name "$outdir/table_2stage_redistribution"
****************
* Table start
file open holder using $table_name.tex, write replace text
file write holder "\begin{tabular}{lcccccc} " _n
file write holder "& Tax & Tax & Social & Education & Inequality & Donation \\" _n
file write holder "& Top 1 & Bottom 50 & Budget & Budget & Serious Problem & Above Median \\" _n
file write holder "& (1) & (2) & (3) & (4) & (5) & (6) \\ \hline" _n
file close holder
* Table end
file open holder using temp_end.tex, write replace text
file write holder "\hline \end{tabular}" _n
file close holder
eststo clear
foreach var in tax_top1 tax_bottom50 budget_social_w budget_education_w ineq_problem_ser total_donation_d{
eststo: xi: reg `var' $X_int, robust
su `var' if e(sample)==1 & control==1 & immigfirst==0
local `var'mc: display %5.2f `r(mean)'
}
esttab using temp_all_2.tex, replace fragment booktabs keep(immigfirst $treatments) order(immigfirst $treatments) noconst label ///
star(* .1 ** .05 *** .01) se nonumbers nomtitles nolines nocon compress
* Table middle
file open holder using temp_mid3.tex, write replace text
file write holder "Control mean & `tax_top1mc' & `tax_bottom50mc' & `budget_social_wmc' & `budget_education_wmc' & `ineq_problem_sermc' & `total_donation_dmc' \\" _n
file close holder
appendfile temp_all_2.tex $table_name.tex
appendfile temp_mid3.tex $table_name.tex
appendfile temp_end.tex $table_name.tex
erase temp_all_2.tex
erase temp_mid3.tex
erase temp_end.tex
*****************
*** TABLE 5: First Stage ***
*****************
global table_name "$outdir/table_1stage"
* Table start
file open holder using $table_name.tex, write replace text
file write holder "\begin{tabular}{lccccccc} " _n
file write holder "& All & Accurate Perception & M. East and & N. America, W. and & Muslim & Christian & Lack of Effort \\" _n
file write holder "& Immigrants & All Immigrants & N. Africa & E. Europe & & & Reason Poor \\" _n
file write holder "& (misp.) & & (misp.) & (misp.) & (misp.) & (misp.) & \\" _n
file write holder "& (1) & (2) & (3) & (4) & (5) & (6) & (7) \\ \hline" _n
file close holder
* Table end
file open holder using temp_end.tex, write replace text
file write holder "\hline \end{tabular}" _n
file close holder
eststo clear
foreach var in mis_share_foreign accurate_share_foreign mis_share_ME_NAF mis_share_NA_WE_EE mis_share_mu mis_share_ch effort_poor{
eststo: xi: reg `var' $X, robust
su `var' if e(sample)==1 & control==1
local `var'mc: display %5.2f `r(mean)'
}
esttab using temp_all.tex, replace fragment booktabs keep($treatments) noconst label ///
star(* .1 ** .05 *** .01) se nonumbers nomtitles nolines nocon compress
* Table middle
file open holder using temp_mid1.tex, write replace text
file write holder "Control mean & `mis_share_foreignmc' & `accurate_share_foreignmc' & `mis_share_ME_NAFmc' & `mis_share_NA_WE_EEmc' & `mis_share_mumc' & `mis_share_chmc' & `effort_poormc' \\" _n
file close holder
appendfile temp_all.tex $table_name.tex
appendfile temp_mid1.tex $table_name.tex
appendfile temp_end.tex $table_name.tex
erase temp_all.tex
erase temp_end.tex
erase temp_mid1.tex
********
* Table 6: Second Stage - Support for Immigration
*********
global table_name "$outdir/table_2stage_immigration"
*** Gen Immigration support index
foreach var in imm_not_problem imm_benefits_soon imm_citizenship_soon ///
trully_american_cit q_govt_imm {
xi: reg `var' $X
su `var' if e(sample)==1 & control==1
local `var'mc: display %5.3f `r(mean)'
su `var' if e(sample)==1 & control==1
local `var'sdc: display %5.3f `r(sd)'
su `var' if e(sample)==1 & treatment1==1
local `var'mt1: display %5.3f `r(mean)'
su `var' if e(sample)==1 & treatment2==1
local `var'mt2: display %5.3f `r(mean)'
su `var' if e(sample)==1 & treatment3==1
local `var'mt3: display %5.3f `r(mean)'
gen `var'_ind=(`var'-``var'mc')/``var'sdc'
replace `var'_ind=(``var'mc'-``var'mc')/``var'sdc' if `var'==. & control==1
replace `var'_ind=(``var'mt1'-``var'mc')/``var'sdc' if `var'==. & treatment1==1
replace `var'_ind=(``var'mt2'-``var'mc')/``var'sdc' if `var'==. & treatment2==1
replace `var'_ind=(``var'mt3'-``var'mc')/``var'sdc' if `var'==. & treatment3==1
}
gen index_imm_support=(imm_benefits_soon_ind + imm_citizenship_soon_ind ///
+trully_american_cit_ind + q_govt_imm_ind +imm_not_problem_ind)/5
drop imm_not_problem_ind imm_benefits_soon_ind imm_citizenship_soon_ind ///
trully_american_cit_ind q_govt_imm_ind
* Standardize resulting index
xi: reg index_imm_support $X
su index_imm_support if e(sample)==1 & control==1
local index_imm_supportmc: display %5.3f `r(mean)'
local index_imm_supportsdc: display %5.3f `r(sd)'
replace index_imm_support = (index_imm_support - `index_imm_supportmc')/`index_imm_supportsdc'
* Table start
file open holder using $table_name.tex, write replace text
file write holder "\begin{tabular}{lcccccc} " _n
file write holder "& Imm. Not & Imm. Benefits & Imm. Citizenship & American & Govt. Should care & Imm Support \\" _n
file write holder "& A Problem & Soon & Soon & Upon Citizenship/Before & About Everyone & Index \\" _n
file write holder "& (1) & (2) & (3) & (4) & (5) & (6) \\ \hline" _n
file close holder
* Table end
file open holder using temp_end.tex, write replace text
file write holder "\hline \end{tabular}" _n
file close holder
eststo clear
foreach var in imm_not_problem imm_benefits_soon imm_citizenship_soon ///
trully_american_cit q_govt_imm index_imm_support{
eststo: xi: reg `var' $X, robust
su `var' if e(sample)==1 & control==1
local `var'mc: display %5.2f `r(mean)'
}
esttab using temp_all.tex, replace fragment booktabs keep($treatments) noconst label ///
star(* .1 ** .05 *** .01) se nonumbers nomtitles nolines nocon compress
* Table middle
file open holder using temp_mid1.tex, write replace text
file write holder "Control mean & `imm_not_problemmc' & `imm_benefits_soonmc' & `imm_citizenship_soonmc' & `trully_american_citmc' & `q_govt_immmc' & `index_imm_supportmc' \\" _n
file close holder
appendfile temp_all.tex $table_name.tex
appendfile temp_mid1.tex $table_name.tex
appendfile temp_end.tex $table_name.tex
erase temp_all.tex
erase temp_mid1.tex
erase temp_end.tex