* Noam Lupu * Partisanship in Latin America * Chapter prepared for "The Latin American Voter" * Revised August 2013 * Stata version 13 drop _all set more 1 set varabbrev off ssc install vreverse ********************************************************************* * 1. AmericasBarometer Variable Coding ********************************************************************* * Open AmericasBarometer merged data use "AmericasBarometer Merged 2004-2012 v15.0.dta" * Generate variable identifying each survey-year egen svyyr = concat(pais year) destring svyyr, replace * Generate/recode demographic variables gen urban = (ur==1) gen female = (q1==2) gen age = q2 gen age2 = age^2 replace age=. if age==.a | age==.b | age==.c gen white = (etid==1) gen educ = 1 if ed==0 replace educ = 2 if ed>0 & ed<6 replace educ = 3 if ed>5 & ed<12 replace educ = 4 if ed>11 & ed<18 replace educ = 5 if ed==18 gen wealth = quintall replace wealth=. if wealth==.a | wealth==.b | wealth==.c * Generate measure of democratic experience gen birth = year - age egen pyear = concat(pais birth) destring pyear, replace sort pyear merge m:1 pyear using "Polity.dta" drop if _merge==2 drop _merge * Generate left-right placement variables gen ideol = l1 replace ideol=. if ideol==.a | ideol==.b | ideol==.c gen extreme = ideol - 5.5 replace extreme = extreme * -1 if extreme<0 replace extreme = extreme - 0.5 * Generate index of civic association vreverse cp6, gen(cp6rev) vreverse cp7, gen(cp7rev) vreverse cp8, gen(cp8rev) vreverse cp9, gen(cp9rev) factor cp6rev cp7rev cp8rev cp9rev, pcf rotate predict civic * Generate measure of political information gen gi1cor = (gi1==1) gen gi3cor = (gi3==1) gen gi4cor = (gi4==1) egen soph = rowtotal(gi1cor gi3cor gi4cor) * Generate measure of political interest vreverse pol1, gen(interest) * Generate index of media attention vreverse a1, gen(a1rev) vreverse a2, gen(a2rev) vreverse a3, gen(a3rev) vreverse a4i, gen(a4irev) vreverse gi0, gen(gi0rev) gen news = gi0rev if year>=2010 replace news = news-1 if news>3 replace news = 4 if (a1rev==4 | a2rev==4 | a3rev==4 | a4irev==4) & year<2010 & news==. replace news = 3 if (a1rev==3 | a2rev==3 | a3rev==3 | a4irev==3) & year<2010 & news==. replace news = 2 if (a1rev==2 | a2rev==2 | a3rev==2 | a4irev==2) & year<2010 & news==. replace news = 1 if (a1rev==1 | a2rev==1 | a3rev==1 | a4irev==1) & year<2010 & news==. * Generate measure of partisanship gen pid = (vb10==1) bysort svyyr: egen mpid = mean(pid) replace pid = . if mpid==0 * Generate measure of campaign participation gen campaign = (pp2==1) if pp2!=. * Generate measure of ethnic fractionalization tab etid, gen(ethnic) foreach x of varlist ethnic1-ethnic9 { bysort svyyr: egen `x'share = mean(`x') replace `x'share = `x'share^2 } egen ethnicfrac = rowtotal(ethnic1share-ethnic9share) if ethnic1share!=. | ethnic2share!=. | ethnic3share!=. | ethnic4share!=. | ethnic5share!=. | ethnic6share!=. | ethnic7share!=. | ethnic8share!=. | ethnic9share!=. replace ethnicfrac = 1 - ethnicfrac drop ethnic1-ethnic9share *Generate measure of party polarization gen vb3 = vb3_06 if year==2006 & vb3_06!=0 & vb3_06!=1004 & vb3_06!=1477 & vb3_06!=1677 & vb3_06!=3077 & vb3_06!=4077 & vb3_06!=5077 & vb3_06!=6077 & vb3_06!=7077 & vb3_06!=8077 & vb3_06!=9012 & vb3_06!=10098 & vb3_06!=11077 & vb3_06!=21077 & vb3_06!=22077 & vb3_06!=23077 & vb3_06!=24077 replace vb3 = vb3_08 if year==2008 & vb3_08!=0 & vb3_08!=77 replace vb3 = vb3_10 if year==2010 & vb3_10!=0 & vb3_10!=77 & vb3_10!=1205 replace vb3 = vb3_12 if year==2012 & vb3_12!=0 & vb3_12!=77 replace vb3=. if vb3==.a | vb3==.b | vb3==.c gen polar=. gen dist=. levelsof svyyr if ideol!=. & vb3!=., local(years) foreach x of local years { levelsof vb3 if vb3!=0 & svyyr==`x', local(parties) foreach l of local parties { gen vote`x'`l' = (vb3==`l') if vb3!=0 & svyyr==`x' egen vshare`x'`l' = mean(vote`x'`l') if svyyr==`x' drop vote`x'`l' egen ideol`x'`l' = mean(ideol) if vshare`x'`l'>0.05 & vb3==`l' & svyyr==`x' egen ideol`x'`l'x = mean(ideol`x'`l') if vshare`x'`l'>0.05 & svyyr==`x' drop ideol`x'`l' gen wideol`x'`l' = ideol`x'`l'x * vshare`x'`l' } egen pbar`x' = rowtotal(wideol`x'*) if svyyr==`x' levelsof vb3 if vb3!=0 & svyyr==`x', local(parties) foreach l of local parties { gen dist`x'`l' = ((ideol`x'`l'x - pbar`x')^2) * vshare`x'`l' if svyyr==`x' } egen polar`x' = rowtotal(dist`x'*) if svyyr==`x' replace polar = polar`x' if svyyr==`x' foreach l of local parties { gen disti`x'`l' = abs(ideol`x'`l'x - ideol) if svyyr==`x' } egen dist`x' = rowmin(disti`x'`l'*) if svyyr==`x' replace dist = dist`x' if svyyr==`x' drop vshare`x'* ideol`x'* wideol`x'* pbar`x' dist`x'* polar`x' disti`x'* } quietly sum dist local distmax = r(max) * Generate individual-level measure of proximity gen proximity = dist * -1 + `distmax' * Drop non-Latin American countries keep if pais>0 & pais<22 * Generate survey weight variables gen weight1 = weight1500 gen weight2 = 1 * Import party system age sort svyyr merge m:1 svyyr using "data on party system over time.dta" drop _merge gen ln_partyage = ln(partyage) * Import ENEP sort pais merge m:1 pais using "ENEP.dta" drop _merge * Label variables label var age "Age" label var female "Female" label var educ "Education" label var urban "Urban" label var white "White" label var wealth "Wealth" label var ideol "Ideology (right)" label var extreme "Extremism" label var demyrs "Democratic experience" label var soph "Political information" label var news "Media attention" label var civic "Civic association" label var interest "Political interest" label var pid "Partisanship" label var proximity "Proximity" label var campaign "Campaig participation" label var enp "ENP" label var ln_partyage "Party age (logged)" label var ethnicfrac "Ethnic fractionalization" label var polar "Party polarization" * Drop unused variables keep age female educ urban white wealth ideol extreme demyrs soph news civic interest pid proximity campaign enp ln_partyage ethnicfrac polar ********************************************************************* * 2. AmericasBarometer Analysis ********************************************************************* * Correlates of partisanship (Appendix Table A1 and Figure 2) gllamm pid proximity extreme ideol demyrs wealth educ urban age white female, i(svyyr) family(binomial) link(probit) robust pweight(weight) dots gllapred predm1 if e(sample), mu brier pid predm1 estat ic gllamm pid soph civic news proximity extreme ideol demyrs wealth educ urban age white female, i(svyyr) family(binomial) link(probit) robust pweight(weight) dots gllapred predm2 if e(sample), mu brier pid predm2 estat ic gllamm pid polar ln_partyage ethnicfrac enp soph civic news proximity extreme ideol demyrs wealth educ urban age white female, i(svyyr) family(binomial) link(probit) robust pweight(weight) dots gllapred predm3 if e(sample), mu brier pid predm3 estat ic * Partisanship and campaign participation (Appendix Table A2) gllamm campaign pid soph civic news proximity extreme ideol demyrs wealth educ urban age white female if latam==1, i(svyyr) family(binomial) link(probit) robust pweight(weight) dots gllapred predm4 if e(sample), mu brier campaign predm4 estat ic ********************************************************************* * 2. Brazil Two-City Panel Study, 2002-6 ********************************************************************* * Open Brazil Panel data clear use "OmnibusBoth2009.dta" * Generate demographic variables gen female = (s1_sex==2) gen educ = s6_education if s6_education<18 & s6_education!=. gen white = (s11a_raceintrvwr==1) if s11a_raceintrvwr<8 & s11a_raceintrvwr!=. * Generate measure of household income gen income = s12_incomefamily if s12_incomefamily!=8 & s12_incomefamily!=9 gen hsize = s13a_familynumberadults + s13b_familynumberchildren if s13a_familynumberadults!=108 & s13a_familynumberadults!=109 & s13b_familynumberchildren!=108 & s13b_familynumberchildren!=109 gen hincome = income / sqrt(hsize) * Transform data for time-series bysort id: replace educ = educ[_n-1] if educ==. & wave==2 bysort id: replace educ = educ[_n-1] if educ==. & wave==3 bysort id: replace educ = educ[_n-1] if educ==. & wave==4 bysort id: replace educ = educ[_n-1] if educ==. & wave==5 bysort id: replace educ = educ[_n-1] if educ==. & wave==6 bysort id: replace educ = educ[_n+1] if educ==. & wave==5 bysort id: replace educ = educ[_n+1] if educ==. & wave==4 bysort id: replace educ = educ[_n+1] if educ==. & wave==3 bysort id: replace educ = educ[_n+1] if educ==. & wave==2 bysort id: replace educ = educ[_n+1] if educ==. & wave==1 bysort id: replace white = white[_n-1] if white==. & wave==2 bysort id: replace white = white[_n-1] if white==. & wave==3 bysort id: replace white = white[_n-1] if white==. & wave==4 bysort id: replace white = white[_n-1] if white==. & wave==5 bysort id: replace white = white[_n-1] if white==. & wave==6 bysort id: replace white = white[_n+1] if white==. & wave==5 bysort id: replace white = white[_n+1] if white==. & wave==4 bysort id: replace white = white[_n+1] if white==. & wave==3 bysort id: replace white = white[_n+1] if white==. & wave==2 bysort id: replace white = white[_n+1] if white==. & wave==1 bysort id: replace hincome = hincome[_n-1] if hincome==. & wave==2 bysort id: replace hincome = hincome[_n-1] if hincome==. & wave==3 bysort id: replace hincome = hincome[_n-1] if hincome==. & wave==4 bysort id: replace hincome = hincome[_n-1] if hincome==. & wave==5 bysort id: replace hincome = hincome[_n-1] if hincome==. & wave==6 bysort id: replace hincome = hincome[_n+1] if hincome==. & wave==5 bysort id: replace hincome = hincome[_n+1] if hincome==. & wave==4 bysort id: replace hincome = hincome[_n+1] if hincome==. & wave==3 bysort id: replace hincome = hincome[_n+1] if hincome==. & wave==2 bysort id: replace hincome = hincome[_n+1] if hincome==. & wave==1 * Generate city dummy variable gen juiz = (city==2) * Generate partisanship variables gen pt = 0 if v43a_pidyesorno<8 & v43a_pidyesorno!=. replace pt = 1 if v43b_pidparty==4 gen psdb = 0 if v43a_pidyesorno<8 & v43a_pidyesorno!=. replace psdb = 1 if v43b_pidparty==3 * Generate vote choice variables gen votept = (v22c_presvote==2) if v22c_presvote<18 & v22c_presvote!=. gen votepsdb = (v22c_presvote==4 | v22c_presvote==10) if v22c_presvote<18 & v22c_presvote!=. * Generate lagged variables sort id wave by id: gen lpt = pt[_n-1] by id: gen lpsdb = psdb[_n-1] by id: gen lvotept = votept[_n-1] by id: gen lvotepsdb = votepsdb[_n-1] * Label variables label var pt "PT identifier" label var psdb "PSDB identifier" label var votept "PT voter" label var votepsdb "PSDB voter" label var hincome "Household income" label var educ "Education" label var white "White" label var female "Female" * Partisanship and vote choice in Brazil (Appendix Table A3 and Figure 3) sem (pt <- lpt lvotept hincome educ white female juiz) (votept <- lpt lvotept hincome educ white female juiz), method(ml) vce(cluster id) standard sem (psdb <- lpsdb lvotepsdb hincome educ white female juiz) (votepsdb <- lpsdb lvotepsdb hincome educ white female juiz), method(ml) vce(cluster id) standard