This is the replication material for the paper “Vote Secrecy and Diverse Voters”. With this file - and the accompanying data - any reader should be able to replicate the figures and tables presented in the paper. We used R version 3.5.3.
Five different data sets are necessary to successfully run the code presented here. We rely mostly on the file abvotes.csv, which contains deputies’ votes alongside their personal characteristics and their constituencies’ features. For Figure 2 participation.txt is needed. Some graphs and tables in the appendix are produced based on data from demog.csv (Figures A2 and A3) and brelectoral.csv (Figures A4 and A5). Finally, stronghold.csv is used to generate Table A6. This data set has the same structure of the abvotes.csv, but demographic variables are measured in deputies’ strongholds (i.e., the municipality where the deputy received the most votes). The final section of this file contains codebooks detailing the variables in each of the aforementioned data sets.
Let’s begin by setting the working directory. Remember to have the data stored in this directory.
setwd("C:/Users/danil/Box Sync/Electoral_Project/paper/replication/")
Load the packages needed for the analyses.
library(tidyverse)
library(MASS)
library(lmtest)
library(sandwich)
library(texreg)
library(stargazer)
library(GGally)
library(electoral)
To replicate Figure 1 no data frame is needed. Instead the graph is created step by step based on information from Gingerich (2018), Heckelman (1995), IBGE (1967), and the National Center for Education Statistics (https://nces.ed.gov/naal/lithistory.asp)
rm(list=ls(all=TRUE))
par(mfrow=c(1,2),oma=c(2,0,0,0),las=1,xpd="F")
## Warning in par(mfrow = c(1, 2), oma = c(2, 0, 0, 0), las = 1, xpd = "F"):
## NAs introduced by coercion
barplot(c(71,38),names.arg=c("Urban","Rural"),main="Brazil",ylim=c(0,100),cex.main=1.5,cex.names=1,axes=F)
text(.8,74,"71%",cex=1)
text(2,41,"38%",cex=1)
text(1.3,-22,"AB adopted in 1955-1970",cex=.9)
text(1.3,-28,"(varied by state and office)",cex=.9)
text(1.3,-34,"Literacy measured in 1960",cex=.9)
barplot(c(92,43),names.arg=c("White","Black"),main="United States",ylim=c(0,100),cex.main=1.5,cex.names=1,axes=F)
text(.8,95,"92%",cex=1)
text(2,46,"43%",cex=1)
text(1.3,-22,"AB adopted in 1888-1950",cex=.9)
text(1.3,-28,"(most states adopt by 1891)",cex=.9)
text(1.3,-34,"Literacy measured in 1890",cex=.9)
To replicate Figure 2 data on participation from the Brazilian Superior Electoral Court should be read into memory. Labels on vertical lines (representing specific events) were added later in Photoshop.
rm(list=ls(all=TRUE))
ds <- read.delim("participation.txt",header=TRUE) # Read into memory a tab delimited file and assign it to a data frame ds
attach(ds)
par(mar=c(6,5,4,2))
plot(c(1945,2014),c(0,60),type="n",ylab="invalid votes (%)",xlab="",axes=F)
axis(1,at=seq(1945,2014,1),labels=F)
text(seq(1945,2014,2), par("usr")[3] - 2.5, labels=seq(1945,2014,2) , srt = -45, pos = 1, xpd = TRUE, cex=.8)
axis(2,at=seq(0,60,20),las=1)
lines(cbind(year,invalid.SP),col="grey",lwd=3)
points(cbind(year,invalid.SP),col="grey",cex=1,pch=19)
lines(cbind(year,invalid.BR),col="black",lwd=3)
points(cbind(year,invalid.BR),col="black",pch=19)
lines(c(1962,1962),c(0,60),lty=2)
lines(c(1966,1966),c(0,60),lty=2)
lines(c(1970,1970),c(0,60),lty=2)
lines(c(1985,1985),c(0,60),lty=2)
lines(c(1998,1998),c(0,60),lty=2)
lines(c(2000,2000),c(0,60),lty=2)
legend(x="left",c("Brazil","São Paulo"),fill=c("black","grey"))
detach(ds)
To replicate Figure 3 it is necessary to first run the ordered logit regression on non-party line votes from the 1962 roll call on the Australian Ballot.
rm(list=ls(all=TRUE))
data <- read.csv("abvotes.csv",header=TRUE) # Read data into memory and assign it to a data frame
attach(data)
dat<-data[partyline==0&rollcall=="1962",] # Select non-party line votes from the 1962 roll call on the AB
detach(data)
attach(dat)
vote.out <- as.factor( 0*as.numeric(vote==0)+1*as.numeric(vote==9)+2*as.numeric(vote==1)) # Prepare the dependent variable as an ordered categorical variable
dat1 <- na.omit(cbind(
vote.out,literacy,land,agriculture,industrial,electorate,mayor,governor,minister,agency.head,state.secretary,state,party))
detach(dat)
# Select the variables and norm the socioeconomic ones
o.vote <- as.factor(dat1[,1])
lit <- scale(dat1[,2])
land <- scale(dat1[,3])
agriculture <- scale(dat1[,4])
landag.inter <-land*agriculture
industrial <- scale(dat1[,5])
electorate <- scale(dat1[,6])
mayor <- dat1[,7]
governor <- dat1[,8]
minister <- dat1[,9]
agency.head <- dat1[,10]
state.secretary <-dat1[,11]
state <- dat1[,12]
party <- as.factor(dat1[,13])
dat2<-data.frame(o.vote,lit,land,agriculture,landag.inter,industrial,electorate,mayor,governor,minister,agency.head,state.secretary,state,party) # Organize the data before running the model
olog.reg <- polr(o.vote~lit+land+agriculture+landag.inter+industrial+electorate+mayor+governor+minister+agency.head+state.secretary+party, Hess=T, data=dat2, method="logistic") # Run the ordered logit regression model
summary(olog.reg)
## Call:
## polr(formula = o.vote ~ lit + land + agriculture + landag.inter +
## industrial + electorate + mayor + governor + minister + agency.head +
## state.secretary + party, data = dat2, Hess = T, method = "logistic")
##
## Coefficients:
## Value Std. Error t value
## lit 1.175414 0.4239 2.772998
## land -0.620256 0.2709 -2.289751
## agriculture 0.201970 0.3042 0.663891
## landag.inter 0.199940 0.2451 0.815774
## industrial -0.627426 0.4702 -1.334368
## electorate 0.423666 0.4744 0.893042
## mayor -1.277460 0.4818 -2.651358
## governor 0.122144 1.0181 0.119976
## minister -0.440075 0.9018 -0.487971
## agency.head 0.003298 0.7557 0.004364
## state.secretary 0.804642 0.5068 1.587537
## party4 -2.225451 1.4551 -1.529377
## party8 -1.636793 1.2269 -1.334105
## party9 -0.553373 1.5328 -0.361032
## party11 -1.389657 1.2842 -1.082132
## party12 -1.820892 1.7384 -1.047473
## party14 -0.650413 1.2552 -0.518164
##
## Intercepts:
## Value Std. Error t value
## 1|2 -2.6468 1.2156 -2.1773
## 2|3 -2.3582 1.2122 -1.9454
##
## Residual Deviance: 214.7302
## AIC: 252.7302
# Std Errors clustered on the State
fm <- olog.reg
cluster <- state
M <- length(unique(cluster))
N <- length(cluster)
rank<-length(coefficients(fm))
dfc <- (M/(M-1))*((N-1)/(N-rank))
u <- apply(estfun(fm),2,
function(x) tapply(x, cluster, sum))
vcovCL <- dfc*sandwich(fm, meat=crossprod(u)/N)*1
coeftest(fm, vcovCL)
##
## t test of coefficients:
##
## Estimate Std. Error t value Pr(>|t|)
## lit 1.1754137 0.4941142 2.3788 0.0186611 *
## land -0.6202556 0.2518610 -2.4627 0.0149529 *
## agriculture 0.2019701 0.4834002 0.4178 0.6766988
## landag.inter 0.1999402 0.2947945 0.6782 0.4986956
## industrial -0.6274262 0.3833720 -1.6366 0.1038681
## electorate 0.4236660 0.3528680 1.2006 0.2318368
## mayor -1.2774597 0.3634683 -3.5146 0.0005867 ***
## governor 0.1221439 0.9499945 0.1286 0.8978722
## minister -0.4400752 0.5146321 -0.8551 0.3938826
## agency.head 0.0032979 0.6344857 0.0052 0.9958599
## state.secretary 0.8046419 0.3388845 2.3744 0.0188786 *
## party4 -2.2254512 0.9914412 -2.2447 0.0262932 *
## party8 -1.6367934 1.2450464 -1.3146 0.1906908
## party9 -0.5533733 2.4557870 -0.2253 0.8220342
## party11 -1.3896571 1.5016246 -0.9254 0.3562664
## party12 -1.8208920 1.2064444 -1.5093 0.1333821
## party14 -0.6504131 1.1235872 -0.5789 0.5635675
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
cut.SEs <- sqrt(diag(vcovCL))
cut.SEs[rank+1]
## 1|2
## 1.188876
cut.SEs[rank+2]
## 2|3
## 1.275408
Then, simulations are performed.
### Ordered logit simulation
# The average predictive probabilities as the level of literacy increases from the value of the 5th-percentile in the sample (30.5%) to the 95th percentile (81.9%)
boots<-2000
sims<-100
T.h <- quantile(lit,.95, na.rm=T)
T.l <- quantile(lit,.05, na.rm=T)
T <- seq(T.l,T.h,length.out=sims)
P1<-matrix(NA,nrow=boots,ncol=sims)
P2<-matrix(NA,nrow=boots,ncol=sims)
P3<-matrix(NA,nrow=boots,ncol=sims)
coef.sim<-mvrnorm(boots,c(olog.reg$coefficients,olog.reg$zeta),vcovCL)
B.sim <-coef.sim[,1:17]
z1.sim <-coef.sim[,18]
z2.sim <-coef.sim[,19]
for (i in 1:sims){
X.sim <- cbind(T[i],land,agriculture,landag.inter,industrial,electorate,mayor,governor,minister,agency.head,state.secretary,as.numeric(party==4),as.numeric(party==8),as.numeric(party==9),as.numeric(party==11),as.numeric(party==12),as.numeric(party==14))
LP.sim<-B.sim%*%t(X.sim)
D1<-z1.sim-LP.sim
D2<-z2.sim-LP.sim
P1[,i]<-rowMeans(plogis(D1))
P2[,i]<-rowMeans(plogis(D2)-plogis(D1))
P3[,i]<-rowMeans(1-plogis(D2))
}
Qup95<-function(x){quantile(x,.975)}
Qlo95<-function(x){quantile(x,.025)}
up95.P1<-apply(P1,2,Qup95)
lo95.P1<-apply(P1,2,Qlo95)
up95.P2<-apply(P2,2,Qup95)
lo95.P2<-apply(P2,2,Qlo95)
up95.P3<-apply(P3,2,Qup95)
lo95.P3<-apply(P3,2,Qlo95)
muP1<-colMeans(P1)
muP2<-colMeans(P2)
muP3<-colMeans(P3)
After running the simulation, the results are plotted by literacy.
# Plot the results from simulation (by literacy)
par(las=1,mfrow=c(1,3))
plot(c(T.l,T.h),c(0,1),xlab="literacy",ylab="",type="n",main="Pr(nay)",cex.main=1.5,cex.lab=1.5,xaxt="n")
axis(1,at=c(T.l,quantile(lit,.5),T.h),labels=c("30.5%","55.0%","81.9%"))
lines(T,muP1,lwd=2)
lines(T,up95.P1,lty=3)
lines(T,lo95.P1,lty=3)
plot(c(T.l,T.h),c(0,1),xlab="literacy",ylab="",type="n",main="Pr(absent)",cex.main=1.5,cex.lab=1.5,xaxt="n")
axis(1,at=c(T.l,quantile(lit,.5),T.h),labels=c("30.5%","55.0%","81.9%"))
lines(T,muP2,lwd=2)
lines(T,up95.P2,lty=3)
lines(T,lo95.P2,lty=3)
plot(c(T.l,T.h),c(0,1),xlab="literacy",ylab="",type="n",main="Pr(yea)",cex.main=1.5,cex.lab=1.5,xaxt="n")
axis(1,at=c(T.l,quantile(lit,.5),T.h),labels=c("30.5%","55.0%","81.9%"))
lines(T,muP3,lwd=2)
lines(T,up95.P3,lty=3)
lines(T,lo95.P3,lty=3)
Based on the same ordered logit model used to produce Figure 3 run simulation needed for Figure 4.
### Ordered logit simulation ###
# The average predictive probabilities corresponding to being a former mayor versus a non-former mayor
boots<-10000
P1.1<-rep(NA,boots)
P2.1<-rep(NA,boots)
P3.1<-rep(NA,boots)
coef.sim<-mvrnorm(boots,c(olog.reg$coefficients,olog.reg$zeta),vcovCL)
B.sim <-coef.sim[,1:17]
z1.sim <-coef.sim[,18]
z2.sim <-coef.sim[,19]
X.sim1 <- cbind(lit,land,agriculture,landag.inter,industrial,electorate,1,governor,minister,agency.head,state.secretary,as.numeric(party==4),as.numeric(party==8),as.numeric(party==9),as.numeric(party==11),as.numeric(party==12),as.numeric(party==14))
LP.sim1<-B.sim%*%t(X.sim1)
D1.1<-z1.sim-LP.sim1
D2.1<-z2.sim-LP.sim1
P1.1<-rowMeans(plogis(D1.1))
P2.1<-rowMeans(plogis(D2.1)-plogis(D1.1))
P3.1<-rowMeans(1-plogis(D2.1))
X.sim0 <- cbind(lit,land,agriculture,landag.inter,industrial,electorate,0,governor,minister,agency.head,state.secretary,as.numeric(party==4),as.numeric(party==8),as.numeric(party==9),as.numeric(party==11),as.numeric(party==12),as.numeric(party==14))
LP.sim0<-B.sim%*%t(X.sim0)
D1.0<-z1.sim-LP.sim0
D2.0<-z2.sim-LP.sim0
P1.0<-rowMeans(plogis(D1.0))
P2.0<-rowMeans(plogis(D2.0)-plogis(D1.0))
P3.0<-rowMeans(1-plogis(D2.0))
After running the simulation, the results are plotted by previous office (Mayor).
# Plot the results from simulations (by previous office)
par(las=1,mfrow=c(1,3))
plot(c(0,1),c(0,16),xlab="",ylab="",type="n",yaxt="n",main="Pr(nay)",cex.main=1.5)
lines(density(P1.1),lwd=2)
lines(density(P1.0),col="gray",lwd=2)
legend(0.55,15,c("mayor","non-mayor"),fill=c("black","gray"),border=F)
plot(c(0,1),c(0,20),xlab="",ylab="",type="n",yaxt="n",main="Pr(absent)",cex.main=1.5)
lines(density(P2.1),lwd=2)
lines(density(P2.0),col="gray",lwd=2)
legend(0.55,19,c("mayor","non-mayor"),fill=c("black","gray"),border=F)
plot(c(0,1),c(0,14),xlab="",ylab="",type="n",yaxt="n",main="Pr(yea)",cex.main=1.5)
lines(density(P3.1),lwd=2)
lines(density(P3.0),col="gray",lwd=2)
legend(0.55,13,c("mayor","non-mayor"),fill=c("black","gray"),border=F)
Table 1 is a three-way frequency table. It provides information on how many deputies voted “yea” (1), “nay” (0) or were absent (9) by party in each roll call.
rm(list=ls(all=TRUE))
data <- read.csv("abvotes.csv",header=TRUE) # Read data into memory and assign it to a data frame
freqt <- xtabs(~ vote+party+rollcall, data=data)
freqt
## , , rollcall = 1955
##
## party
## vote MTR PDC PL PR PRP PRT PSB PSD PSP PST PTB PTN S/PART UDN
## 0 0 0 0 3 0 1 0 79 0 0 33 1 0 0
## 1 0 2 6 3 3 0 1 6 17 0 4 2 0 42
## 9 0 0 1 13 0 0 2 26 15 1 16 2 0 26
##
## , , rollcall = 1958jun
##
## party
## vote MTR PDC PL PR PRP PRT PSB PSD PSP PST PTB PTN S/PART UDN
## 0 0 0 1 2 2 0 0 18 1 0 3 0 0 12
## 1 0 1 5 5 0 1 0 29 8 0 16 4 1 25
## 9 0 1 4 5 2 0 1 41 14 0 26 3 0 25
##
## , , rollcall = 1958nov
##
## party
## vote MTR PDC PL PR PRP PRT PSB PSD PSP PST PTB PTN S/PART UDN
## 0 0 0 0 4 0 0 0 21 4 0 8 1 0 0
## 1 0 1 7 4 0 1 1 38 13 0 29 5 0 48
## 9 0 1 4 4 1 0 2 37 8 0 14 2 0 27
##
## , , rollcall = 1962
##
## party
## vote MTR PDC PL PR PRP PRT PSB PSD PSP PST PTB PTN S/PART UDN
## 0 0 1 0 4 3 1 0 40 8 1 14 2 0 10
## 1 5 5 2 6 0 0 8 51 11 0 26 2 1 46
## 9 0 0 1 0 0 0 0 5 0 0 2 0 0 5
Table 2 presents the main ordered logit regression models. After running each model there is a routine to estimate cluster robust standard errors (clustering on state).
rm(list=ls(all=TRUE))
data <- read.csv("abvotes.csv",header=TRUE) # Read data into memory and assign it to a data frame
attach(data)
dat<-data[partyline==0&rollcall!="1955",] # Select non-party line votes and exclude the 1955 roll call on the AB
detach(data)
#### Model 1: pooled roll calls (non-party line votes), literacy & mayor
vote.out <- as.factor( 0*as.numeric(dat$vote==0)+1*as.numeric(dat$vote==9)+2*as.numeric(dat$vote==1) )
dat1 <- na.omit(cbind(vote.out,dat$literacy,dat$mayor,dat$state,dat$rollcall,dat$party))
o.vote <- as.factor(dat1[,1])
literacy <- scale(dat1[,2])
mayor <-dat1[,3]
state <-dat1[,4]
rollcall<-as.character(dat1[,5])
party <- as.character(dat1[,6])
dat2<-data.frame(o.vote,literacy,mayor,state,rollcall,party)
m1<-polr(o.vote~literacy+mayor+rollcall+party,Hess=T, data=dat2, method="logistic")
summary(m1)
## Call:
## polr(formula = o.vote ~ literacy + mayor + rollcall + party,
## data = dat2, Hess = T, method = "logistic")
##
## Coefficients:
## Value Std. Error t value
## literacy 0.54974 0.1099 5.00437
## mayor -0.48210 0.2501 -1.92788
## rollcall3 0.66451 0.2590 2.56578
## rollcall4 0.87655 0.2410 3.63769
## party12 -0.55857 0.7339 -0.76111
## party14 0.51058 0.3372 1.51425
## party2 1.00788 1.1513 0.87545
## party3 1.05729 0.6639 1.59266
## party4 0.07210 0.4550 0.15845
## party8 -0.03251 0.2624 -0.12390
## party9 -0.03695 0.4035 -0.09157
##
## Intercepts:
## Value Std. Error t value
## 1|2 -1.0000 0.2541 -3.9353
## 2|3 0.4647 0.2488 1.8676
##
## Residual Deviance: 769.1896
## AIC: 795.1896
fm<-m1
cluster<-state
M <- length(unique(cluster))
N <- length(cluster)
rank<-length(coefficients(fm))
dfc <- (M/(M-1))*((N-1)/(N-rank))
u <- apply(estfun(fm),2,
function(x) tapply(x, cluster, sum))
vcovCL <- dfc*sandwich(fm, meat=crossprod(u)/N)*1
ct <- coeftest(fm, vcovCL)
se1<-sqrt(diag(vcovCL))
pv1<- c(ct[,4],2*pt(-abs(fm$zeta[1]/se1[3]),df=m1$df.residual),2*pt(-abs(fm$zeta[2]/se1[4]),df=m1$df.residual))
model1 <-extract(m1, include.thresholds = TRUE, include.aic = TRUE,include.nobs = TRUE,
include.bic = FALSE, include.loglik = FALSE, include.deviance = FALSE)
#### Model 2: pooled roll calls (non-party line votes), full model
rm(list = ls()[!ls() %in% c("data", "dat", "model1", "se1", "pv1")])
vote.out <- as.factor( 0*as.numeric(dat$vote==0)+1*as.numeric(dat$vote==9)+2*as.numeric(dat$vote==1) )
dat1 <- na.omit(cbind(vote.out,dat$literacy,
dat$land,
dat$agriculture,
dat$industrial,
dat$electorate,
dat$mayor,
dat$governor,
dat$minister,
dat$agency.head,
dat$state.secretary,
dat$state,
dat$rollcall,
dat$party))
o.vote <- as.factor(dat1[,1])
literacy <- scale(dat1[,2])
landholding <- scale(dat1[,3])
agriculture <- scale(dat1[,4])
landag.inter <- landholding*agriculture
industry <- scale(dat1[,5])
electorate <- scale(dat1[,6])
mayor <-dat1[,7]
governor <-dat1[,8]
minister <-dat1[,9]
agency.head <-dat1[,10]
state.secretary <-dat1[,11]
state <-dat1[,12]
rollcall <-as.character(dat1[,13])
party <- as.character(dat1[,14])
dat2<-data.frame(o.vote,literacy, landholding, agriculture, landag.inter, industry, electorate, mayor, governor, minister, agency.head, state.secretary, state, rollcall, party)
m2<-polr(o.vote~literacy+landholding+agriculture+landag.inter+industry+electorate+mayor+governor+minister+agency.head+state.secretary+rollcall+party,
Hess=T, data=dat2, method="logistic")
summary(m2)
## Call:
## polr(formula = o.vote ~ literacy + landholding + agriculture +
## landag.inter + industry + electorate + mayor + governor +
## minister + agency.head + state.secretary + rollcall + party,
## data = dat2, Hess = T, method = "logistic")
##
## Coefficients:
## Value Std. Error t value
## literacy 0.471752 0.2103 2.24367
## landholding -0.321196 0.1324 -2.42656
## agriculture -0.001741 0.1578 -0.01103
## landag.inter 0.132255 0.1235 1.07069
## industry -0.242878 0.2218 -1.09511
## electorate 0.423688 0.2223 1.90614
## mayor -0.422311 0.2609 -1.61860
## governor 0.289570 0.7729 0.37466
## minister -0.013065 0.5361 -0.02437
## agency.head -0.115456 0.4916 -0.23484
## state.secretary 0.222185 0.2541 0.87432
## rollcall3 0.716556 0.2646 2.70821
## rollcall4 0.927398 0.2490 3.72429
## party12 -0.527859 0.7380 -0.71527
## party14 0.384535 0.3636 1.05770
## party2 1.124554 1.1513 0.97673
## party3 0.963517 0.6959 1.38450
## party4 -0.171737 0.4728 -0.36326
## party8 -0.223742 0.2860 -0.78224
## party9 0.020283 0.4212 0.04815
##
## Intercepts:
## Value Std. Error t value
## 1|2 -1.1172 0.2672 -4.1814
## 2|3 0.4023 0.2613 1.5396
##
## Residual Deviance: 740.3884
## AIC: 784.3884
fm<-m2
cluster<-state
M <- length(unique(cluster))
N <- length(cluster)
rank<-length(coefficients(fm))
dfc <- (M/(M-1))*((N-1)/(N-rank))
u <- apply(estfun(fm),2,
function(x) tapply(x, cluster, sum))
vcovCL <- dfc*sandwich(fm, meat=crossprod(u)/N)*1
ct <- coeftest(fm, vcovCL)
se2<-sqrt(diag(vcovCL))
pv2<- c(ct[,4],2*pt(-abs(fm$zeta[1]/se2[10]),df=m2$df.residual),2*pt(-abs(fm$zeta[2]/se2[11]),df=m2$df.residual))
model2 <-extract(m2, include.thresholds = TRUE, include.aic = TRUE,include.nobs = TRUE,
include.bic = FALSE, include.loglik = FALSE, include.deviance = FALSE)
#### Model 3: 1962 roll call (non-party line votes), literacy & mayor
rm(list = ls()[!ls() %in% c("data", "model1", "model2", "se1", "se2", "pv1", "pv2")])
attach(data)
dat<-data[partyline==0&rollcall=="1962",] # Select non-party line votes and only the 1962 roll call on the AB
detach(data)
vote.out <- as.factor( 0*as.numeric(dat$vote==0)+1*as.numeric(dat$vote==9)+2*as.numeric(dat$vote==1) )
dat1 <- na.omit(cbind(vote.out,dat$literacy,dat$mayor,dat$state,dat$party))
o.vote <- as.factor(dat1[,1])
literacy <- scale(dat1[,2])
mayor <-dat1[,3]
state <-dat1[,4]
party <- as.character(dat1[,5])
dat2<-data.frame(o.vote,literacy,mayor,state,party)
m3<-polr(o.vote~literacy+mayor+party,Hess=T, data=dat2, method="logistic")
summary(m3)
## Call:
## polr(formula = o.vote ~ literacy + mayor + party, data = dat2,
## Hess = T, method = "logistic")
##
## Coefficients:
## Value Std. Error t value
## literacy 0.78137 0.2047 3.81638
## mayor -1.09057 0.4427 -2.46356
## party12 -1.14926 1.3303 -0.86394
## party14 0.77815 0.5714 1.36180
## party2 0.82729 1.2090 0.68428
## party4 -0.11441 0.8053 -0.14208
## party8 -0.04309 0.4991 -0.08633
## party9 0.45130 1.0442 0.43220
##
## Intercepts:
## Value Std. Error t value
## 1|2 -1.0908 0.4334 -2.5171
## 2|3 -0.8301 0.4297 -1.9318
##
## Residual Deviance: 232.0042
## AIC: 252.0042
fm<-m3
cluster<-state
M <- length(unique(cluster))
N <- length(cluster)
rank<-length(coefficients(fm))
dfc <- (M/(M-1))*((N-1)/(N-rank))
u <- apply(estfun(fm),2,
function(x) tapply(x, cluster, sum))
vcovCL <- dfc*sandwich(fm, meat=crossprod(u)/N)*1
ct <- coeftest(fm, vcovCL)
se3<-sqrt(diag(vcovCL))
pv3<- c(ct[,4],2*pt(-abs(fm$zeta[1]/se3[3]),df=m3$df.residual),2*pt(-abs(fm$zeta[2]/se3[4]),df=m3$df.residual))
model3 <-extract(m3, include.thresholds = TRUE, include.aic = TRUE,include.nobs = TRUE,
include.bic = FALSE, include.loglik = FALSE, include.deviance = FALSE)
#### Model 4: 1962 roll call (non-party line votes), full model
rm(list = ls()[!ls() %in% c("data", "dat", "model1", "model2", "model3", "se1", "se2", "se3", "pv1", "pv2", "pv3")])
vote.out <- as.factor( 0*as.numeric(dat$vote==0)+1*as.numeric(dat$vote==9)+2*as.numeric(dat$vote==1) )
dat1 <- na.omit(cbind(vote.out,dat$literacy,
dat$land,
dat$agriculture,
dat$industrial,
dat$electorate,
dat$mayor,
dat$governor,
dat$minister,
dat$agency.head,
dat$state.secretary,
dat$state,
dat$party))
o.vote <- as.factor(dat1[,1])
literacy <- scale(dat1[,2])
landholding <- scale(dat1[,3])
agriculture <- scale(dat1[,4])
landag.inter <- landholding*agriculture
industry <- scale(dat1[,5])
electorate <- scale(dat1[,6])
mayor <-dat1[,7]
governor <-dat1[,8]
minister <-dat1[,9]
agency.head <-dat1[,10]
state.secretary <-dat1[,11]
state <-dat1[,12]
party <- as.character(dat1[,13])
dat2<-data.frame(o.vote,literacy, landholding, agriculture, landag.inter, industry, electorate, mayor, governor, minister, agency.head, state.secretary, state,party)
m4<-polr(o.vote~literacy+landholding+agriculture+landag.inter+industry+electorate+mayor+governor+minister+agency.head+state.secretary+party, Hess=T, data=dat2, method="logistic")
summary(m4)
## Call:
## polr(formula = o.vote ~ literacy + landholding + agriculture +
## landag.inter + industry + electorate + mayor + governor +
## minister + agency.head + state.secretary + party, data = dat2,
## Hess = T, method = "logistic")
##
## Coefficients:
## Value Std. Error t value
## literacy 1.175598 0.4239 2.773397
## landholding -0.620149 0.2709 -2.289435
## agriculture 0.202035 0.3042 0.664103
## landag.inter 0.199871 0.2451 0.815503
## industry -0.627511 0.4702 -1.334553
## electorate 0.423596 0.4744 0.892904
## mayor -1.277398 0.4818 -2.651273
## governor 0.122097 1.0181 0.119931
## minister -0.440106 0.9019 -0.488000
## agency.head 0.003523 0.7557 0.004662
## state.secretary 0.804622 0.5069 1.587492
## party12 -0.430822 1.3700 -0.314464
## party14 0.739430 0.6419 1.151863
## party2 1.387667 1.2836 1.081059
## party4 -0.835657 0.9002 -0.928306
## party8 -0.247054 0.5453 -0.453057
## party9 0.836450 1.1406 0.733328
##
## Intercepts:
## Value Std. Error t value
## 1|2 -1.2571 0.4827 -2.6045
## 2|3 -0.9685 0.4785 -2.0240
##
## Residual Deviance: 214.7302
## AIC: 252.7302
fm<-m4
cluster<-state
M <- length(unique(cluster))
N <- length(cluster)
rank<-length(coefficients(fm))
dfc <- (M/(M-1))*((N-1)/(N-rank))
u <- apply(estfun(fm),2,
function(x) tapply(x, cluster, sum))
vcovCL <- dfc*sandwich(fm, meat=crossprod(u)/N)*1
ct <- coeftest(fm, vcovCL)
se4<-sqrt(diag(vcovCL))
pv4<- c(ct[,4],2*pt(-abs(fm$zeta[1]/se4[10]),df=m4$df.residual),2*pt(-abs(fm$zeta[2]/se4[11]),df=m4$df.residual))
model4 <-extract(m4, include.thresholds = TRUE, include.aic = TRUE,include.nobs = TRUE,
include.bic = FALSE, include.loglik = FALSE, include.deviance = FALSE)
#### Generate a LaTeX table for all four models (Table 1)
texreg(list(model1,model2,model3,model4),
override.se = list(se1,se2,se3,se4),
override.pvalues = list(pv1,pv2,pv3,pv4),
stars = c(0.01, 0.05, 0.1), digits=2,
reorder.coef = c(1,14,15,16,17,18,2,19,20,21,22,12,13,3,4,5,6,7,8,9,10,11),
# omit.coef = "(rollcall)|(party)",
caption.above=TRUE,
caption="Personal and constituency-level determinants of roll call votes on the AB, 1958-1962 (non-party line votes) - Ordered logistic regression",
custom.note = "")
##
## \begin{table}
## \caption{Personal and constituency-level determinants of roll call votes on the AB, 1958-1962 (non-party line votes) - Ordered logistic regression}
## \begin{center}
## \begin{tabular}{l c c c c }
## \hline
## & Model 1 & Model 2 & Model 3 & Model 4 \\
## \hline
## literacy & $0.55^{***}$ & $0.47^{**}$ & $0.78^{***}$ & $1.18^{**}$ \\
## & $(0.17)$ & $(0.24)$ & $(0.28)$ & $(0.49)$ \\
## landholding & & $-0.32^{**}$ & & $-0.62^{**}$ \\
## & & $(0.13)$ & & $(0.25)$ \\
## agriculture & & $-0.00$ & & $0.20$ \\
## & & $(0.21)$ & & $(0.48)$ \\
## landag.inter & & $0.13$ & & $0.20$ \\
## & & $(0.16)$ & & $(0.29)$ \\
## industry & & $-0.24^{*}$ & & $-0.63$ \\
## & & $(0.15)$ & & $(0.38)$ \\
## electorate & & $0.42^{*}$ & & $0.42$ \\
## & & $(0.23)$ & & $(0.35)$ \\
## mayor & $-0.48^{**}$ & $-0.42^{**}$ & $-1.09^{***}$ & $-1.28^{***}$ \\
## & $(0.20)$ & $(0.19)$ & $(0.36)$ & $(0.36)$ \\
## governor & & $0.29$ & & $0.12$ \\
## & & $(1.10)$ & & $(0.95)$ \\
## minister & & $-0.01$ & & $-0.44$ \\
## & & $(0.42)$ & & $(0.51)$ \\
## agency.head & & $-0.12$ & & $0.00$ \\
## & & $(0.34)$ & & $(0.63)$ \\
## state.secretary & & $0.22$ & & $0.80^{**}$ \\
## & & $(0.27)$ & & $(0.34)$ \\
## 1|2 & $-1.00^{***}$ & $-1.12^{***}$ & $-1.09$ & $-1.26^{**}$ \\
## & $(0.30)$ & $(0.35)$ & $(0.56)$ & $(0.51)$ \\
## 2|3 & $0.46$ & $0.40$ & $-0.83$ & $-0.97^{***}$ \\
## & $(0.33)$ & $(0.36)$ & $(0.56)$ & $(0.51)$ \\
## rollcall3 & $0.66^{***}$ & $0.72^{***}$ & & \\
## & $(0.20)$ & $(0.20)$ & & \\
## rollcall4 & $0.88^{**}$ & $0.93^{**}$ & & \\
## & $(0.38)$ & $(0.38)$ & & \\
## party12 & $-0.56^{**}$ & $-0.53^{*}$ & $-1.15$ & $-0.43$ \\
## & $(0.24)$ & $(0.28)$ & $(0.75)$ & $(0.49)$ \\
## party14 & $0.51$ & $0.38$ & $0.78$ & $0.74$ \\
## & $(0.40)$ & $(0.50)$ & $(0.54)$ & $(0.67)$ \\
## party2 & $1.01$ & $1.12$ & $0.83$ & $1.39$ \\
## & $(1.48)$ & $(1.50)$ & $(1.57)$ & $(1.50)$ \\
## party3 & $1.06^{*}$ & $0.96$ & & \\
## & $(0.59)$ & $(0.64)$ & & \\
## party4 & $0.07$ & $-0.17$ & $-0.11$ & $-0.84$ \\
## & $(0.37)$ & $(0.40)$ & $(0.95)$ & $(1.09)$ \\
## party8 & $-0.03$ & $-0.22$ & $-0.04$ & $-0.25$ \\
## & $(0.38)$ & $(0.41)$ & $(0.33)$ & $(0.46)$ \\
## party9 & $-0.04$ & $0.02$ & $0.45$ & $0.84$ \\
## & $(0.40)$ & $(0.39)$ & $(1.39)$ & $(1.72)$ \\
## \hline
## AIC & 795.19 & 784.39 & 252.00 & 252.73 \\
## Num. obs. & 399 & 394 & 167 & 165 \\
## \hline
##
## \end{tabular}
## \label{table:coefficients}
## \end{center}
## \end{table}
rm(list=ls(all=TRUE))
data <- read.csv("abvotes.csv",header=TRUE) # Read data into memory and assign it to a data frame
attach(data)
dat<-data[rollcall!="1955",] # Exclude the 1955 roll call on the AB
detach(data)
all2 <- dat %>% dplyr::select(literacy, agriculture, industrial, electorate, land, minister, agency.head, governor, state.secretary, mayor)
colnames(all2)[6] <- "minister"
colnames(all2)[7] <- "agency.head"
colnames(all2)[8] <- "governor"
colnames(all2)[9] <- "state.secretary"
colnames(all2)[10] <- "mayor"
colnames(all2)[5] <- "land.ineq"
cor_2 <- round(cor(all2, use="complete.obs"), 2)
ggcorr(all2, label = TRUE, label_size = 3, label_round = 2, label_alpha = TRUE, hjust = 0.8, layout.exp = 1) +
ggtitle("Correlation matrix of socio-demographic variables and \npersonal characteristics at the level of the legislators")
demog <- read.csv("demog.csv",header=TRUE)
demog2 <- demog[,3:7]
ggcorr(demog2, label = TRUE, label_size = 3, label_round = 2, label_alpha = TRUE, hjust = 0.8) +
ggtitle("Correlation matrix of socio-demographic variables,\nBrazil 1960 - municipality level")
demog3 <- subset(demog, state %in% c("AC","BA","DF","ES","RS","PE","PB","MT","PR","SP","MG","RJ","SE","PI"),
select = c(literacy,
agriculture,
industrial,
landhold.gini,
size.electorate))
ggcorr(demog3, label = TRUE, label_size = 3, label_round = 2, label_alpha = TRUE, hjust = 0.8) +
ggtitle("Correlation matrix of socio-demographic variables,\nonly states included in the analysis - municipality level")
For Figure A4 we work with returns from the 1954 and 1958 elections. Data by candidate and municipality for each electoral cycle is read and, then, a function is created to identify how many municipalities were needed to reach 50% of a deputy’s vote total. Two graphs were produced: one including deputies from the Federal District and one excluding them.
rm(list=ls(all=TRUE))
br <- read.csv("brelectoral.csv",header=TRUE) # Read data into memory and assign it to a data frame
mydata <- data.frame(mun = br$municipality, dep=br$ID,year = br$year, vote = br$votes, perc = br$prop*100)
mydata <- subset(mydata, year==1954)
candidates <- unique(mydata$dep)
findcases <- function(x){
small <- mydata[mydata$dep == x,]
small <- small[order(small$perc, decreasing = TRUE),]
if(small$perc[1] > 50){
obs <- small[1, ]
return(obs)
}else{
j <- 0
i <- 0
while(j < 50){
i <- i + 1
j <- j + small$perc[i]
}
obs <- small[1:i,]
return(obs)
}
}
cases54 <- sapply(candidates, findcases, simplify = FALSE)
cases54<-do.call(rbind, cases54)
mydata <- data.frame(mun = br$municipality, dep=br$ID,year = br$year, vote = br$votes, perc = br$prop*100)
mydata <- subset(mydata, year==1958)
candidates <- unique(mydata$dep)
findcases <- function(x){
small <- mydata[mydata$dep == x,]
small <- small[order(small$perc, decreasing = TRUE),]
if(small$perc[1] > 50){
obs <- small[1, ]
return(obs)
}else{
j <- 0
i <- 0
while(j < 50){
i <- i + 1
j <- j + small$perc[i]
}
obs <- small[1:i,]
return(obs)
}
}
cases58 <- sapply(candidates, findcases, simplify = FALSE)
cases58<-do.call(rbind, cases58)
cases<-rbind(cases54,cases58)
countmun <- cases %>%
count(year, dep)
cmmean <- countmun %>% group_by(year) %>% summarise(mean=mean(n))
# Graph including legislators from the Federal District
ggplot(countmun, aes(x=n)) +
geom_histogram(aes(y=..density..), # Histogram with density instead of count on y-axis
#binwidth=.1,
colour="black", fill="white") +
geom_density(alpha=.2, fill="#FF6666") +
facet_grid(as.character(year) ~ .) +
geom_vline(data=cmmean, aes(xintercept=mean),
linetype="dashed", size=1, colour="red")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
# Graph excluding legislators from the Federal District
norj <- subset(cases, mun!="RIO DE JANEIRO")
countmun <- norj %>%
count(year, dep)
cmmean <- countmun %>% group_by(year) %>% summarise(mean=mean(n))
ggplot(countmun, aes(x=n)) +
geom_histogram(aes(y=..density..), # Histogram with density instead of count on y-axis
#binwidth=.1,
colour="black", fill="white") +
geom_density(alpha=.2, fill="#FF6666") +
facet_grid(as.character(year) ~ .) +
geom_vline(data=cmmean, aes(xintercept=mean),
linetype="dashed", size=1, colour="red")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
enm <- br %>%
group_by(year, ID) %>%
summarise(enm=enp(prop))
enmm <- enm %>% group_by(year) %>% summarise(mean=mean(enm))
ggplot(enm, aes(x=enm)) +
geom_histogram(aes(y=..density..), # Histogram with density instead of count on y-axis
#binwidth=.1,
colour="black", fill="white") +
geom_density(alpha=.2, fill="#FF6666") +
facet_grid(as.character(year) ~ .) +
geom_vline(data=enmm, aes(xintercept=mean),
linetype="dashed", size=1, colour="red") + scale_x_continuous(name="Effective Number of Municipalities")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
rm(list=ls(all=TRUE))
data <- read.csv("abvotes.csv",header=TRUE) # Read data into memory and assign it to a data frame
dat <- subset(data, state %in% c("AC","BA","DF","ES","RS","PE","PB","MT","PR","SP","MG","RJ","SE","PI"))
# Filter out cases in which literacy and mayor, the main independent variables, are missing.
dat <- dat[complete.cases(dat$literacy),]
dat <- dat[complete.cases(dat$mayor),]
a1 <- dat %>%
dplyr::select(minister, agency.head, state.secretary, mayor, governor) # select personal characteristics of legislators
stargazer(a1)
##
## % Table created by stargazer v.5.2.2 by Marek Hlavac, Harvard University. E-mail: hlavac at fas.harvard.edu
## % Date and time: Fri, May 10, 2019 - 12:29:38 PM
## \begin{table}[!htbp] \centering
## \caption{}
## \label{}
## \begin{tabular}{@{\extracolsep{5pt}}lccccccc}
## \\[-1.8ex]\hline
## \hline \\[-1.8ex]
## Statistic & \multicolumn{1}{c}{N} & \multicolumn{1}{c}{Mean} & \multicolumn{1}{c}{St. Dev.} & \multicolumn{1}{c}{Min} & \multicolumn{1}{c}{Pctl(25)} & \multicolumn{1}{c}{Pctl(75)} & \multicolumn{1}{c}{Max} \\
## \hline \\[-1.8ex]
## minister & 640 & 0.041 & 0.198 & 0 & 0 & 0 & 1 \\
## agency.head & 640 & 0.044 & 0.205 & 0 & 0 & 0 & 1 \\
## state.secretary & 640 & 0.227 & 0.419 & 0 & 0 & 0 & 1 \\
## mayor & 640 & 0.198 & 0.399 & 0 & 0 & 0 & 1 \\
## governor & 640 & 0.019 & 0.136 & 0 & 0 & 0 & 1 \\
## \hline \\[-1.8ex]
## \end{tabular}
## \end{table}
a2 <- dat %>%
dplyr::select(literacy,industrial,agriculture,electorate,land) # select socio-demographic variables at the legislator level
stargazer(a2)
##
## % Table created by stargazer v.5.2.2 by Marek Hlavac, Harvard University. E-mail: hlavac at fas.harvard.edu
## % Date and time: Fri, May 10, 2019 - 12:29:38 PM
## \begin{table}[!htbp] \centering
## \caption{}
## \label{}
## \begin{tabular}{@{\extracolsep{5pt}}lccccccc}
## \\[-1.8ex]\hline
## \hline \\[-1.8ex]
## Statistic & \multicolumn{1}{c}{N} & \multicolumn{1}{c}{Mean} & \multicolumn{1}{c}{St. Dev.} & \multicolumn{1}{c}{Min} & \multicolumn{1}{c}{Pctl(25)} & \multicolumn{1}{c}{Pctl(75)} & \multicolumn{1}{c}{Max} \\
## \hline \\[-1.8ex]
## literacy & 640 & 57.559 & 17.050 & 25.457 & 39.236 & 71.968 & 81.907 \\
## industrial & 640 & 5.772 & 4.794 & 0.278 & 1.838 & 9.594 & 26.007 \\
## agriculture & 640 & 11.326 & 7.171 & 0.745 & 5.906 & 15.643 & 40.302 \\
## electorate & 635 & 230,680.600 & 354,779.500 & 3,367.277 & 15,614.460 & 299,688.900 & 1,099,490.000 \\
## land & 640 & 0.697 & 0.082 & 0.292 & 0.652 & 0.750 & 0.874 \\
## \hline \\[-1.8ex]
## \end{tabular}
## \end{table}
demog <- read.csv("demog.csv",header=TRUE)
demog2 <- demog[,3:7]
stargazer(demog2, summary=T)
##
## % Table created by stargazer v.5.2.2 by Marek Hlavac, Harvard University. E-mail: hlavac at fas.harvard.edu
## % Date and time: Fri, May 10, 2019 - 12:29:38 PM
## \begin{table}[!htbp] \centering
## \caption{}
## \label{}
## \begin{tabular}{@{\extracolsep{5pt}}lccccccc}
## \\[-1.8ex]\hline
## \hline \\[-1.8ex]
## Statistic & \multicolumn{1}{c}{N} & \multicolumn{1}{c}{Mean} & \multicolumn{1}{c}{St. Dev.} & \multicolumn{1}{c}{Min} & \multicolumn{1}{c}{Pctl(25)} & \multicolumn{1}{c}{Pctl(75)} & \multicolumn{1}{c}{Max} \\
## \hline \\[-1.8ex]
## literacy & 2,703 & 46.318 & 16.576 & 6.704 & 32.336 & 59.311 & 89.883 \\
## agriculture & 2,709 & 19.262 & 20.695 & 0.000 & 5.993 & 25.200 & 250.703 \\
## industrial & 2,709 & 2.339 & 4.404 & 0.000 & 0.338 & 2.308 & 63.065 \\
## landhold.gini & 2,715 & 0.661 & 0.137 & 0.000 & 0.591 & 0.750 & 0.985 \\
## size.electorate & 2,631 & 5,812.173 & 34,265.190 & 100.000 & 1,606.500 & 4,992.500 & 1,271,323.000 \\
## \hline \\[-1.8ex]
## \end{tabular}
## \end{table}
demog3 <- subset(demog, state %in% c("AC","BA","DF","ES","RS","PE","PB","MT","PR","SP","MG","RJ","SE","PI"),
select = c(literacy,
agriculture,
industrial,
landhold.gini,
size.electorate))
stargazer(demog3, summary=T)
##
## % Table created by stargazer v.5.2.2 by Marek Hlavac, Harvard University. E-mail: hlavac at fas.harvard.edu
## % Date and time: Fri, May 10, 2019 - 12:29:38 PM
## \begin{table}[!htbp] \centering
## \caption{}
## \label{}
## \begin{tabular}{@{\extracolsep{5pt}}lccccccc}
## \\[-1.8ex]\hline
## \hline \\[-1.8ex]
## Statistic & \multicolumn{1}{c}{N} & \multicolumn{1}{c}{Mean} & \multicolumn{1}{c}{St. Dev.} & \multicolumn{1}{c}{Min} & \multicolumn{1}{c}{Pctl(25)} & \multicolumn{1}{c}{Pctl(75)} & \multicolumn{1}{c}{Max} \\
## \hline \\[-1.8ex]
## literacy & 1,948 & 49.366 & 15.858 & 11.169 & 37.665 & 60.919 & 89.883 \\
## agriculture & 1,947 & 18.314 & 17.464 & 0.000 & 7.408 & 24.169 & 250.703 \\
## industrial & 1,948 & 2.642 & 4.750 & 0.000 & 0.444 & 2.667 & 63.065 \\
## landhold.gini & 1,946 & 0.670 & 0.125 & 0.000 & 0.602 & 0.751 & 0.983 \\
## size.electorate & 1,905 & 6,525.757 & 39,977.800 & 213.000 & 1,723.000 & 5,283.000 & 1,271,323.000 \\
## \hline \\[-1.8ex]
## \end{tabular}
## \end{table}
rm(list=ls(all=TRUE))
data <- read.csv("abvotes.csv",header=TRUE) # Read data into memory and assign it to a data frame
# Remove party line votes and absentees. Exclude the 1955 roll call.
data <- data[data$partyline!=1,]
data <- data[data$vote!=9,]
data <- data[data$rollcall!="1955",]
# Manage the variables and norm the demographic ones
data$literacy <- as.vector(scale(data$literacy))
data$landholding <- as.vector(scale(data$land))
data$agriculture <- as.vector(scale(data$agriculture))
data$industrial <- as.vector(scale(data$industrial))
data$electorate <- as.vector(scale(data$electorate))
# Regression models
#### Model 1 Logit: stacked, literacy & mayor
dat <- na.omit(data[,c(3,4,5,9,11,16)])
attributes(dat)$na.action <- NULL
state <- as.character(dat$state)
m1<-glm(vote~literacy+mayor+rollcall+party, family = "binomial", data=dat)
summary(m1)
##
## Call:
## glm(formula = vote ~ literacy + mayor + rollcall + party, family = "binomial",
## data = dat)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -2.2785 -1.0612 0.5611 0.8343 1.4343
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.4778 1.1887 1.243 0.2138
## literacy 0.7334 0.1606 4.567 4.94e-06 ***
## mayor -0.7234 0.3518 -2.057 0.0397 *
## rollcall1958nov 0.6784 0.4643 1.461 0.1439
## rollcall1962 0.2022 0.3678 0.550 0.5826
## partyPL 0.7143 1.6719 0.427 0.6692
## partyPR -0.6954 1.2631 -0.551 0.5819
## partyPSD -0.6197 1.1531 -0.537 0.5909
## partyPSP -0.1956 1.3223 -0.148 0.8824
## partyPTB -0.7115 1.1738 -0.606 0.5444
## partyPTN -1.9807 1.4468 -1.369 0.1710
## partyUDN -0.2164 1.1769 -0.184 0.8541
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 337.70 on 283 degrees of freedom
## Residual deviance: 303.21 on 272 degrees of freedom
## AIC: 327.21
##
## Number of Fisher Scoring iterations: 4
fm<-m1
cluster <- state
M <- length(unique(cluster))
N <- length(cluster)
rank<-length(coefficients(fm))
dfc <- (M/(M-1))*((N-1)/(N-rank))
u <- apply(estfun(fm),2,
function(x) tapply(x, cluster, sum))
vcovCL <- dfc*sandwich(fm, meat=crossprod(u)/N)*1
ct <- coeftest(fm, vcovCL)
# Extract Std Errors and p-values after clustering on state
se1<- ct[,2]
pv1<- ct[,4]
model1 <-extract(m1, include.thresholds = TRUE, include.aic = TRUE,include.nobs = TRUE,
include.bic = FALSE, include.loglik = FALSE, include.deviance = FALSE)
### Model 1 OLS
m1ols<-lm(vote~literacy+mayor+rollcall+party, data=dat)
summary(m1ols)
##
## Call:
## lm(formula = vote ~ literacy + mayor + rollcall + party, data = dat)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.9780 -0.4736 0.1572 0.3152 0.6038
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.78579 0.19152 4.103 5.40e-05 ***
## literacy 0.13247 0.02761 4.798 2.65e-06 ***
## mayor -0.13318 0.06761 -1.970 0.0499 *
## rollcall1958nov 0.12335 0.08329 1.481 0.1398
## rollcall1962 0.04269 0.06897 0.619 0.5365
## partyPL 0.09280 0.26010 0.357 0.7215
## partyPR -0.12983 0.20941 -0.620 0.5358
## partyPSD -0.10825 0.18399 -0.588 0.5568
## partyPSP -0.05576 0.20640 -0.270 0.7873
## partyPTB -0.12505 0.18753 -0.667 0.5054
## partyPTN -0.34089 0.25352 -1.345 0.1799
## partyUDN -0.03864 0.18774 -0.206 0.8371
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.4326 on 272 degrees of freedom
## Multiple R-squared: 0.1142, Adjusted R-squared: 0.0784
## F-statistic: 3.189 on 11 and 272 DF, p-value: 0.0004319
fm<-m1ols
cluster <- state
M <- length(unique(cluster))
N <- length(cluster)
rank<-length(coefficients(fm))
dfc <- (M/(M-1))*((N-1)/(N-rank))
u <- apply(estfun(fm),2,
function(x) tapply(x, cluster, sum))
vcovCL <- dfc*sandwich(fm, meat=crossprod(u)/N)*1
ct <- coeftest(fm, vcovCL)
# Extract Std Errors and p-values after clustering on state
se1ols<- ct[,2]
pv1ols<- ct[,4]
model1ols <-extract(m1ols, include.thresholds = TRUE, include.aic = TRUE,include.nobs = TRUE,
include.bic = FALSE, include.loglik = FALSE, include.deviance = FALSE)
#### Model 2 Logit
dat <- na.omit(data[,c(3,4,5,6,7,8,9,10,11,12,13,14,16,18)])
attributes(dat)$na.action <- NULL
state <- as.character(dat$state)
m2<-glm(vote~literacy+industrial+agriculture*landholding+electorate+mayor+governor+minister+agency.head+state.secretary+rollcall+party, family = "binomial", data=dat)
summary(m2)
##
## Call:
## glm(formula = vote ~ literacy + industrial + agriculture * landholding +
## electorate + mayor + governor + minister + agency.head +
## state.secretary + rollcall + party, family = "binomial",
## data = dat)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -2.5605 -1.0227 0.5444 0.8072 1.4897
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.742857 1.238954 1.407 0.1595
## literacy 0.761493 0.331450 2.297 0.0216 *
## industrial -0.039112 0.380101 -0.103 0.9180
## agriculture 0.091461 0.240582 0.380 0.7038
## landholding -0.358818 0.192539 -1.864 0.0624 .
## electorate 0.132367 0.356269 0.372 0.7102
## mayor -0.753754 0.372184 -2.025 0.0428 *
## governor 0.339695 0.910896 0.373 0.7092
## minister 0.005074 0.781209 0.006 0.9948
## agency.head -0.266323 0.737600 -0.361 0.7180
## state.secretary 0.252920 0.376790 0.671 0.5021
## rollcall1958nov 0.792456 0.490268 1.616 0.1060
## rollcall1962 0.329523 0.397346 0.829 0.4069
## partyPL 0.500459 1.734049 0.289 0.7729
## partyPR -1.315278 1.323484 -0.994 0.3203
## partyPSD -1.121611 1.204533 -0.931 0.3518
## partyPSP -0.359008 1.353279 -0.265 0.7908
## partyPTB -0.998362 1.219569 -0.819 0.4130
## partyPTN -1.955572 1.497698 -1.306 0.1916
## partyUDN -0.497604 1.215644 -0.409 0.6823
## agriculture:landholding 0.265679 0.193894 1.370 0.1706
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 329.37 on 279 degrees of freedom
## Residual deviance: 288.56 on 259 degrees of freedom
## AIC: 330.56
##
## Number of Fisher Scoring iterations: 5
fm<-m2
cluster <- state
M <- length(unique(cluster))
N <- length(cluster)
rank<-length(coefficients(fm))
dfc <- (M/(M-1))*((N-1)/(N-rank))
u <- apply(estfun(fm),2,
function(x) tapply(x, cluster, sum))
vcovCL <- dfc*sandwich(fm, meat=crossprod(u)/N)*1
ct <- coeftest(fm, vcovCL)
# Extract Std Errors and p-values after clustering on state
se2<- ct[,2]
pv2<- ct[,4]
model2 <-extract(m2, include.thresholds = TRUE, include.aic = TRUE,include.nobs = TRUE,
include.bic = FALSE, include.loglik = FALSE, include.deviance = FALSE)
### Model 2 OLS
m2ols<-lm(vote~literacy+agriculture*landholding+industrial+electorate+mayor+governor+minister+agency.head+state.secretary+rollcall+party, data=dat)
summary(m2ols)
##
## Call:
## lm(formula = vote ~ literacy + agriculture * landholding + industrial +
## electorate + mayor + governor + minister + agency.head +
## state.secretary + rollcall + party, data = dat)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.0541 -0.4463 0.1573 0.3008 0.6261
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.806838 0.193576 4.168 4.19e-05 ***
## literacy 0.146661 0.060857 2.410 0.0167 *
## agriculture 0.029480 0.044776 0.658 0.5109
## landholding -0.052346 0.032930 -1.590 0.1131
## industrial 0.008624 0.065293 0.132 0.8950
## electorate -0.004046 0.051358 -0.079 0.9373
## mayor -0.139227 0.069957 -1.990 0.0476 *
## governor 0.082071 0.172639 0.475 0.6349
## minister -0.037048 0.129863 -0.285 0.7757
## agency.head -0.035156 0.124016 -0.283 0.7770
## state.secretary 0.052255 0.068052 0.768 0.4433
## rollcall1958nov 0.130589 0.085580 1.526 0.1282
## rollcall1962 0.054253 0.073497 0.738 0.4611
## partyPL 0.065042 0.261725 0.249 0.8039
## partyPR -0.208679 0.213781 -0.976 0.3299
## partyPSD -0.169996 0.187382 -0.907 0.3651
## partyPSP -0.054840 0.207321 -0.265 0.7916
## partyPTB -0.149450 0.189096 -0.790 0.4301
## partyPTN -0.323210 0.257533 -1.255 0.2106
## partyUDN -0.060887 0.189504 -0.321 0.7482
## agriculture:landholding 0.028434 0.032262 0.881 0.3790
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.4322 on 259 degrees of freedom
## Multiple R-squared: 0.1333, Adjusted R-squared: 0.06637
## F-statistic: 1.992 on 20 and 259 DF, p-value: 0.008102
fm<-m2ols
cluster <- state
M <- length(unique(cluster))
N <- length(cluster)
rank<-length(coefficients(fm))
dfc <- (M/(M-1))*((N-1)/(N-rank))
u <- apply(estfun(fm),2,
function(x) tapply(x, cluster, sum))
vcovCL <- dfc*sandwich(fm, meat=crossprod(u)/N)*1
ct <- coeftest(fm, vcovCL)
# Extract Std Errors and p-values after clustering on state
se2ols<- ct[,2]
pv2ols<- ct[,4]
model2ols <-extract(m2ols, include.thresholds = TRUE, include.aic = TRUE,include.nobs = TRUE,
include.bic = FALSE, include.loglik = FALSE, include.deviance = FALSE)
#### Model 3 Logit: 1962, literacy & mayor
dat <- data[data$rollcall==1962,]
dat <- na.omit(dat[,c(3,4,5,9,11,16)])
attributes(dat)$na.action <- NULL
state <- as.character(dat$state)
m3<-glm(vote~literacy+mayor+party, family = "binomial", data=dat)
summary(m3)
##
## Call:
## glm(formula = vote ~ literacy + mayor + party, family = "binomial",
## data = dat)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -2.1072 -1.0777 0.5688 0.8131 1.6552
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.8823 1.1476 1.640 0.100955
## literacy 0.7616 0.2218 3.434 0.000595 ***
## mayor -1.2049 0.4627 -2.604 0.009212 **
## partyPR -0.9926 1.3390 -0.741 0.458514
## partyPSD -0.8542 1.1702 -0.730 0.465406
## partyPSP -0.3460 1.4668 -0.236 0.813520
## partyPTB -0.8432 1.2129 -0.695 0.486915
## partyPTN -1.9648 1.6939 -1.160 0.246082
## partyUDN 0.1036 1.2181 0.085 0.932212
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 194.76 on 158 degrees of freedom
## Residual deviance: 170.44 on 150 degrees of freedom
## AIC: 188.44
##
## Number of Fisher Scoring iterations: 4
fm<-m3
cluster <- state
M <- length(unique(cluster))
N <- length(cluster)
rank<-length(coefficients(fm))
dfc <- (M/(M-1))*((N-1)/(N-rank))
u <- apply(estfun(fm),2,
function(x) tapply(x, cluster, sum))
vcovCL <- dfc*sandwich(fm, meat=crossprod(u)/N)*1
ct <- coeftest(fm, vcovCL)
# Extract Std Errors and p-values after clustering on state
se3<- ct[,2]
pv3<- ct[,4]
model3 <-extract(m3, include.thresholds = TRUE, include.aic = TRUE,include.nobs = TRUE,
include.bic = FALSE, include.loglik = FALSE, include.deviance = FALSE)
### Model 3 OLS
m3ols<-lm(vote~literacy+mayor+party, data=dat)
summary(m3ols)
##
## Call:
## lm(formula = vote ~ literacy + mayor + party, data = dat)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.8888 -0.4781 0.1620 0.3129 0.6928
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.861462 0.181858 4.737 4.99e-06 ***
## literacy 0.134049 0.037775 3.549 0.000517 ***
## mayor -0.233907 0.089747 -2.606 0.010076 *
## partyPR -0.183347 0.231046 -0.794 0.428711
## partyPSD -0.150066 0.188633 -0.796 0.427554
## partyPSP -0.074122 0.236525 -0.313 0.754428
## partyPTB -0.146766 0.196902 -0.745 0.457212
## partyPTN -0.331886 0.312001 -1.064 0.289159
## partyUDN 0.006309 0.193488 0.033 0.974031
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.4379 on 150 degrees of freedom
## Multiple R-squared: 0.1416, Adjusted R-squared: 0.09583
## F-statistic: 3.093 on 8 and 150 DF, p-value: 0.002937
fm<-m3ols
cluster <- state
M <- length(unique(cluster))
N <- length(cluster)
rank<-length(coefficients(fm))
dfc <- (M/(M-1))*((N-1)/(N-rank))
u <- apply(estfun(fm),2,
function(x) tapply(x, cluster, sum))
vcovCL <- dfc*sandwich(fm, meat=crossprod(u)/N)*1
ct <- coeftest(fm, vcovCL)
# Extract Std Errors and p-values after clustering on state
se3ols<- ct[,2]
pv3ols<- ct[,4]
model3ols <-extract(m3ols, include.thresholds = TRUE, include.aic = TRUE,include.nobs = TRUE,
include.bic = FALSE, include.loglik = FALSE, include.deviance = FALSE)
#### Model 4 Logit
dat <- data[data$rollcall==1962,]
dat <- na.omit(dat[,c(3,4,5,6,7,8,9,10,11,12,13,14,16,18)])
attributes(dat)$na.action <- NULL
state <- as.character(dat$state)
m4<-glm(vote~literacy+agriculture*landholding+industrial+electorate+mayor+governor+minister+agency.head+state.secretary+party, family = "binomial", data=dat)
summary(m4)
##
## Call:
## glm(formula = vote ~ literacy + agriculture * landholding + industrial +
## electorate + mayor + governor + minister + agency.head +
## state.secretary + party, family = "binomial", data = dat)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -2.6594 -0.8688 0.4281 0.7758 1.9301
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 2.7202 1.2656 2.149 0.03161 *
## literacy 1.3224 0.4782 2.765 0.00569 **
## agriculture 0.2362 0.3128 0.755 0.45016
## landholding -0.6247 0.2898 -2.155 0.03112 *
## industrial -0.7181 0.5121 -1.402 0.16082
## electorate 0.5241 0.5744 0.912 0.36162
## mayor -1.4611 0.5188 -2.816 0.00486 **
## governor -0.1523 1.1013 -0.138 0.89004
## minister -0.4830 0.9457 -0.511 0.60957
## agency.head -0.5642 1.0057 -0.561 0.57483
## state.secretary 1.2828 0.6163 2.082 0.03738 *
## partyPR -2.4239 1.5112 -1.604 0.10872
## partyPSD -1.6934 1.2729 -1.330 0.18340
## partyPSP -0.5759 1.5710 -0.367 0.71392
## partyPTB -1.4612 1.3253 -1.103 0.27020
## partyPTN -1.8785 1.7892 -1.050 0.29378
## partyUDN -0.5479 1.3049 -0.420 0.67458
## agriculture:landholding 0.2662 0.2602 1.023 0.30622
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 189.91 on 156 degrees of freedom
## Residual deviance: 152.28 on 139 degrees of freedom
## AIC: 188.28
##
## Number of Fisher Scoring iterations: 5
fm<-m4
cluster <- state
M <- length(unique(cluster))
N <- length(cluster)
rank<-length(coefficients(fm))
dfc <- (M/(M-1))*((N-1)/(N-rank))
u <- apply(estfun(fm),2,
function(x) tapply(x, cluster, sum))
vcovCL <- dfc*sandwich(fm, meat=crossprod(u)/N)*1
ct <- coeftest(fm, vcovCL)
# Extract Std Errors and p-values after clustering on state
se4<- ct[,2]
pv4<- ct[,4]
model4 <-extract(m4, include.thresholds = TRUE, include.aic = TRUE,include.nobs = TRUE,
include.bic = FALSE, include.loglik = FALSE, include.deviance = FALSE)
### Model 4 OLS
m4ols<-lm(vote~literacy+agriculture*landholding+industrial+electorate+mayor+governor+minister+agency.head+state.secretary+party, data=dat)
summary(m4ols)
##
## Call:
## lm(formula = vote ~ literacy + agriculture * landholding + industrial +
## electorate + mayor + governor + minister + agency.head +
## state.secretary + party, data = dat)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.0129 -0.3986 0.1251 0.3112 0.8344
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.915637 0.181495 5.045 1.39e-06 ***
## literacy 0.243003 0.081934 2.966 0.00355 **
## agriculture 0.068307 0.055950 1.221 0.22421
## landholding -0.073460 0.041606 -1.766 0.07966 .
## industrial -0.099062 0.084428 -1.173 0.24267
## electorate 0.030899 0.073409 0.421 0.67447
## mayor -0.259975 0.091860 -2.830 0.00534 **
## governor 0.009286 0.195139 0.048 0.96212
## minister -0.133162 0.152374 -0.874 0.38367
## agency.head -0.078373 0.163211 -0.480 0.63184
## state.secretary 0.214842 0.100874 2.130 0.03495 *
## partyPR -0.359655 0.235396 -1.528 0.12882
## partyPSD -0.236087 0.189611 -1.245 0.21519
## partyPSP -0.087139 0.235489 -0.370 0.71192
## partyPTB -0.196873 0.198589 -0.991 0.32323
## partyPTN -0.274331 0.310249 -0.884 0.37810
## partyUDN -0.047404 0.194768 -0.243 0.80806
## agriculture:landholding 0.007748 0.037892 0.204 0.83828
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.4304 on 139 degrees of freedom
## Multiple R-squared: 0.2084, Adjusted R-squared: 0.1115
## F-statistic: 2.152 on 17 and 139 DF, p-value: 0.007968
fm<-m4ols
cluster <- state
M <- length(unique(cluster))
N <- length(cluster)
rank<-length(coefficients(fm))
dfc <- (M/(M-1))*((N-1)/(N-rank))
u <- apply(estfun(fm),2,
function(x) tapply(x, cluster, sum))
vcovCL <- dfc*sandwich(fm, meat=crossprod(u)/N)*1
ct <- coeftest(fm, vcovCL)
# Extract Std Errors and p-values after clustering on state
se4ols<- ct[,2]
pv4ols<- ct[,4]
model4ols <-extract(m4ols, include.thresholds = TRUE, include.aic = TRUE,include.nobs = TRUE,
include.bic = FALSE, include.loglik = FALSE, include.deviance = FALSE)
####
# Generate latex table
texreg(list(model1,model1ols,model2,model2ols,model3,model3ols,model4,model4ols),
override.se = list(se1,se1ols,se2,se2ols,se3,se3ols,se4,se4ols),
override.pvalues = list(pv1,pv1ols,pv2,pv2ols,pv3,pv3ols,pv4,pv4ols),
stars = c(0.01, 0.05, 0.1), digits=2,
omit.coef = "(party)|(rollcall1)",
reorder.coef = c(2,6,5,12,4,7,3,8,9,10,11,1),
caption.above=TRUE,
caption="Impact of Constituency and Personal Characteristics on Non-PartyLine Votes for the Official Ballot, 1958-1962 (Excluding absentees)",
custom.note = "x")
##
## \begin{table}
## \caption{Impact of Constituency and Personal Characteristics on Non-PartyLine Votes for the Official Ballot, 1958-1962 (Excluding absentees)}
## \begin{center}
## \begin{tabular}{l c c c c c c c c }
## \hline
## & Model 1 & Model 2 & Model 3 & Model 4 & Model 5 & Model 6 & Model 7 & Model 8 \\
## \hline
## literacy & $0.73^{***}$ & $0.13^{***}$ & $0.76^{*}$ & $0.15$ & $0.76^{***}$ & $0.13^{***}$ & $1.32^{**}$ & $0.24^{**}$ \\
## & $(0.20)$ & $(0.04)$ & $(0.42)$ & $(0.09)$ & $(0.30)$ & $(0.04)$ & $(0.56)$ & $(0.09)$ \\
## landholding & & & $-0.36^{**}$ & $-0.05^{*}$ & & & $-0.62^{**}$ & $-0.07^{*}$ \\
## & & & $(0.17)$ & $(0.03)$ & & & $(0.28)$ & $(0.04)$ \\
## agriculture & & & $0.09$ & $0.03$ & & & $0.24$ & $0.07$ \\
## & & & $(0.29)$ & $(0.06)$ & & & $(0.48)$ & $(0.09)$ \\
## agriculture:landholding & & & $0.27$ & $0.03$ & & & $0.27$ & $0.01$ \\
## & & & $(0.20)$ & $(0.04)$ & & & $(0.30)$ & $(0.05)$ \\
## industrial & & & $-0.04$ & $0.01$ & & & $-0.72^{*}$ & $-0.10$ \\
## & & & $(0.30)$ & $(0.05)$ & & & $(0.42)$ & $(0.06)$ \\
## electorate & & & $0.13$ & $-0.00$ & & & $0.52$ & $0.03$ \\
## & & & $(0.20)$ & $(0.03)$ & & & $(0.41)$ & $(0.05)$ \\
## mayor & $-0.72^{***}$ & $-0.13^{***}$ & $-0.75^{***}$ & $-0.14^{***}$ & $-1.20^{***}$ & $-0.23^{***}$ & $-1.46^{***}$ & $-0.26^{***}$ \\
## & $(0.21)$ & $(0.05)$ & $(0.25)$ & $(0.05)$ & $(0.36)$ & $(0.09)$ & $(0.33)$ & $(0.07)$ \\
## governor & & & $0.34$ & $0.08$ & & & $-0.15$ & $0.01$ \\
## & & & $(0.98)$ & $(0.19)$ & & & $(1.03)$ & $(0.19)$ \\
## minister & & & $0.01$ & $-0.04$ & & & $-0.48$ & $-0.13$ \\
## & & & $(0.65)$ & $(0.10)$ & & & $(0.62)$ & $(0.08)$ \\
## agency.head & & & $-0.27$ & $-0.04$ & & & $-0.56$ & $-0.08$ \\
## & & & $(0.55)$ & $(0.09)$ & & & $(0.65)$ & $(0.12)$ \\
## state.secretary & & & $0.25$ & $0.05$ & & & $1.28^{**}$ & $0.21^{***}$ \\
## & & & $(0.32)$ & $(0.06)$ & & & $(0.52)$ & $(0.08)$ \\
## (Intercept) & $1.48$ & $0.79^{***}$ & $1.74$ & $0.81^{***}$ & $1.88$ & $0.86^{***}$ & $2.72^{**}$ & $0.92^{***}$ \\
## & $(1.51)$ & $(0.22)$ & $(1.31)$ & $(0.20)$ & $(1.17)$ & $(0.15)$ & $(1.11)$ & $(0.16)$ \\
## \hline
## AIC & 327.21 & & 330.56 & & 188.44 & & 188.28 & \\
## Num. obs. & 284 & 284 & 280 & 280 & 159 & 159 & 157 & 157 \\
## R$^2$ & & 0.11 & & 0.13 & & 0.14 & & 0.21 \\
## Adj. R$^2$ & & 0.08 & & 0.07 & & 0.10 & & 0.11 \\
## RMSE & & 0.43 & & 0.43 & & 0.44 & & 0.43 \\
## \hline
## \multicolumn{9}{l}{\scriptsize{x}}
## \end{tabular}
## \label{table:coefficients}
## \end{center}
## \end{table}
rm(list=ls(all=TRUE))
data <- read.csv("stronghold.csv",header=TRUE) # Read data into memory and assign it to a data frame
#Non-party line votes only
data <- data[data$partyline!=1,]
#### Model 1: literacy & mayor
vote.out <- as.factor(0*as.numeric(data$vote==0)+1*as.numeric(data$vote==9)+2*as.numeric(data$vote==1) )
dat <- na.omit(cbind(vote.out, data$literacy, data$mayor, data$state, data$rollcall,data$party))
o.vote <- as.factor(dat[,1])
literacy <- scale(as.numeric(dat[,2]))
mayor <- dat[,3]
state <-dat[,4]
rollcall<-as.character(dat[,5])
party<-as.character(dat[,6])
dat1<-data.frame(o.vote,literacy,mayor,state,rollcall,party)
m1<-polr(o.vote~literacy+mayor+rollcall+party,Hess=T, data=dat1, method="logistic")
summary(m1)
## Call:
## polr(formula = o.vote ~ literacy + mayor + rollcall + party,
## data = dat1, Hess = T, method = "logistic")
##
## Coefficients:
## Value Std. Error t value
## literacy 0.38629 0.1034 3.73555
## mayor -0.42225 0.2483 -1.70086
## rollcall2 0.62727 0.2562 2.44861
## rollcall3 0.83241 0.2388 3.48593
## party12 -0.46590 0.7259 -0.64181
## party14 0.30543 0.3286 0.92955
## party2 0.83030 1.1361 0.73083
## party3 0.88389 0.6561 1.34715
## party4 -0.03991 0.4537 -0.08796
## party8 -0.21525 0.2562 -0.84013
## party9 -0.05648 0.4015 -0.14067
##
## Intercepts:
## Value Std. Error t value
## 1|2 -1.1000 0.2515 -4.3743
## 2|3 0.3341 0.2444 1.3673
##
## Residual Deviance: 781.1182
## AIC: 807.1182
fm<-m1
cluster<-state
M <- length(unique(cluster))
N <- length(cluster)
rank<-length(coefficients(fm))
dfc <- (M/(M-1))*((N-1)/(N-rank))
u <- apply(estfun(fm),2,
function(x) tapply(x, cluster, sum))
vcovCL <- dfc*sandwich(fm, meat=crossprod(u)/N)*1
ct <- coeftest(fm, vcovCL)
se1<-sqrt(diag(vcovCL))
pv1<- c(ct[,4],2*pt(-abs(fm$zeta[1]/se1[3]),df=m1$df.residual),2*pt(-abs(fm$zeta[2]/se1[4]),df=m1$df.residual))
model1 <-extract(m1, include.thresholds = TRUE, include.aic = TRUE,include.nobs = TRUE,
include.bic = FALSE, include.loglik = FALSE, include.deviance = FALSE)
#### Model 2: literacy & mayor (1962 only)
rm(list = ls()[!ls() %in% c("data", "model1","se1","pv1")])
dat <- data[data$rollcall==1962,]
vote.out <- as.factor( 0*as.numeric(dat$vote==0)+1*as.numeric(dat$vote==9)+2*as.numeric(dat$vote==1) )
dat1 <- na.omit(cbind(vote.out,dat$literacy,dat$mayor,dat$state,dat$party))
o.vote <- as.factor(dat1[,1])
literacy <- scale(as.numeric(dat1[,2]))
mayor <-dat1[,3]
state <-dat1[,4]
party<-as.character(dat1[,5])
dat2<-data.frame(o.vote,literacy,mayor,state,party)
m2<-polr(o.vote~literacy+mayor+party,Hess=T, data=dat2, method="logistic")
summary(m2)
## Call:
## polr(formula = o.vote ~ literacy + mayor + party, data = dat2,
## Hess = T, method = "logistic")
##
## Coefficients:
## Value Std. Error t value
## literacy 0.5159 0.1785 2.8903
## mayor -0.9070 0.4292 -2.1133
## party12 -0.7114 1.3051 -0.5451
## party14 0.5431 0.5514 0.9851
## party2 0.7326 1.1930 0.6140
## party4 -0.2644 0.7987 -0.3311
## party8 -0.1443 0.4906 -0.2941
## party9 0.4931 0.9857 0.5002
##
## Intercepts:
## Value Std. Error t value
## 1|2 -1.0696 0.4250 -2.5168
## 2|3 -0.8198 0.4213 -1.9457
##
## Residual Deviance: 239.8744
## AIC: 259.8744
fm<-m2
cluster<-state
M <- length(unique(cluster))
N <- length(cluster)
rank<-length(coefficients(fm))
dfc <- (M/(M-1))*((N-1)/(N-rank))
u <- apply(estfun(fm),2,
function(x) tapply(x, cluster, sum))
vcovCL <- dfc*sandwich(fm, meat=crossprod(u)/N)*1
ct <- coeftest(fm, vcovCL)
se2<-sqrt(diag(vcovCL))
pv2<- c(ct[,4],2*pt(-abs(fm$zeta[1]/se2[3]),df=m2$df.residual),2*pt(-abs(fm$zeta[2]/se2[4]),df=m2$df.residual))
model2 <-extract(m2, include.thresholds = TRUE, include.aic = TRUE,include.nobs = TRUE,
include.bic = FALSE, include.loglik = FALSE, include.deviance = FALSE)
#### Model 3: full model
rm(list = ls()[!ls() %in% c("data", "model1", "model2", "se1", "se2", "pv1", "pv2")])
vote.out <- as.factor( 0*as.numeric(data$vote==0)+1*as.numeric(data$vote==9)+2*as.numeric(data$vote==1) )
dat1 <- na.omit(cbind(vote.out,data$literacy,
data$land,
data$agriculture,
data$industrial,
data$electorate,
data$mayor,
data$governor,
data$minister,
data$agency.head,
data$state.secretary,
data$state,
data$rollcall,
data$party))
o.vote <- as.factor(dat1[,1])
literacy <- scale(as.numeric(dat1[,2]))
landholding <- scale(as.numeric(dat1[,3]))
agriculture <- scale(as.numeric(dat1[,4]))
industry <- scale(as.numeric(dat1[,5]))
electorate <- scale(as.numeric(dat1[,6]))
mayor <-dat1[,7]
governor <-dat1[,8]
minister <-dat1[,9]
agency.head <-dat1[,10]
state.secretary <-dat1[,11]
state <-dat1[,12]
rollcall <- as.character(dat1[,13])
party <- as.character(dat1[,14])
dat2<-data.frame(o.vote,literacy, landholding, agriculture, industry, electorate, mayor, governor, minister, agency.head, state.secretary, state, rollcall,party)
m3<-polr(o.vote~literacy+agriculture*landholding+industry+electorate+mayor+governor+minister+agency.head+state.secretary+rollcall+party,
Hess=T, data=dat2, method="logistic")
summary(m3)
## Call:
## polr(formula = o.vote ~ literacy + agriculture * landholding +
## industry + electorate + mayor + governor + minister + agency.head +
## state.secretary + rollcall + party, data = dat2, Hess = T,
## method = "logistic")
##
## Coefficients:
## Value Std. Error t value
## literacy 0.57219 0.1819 3.14612
## agriculture 0.15236 0.1460 1.04331
## landholding -0.32943 0.1403 -2.34835
## industry -0.38341 0.2630 -1.45786
## electorate 0.39105 0.2403 1.62751
## mayor -0.42207 0.2562 -1.64739
## governor 0.11684 0.7604 0.15365
## minister 0.05593 0.5214 0.10727
## agency.head -0.07640 0.4824 -0.15837
## state.secretary 0.13713 0.2520 0.54413
## rollcall2 0.69607 0.2612 2.66444
## rollcall3 0.89449 0.2498 3.58117
## party12 -0.44729 0.7455 -0.59999
## party14 0.28459 0.3465 0.82136
## party2 1.00183 1.1439 0.87583
## party3 1.02432 0.7040 1.45499
## party4 0.03001 0.4801 0.06251
## party8 -0.27871 0.2809 -0.99212
## party9 0.02606 0.4270 0.06102
## agriculture:landholding 0.05566 0.1650 0.33744
##
## Intercepts:
## Value Std. Error t value
## 1|2 -1.1569 0.2622 -4.4113
## 2|3 0.3480 0.2550 1.3646
##
## Residual Deviance: 747.9518
## AIC: 791.9518
fm<-m3
cluster<-state
M <- length(unique(cluster))
N <- length(cluster)
rank<-length(coefficients(fm))
dfc <- (M/(M-1))*((N-1)/(N-rank))
u <- apply(estfun(fm),2,
function(x) tapply(x, cluster, sum))
vcovCL <- dfc*sandwich(fm, meat=crossprod(u)/N)*1
ct <- coeftest(fm, vcovCL)
se3<-sqrt(diag(vcovCL))
pv3<- c(ct[,4],2*pt(-abs(fm$zeta[1]/se3[11]),df=m3$df.residual),2*pt(-abs(fm$zeta[2]/se3[12]),df=m3$df.residual))
model3 <-extract(m3, include.thresholds = TRUE, include.aic = TRUE,include.nobs = TRUE,
include.bic = FALSE, include.loglik = FALSE, include.deviance = FALSE)
#### Model 4: full model (196 only)
rm(list = ls()[!ls() %in% c("data", "model1", "model2", "model3", "se1", "se2", "se3", "pv1", "pv2", "pv3")])
dat <- data[data$rollcall==1962,]
vote.out <- as.factor( 0*as.numeric(dat$vote==0)+1*as.numeric(dat$vote==9)+2*as.numeric(dat$vote==1) )
dat1 <- na.omit(cbind(vote.out,dat$literacy,
dat$land,
dat$agriculture,
dat$industrial,
dat$electorate,
dat$mayor,
dat$governor,
dat$minister,
dat$agency.head,
dat$state.secretary,
dat$state,
dat$party))
o.vote <- as.factor(dat1[,1])
literacy <- scale(as.numeric(dat1[,2]))
landholding <- scale(as.numeric(dat1[,3]))
agriculture <- scale(as.numeric(dat1[,4]))
industry <- scale(as.numeric(dat1[,5]))
electorate <- scale(as.numeric(dat1[,6]))
mayor <-dat1[,7]
governor <-dat1[,8]
minister <-dat1[,9]
agency.head <-dat1[,10]
state.secretary <-dat1[,11]
state <-dat1[,12]
party <- as.character(dat1[,13])
dat2<-data.frame(o.vote,literacy, landholding, agriculture, industry, electorate, mayor, governor, minister, agency.head, state.secretary, state, party)
m4<-polr(o.vote~literacy+agriculture*landholding+industry+electorate+mayor+governor+minister+agency.head+state.secretary+party,
Hess=T, data=dat2, method="logistic")
summary(m4)
## Call:
## polr(formula = o.vote ~ literacy + agriculture * landholding +
## industry + electorate + mayor + governor + minister + agency.head +
## state.secretary + party, data = dat2, Hess = T, method = "logistic")
##
## Coefficients:
## Value Std. Error t value
## literacy 0.905072 0.3143 2.879710
## agriculture 0.563567 0.3140 1.794801
## landholding -0.950786 0.3193 -2.978076
## industry -0.001984 0.3527 -0.005624
## electorate -0.054646 0.3413 -0.160114
## mayor -1.303493 0.4902 -2.659016
## governor 0.221677 1.0229 0.216717
## minister -0.632201 0.9030 -0.700129
## agency.head -0.115726 0.7705 -0.150188
## state.secretary 0.584320 0.5048 1.157618
## party12 -0.611097 1.3880 -0.440283
## party14 0.906724 0.6271 1.445968
## party2 1.386922 1.2633 1.097814
## party4 -0.203847 0.9721 -0.209705
## party8 -0.105449 0.5448 -0.193560
## party9 1.182956 1.1224 1.053946
## agriculture:landholding -0.507452 0.3643 -1.393049
##
## Intercepts:
## Value Std. Error t value
## 1|2 -1.1567 0.4762 -2.4288
## 2|3 -0.8654 0.4719 -1.8341
##
## Residual Deviance: 215.7523
## AIC: 253.7523
fm<-m4
cluster<-state
M <- length(unique(cluster))
N <- length(cluster)
rank<-length(coefficients(fm))
dfc <- (M/(M-1))*((N-1)/(N-rank))
u <- apply(estfun(fm),2,
function(x) tapply(x, cluster, sum))
vcovCL <- dfc*sandwich(fm, meat=crossprod(u)/N)*1
ct <- coeftest(fm, vcovCL)
se4<-sqrt(diag(vcovCL))
pv4<- c(ct[,4],2*pt(-abs(fm$zeta[1]/se4[10]),df=m4$df.residual),2*pt(-abs(fm$zeta[2]/se4[11]),df=m4$df.residual))
model4 <-extract(m4, include.thresholds = TRUE, include.aic = TRUE,include.nobs = TRUE,
include.bic = FALSE, include.loglik = FALSE, include.deviance = FALSE)
####
texreg(list(model1,model3,model2,model4),
override.se = list(se1,se3,se2,se4),
override.pvalues = list(pv1,pv3,pv2,pv4),
stars = c(0.01, 0.05, 0.1), digits=2,
omit.coef = "(party)|(rollcall)",
reorder.coef = c(1,5,6,13,7,8,2,9,10,11,12,3,4),
caption.above=TRUE,
caption="Impact of Constituency and Personal Characteristics on Votes for the Official Ballot, 1958 and 1962 roll calls (Ordered logistic regression)",
custom.note = "")
##
## \begin{table}
## \caption{Impact of Constituency and Personal Characteristics on Votes for the Official Ballot, 1958 and 1962 roll calls (Ordered logistic regression)}
## \begin{center}
## \begin{tabular}{l c c c c }
## \hline
## & Model 1 & Model 2 & Model 3 & Model 4 \\
## \hline
## literacy & $0.39^{***}$ & $0.57^{***}$ & $0.52^{***}$ & $0.91^{***}$ \\
## & $(0.13)$ & $(0.20)$ & $(0.20)$ & $(0.24)$ \\
## agriculture & & $0.15$ & & $0.56$ \\
## & & $(0.15)$ & & $(0.38)$ \\
## landholding & & $-0.33^{*}$ & & $-0.95^{*}$ \\
## & & $(0.19)$ & & $(0.55)$ \\
## agriculture:landholding & & $0.06$ & & $-0.51$ \\
## & & $(0.22)$ & & $(0.41)$ \\
## industry & & $-0.38$ & & $-0.00$ \\
## & & $(0.38)$ & & $(0.32)$ \\
## electorate & & $0.39$ & & $-0.05$ \\
## & & $(0.36)$ & & $(0.37)$ \\
## mayor & $-0.42^{*}$ & $-0.42^{**}$ & $-0.91^{**}$ & $-1.30^{***}$ \\
## & $(0.22)$ & $(0.21)$ & $(0.40)$ & $(0.48)$ \\
## governor & & $0.12$ & & $0.22$ \\
## & & $(1.03)$ & & $(0.85)$ \\
## minister & & $0.06$ & & $-0.63$ \\
## & & $(0.40)$ & & $(0.55)$ \\
## agency.head & & $-0.08$ & & $-0.12$ \\
## & & $(0.37)$ & & $(0.82)$ \\
## state.secretary & & $0.14$ & & $0.58^{**}$ \\
## & & $(0.31)$ & & $(0.23)$ \\
## 1|2 & $-1.10^{***}$ & $-1.16^{***}$ & $-1.07$ & $-1.16^{***}$ \\
## & $(0.27)$ & $(0.33)$ & $(0.62)$ & $(0.57)$ \\
## 2|3 & $0.33$ & $0.35$ & $-0.82$ & $-0.87$ \\
## & $(0.31)$ & $(0.32)$ & $(0.64)$ & $(0.56)$ \\
## \hline
## AIC & 807.12 & 791.95 & 259.87 & 253.75 \\
## Num. obs. & 399 & 392 & 167 & 163 \\
## \hline
##
## \end{tabular}
## \label{table:coefficients}
## \end{center}
## \end{table}
rm(list=ls(all=TRUE))
data <- read.csv("abvotes.csv",header=TRUE) # Read data into memory and assign it to a data frame
attach(data)
dat<-data[rollcall!="1955",] # Exclude the 1955 roll call on the AB
detach(data)
#Non-party line votes only
data <- dat[dat$partyline!=1,]
#### Model 1
vote.out <- as.factor( 0*as.numeric(data$vote==0)+1*as.numeric(data$vote==9)+2*as.numeric(data$vote==1) )
dat1 <- na.omit(cbind(vote.out,data$literacy,
data$land,
data$agriculture,
data$industrial,
data$electorate,
data$mayor,
data$governor,
data$minister,
data$agency.head,
data$state.secretary,
data$state,
data$rollcall,
data$party))
o.vote <- as.factor(dat1[,1])
literacy <- scale(dat1[,2])
landholding <- scale(dat1[,3])
agriculture <- scale(dat1[,4])
industry <- scale(dat1[,5])
electorate <- scale(dat1[,6])
mayor <-dat1[,7]
governor <-dat1[,8]
minister <-dat1[,9]
agency.head <-dat1[,10]
state.secretary <-dat1[,11]
state <-dat1[,12]
rollcall <- as.character(dat1[,13])
party <- as.character(dat1[,14])
dat2<-data.frame(o.vote,literacy, landholding, agriculture, industry, electorate, mayor, governor, minister, agency.head, state.secretary, state, rollcall, party)
m1<-polr(o.vote~literacy*agriculture+landholding+industry+electorate+mayor+governor+minister+agency.head+state.secretary+party+rollcall,
Hess=T, data=dat2, method="logistic")
summary(m1)
## Call:
## polr(formula = o.vote ~ literacy * agriculture + landholding +
## industry + electorate + mayor + governor + minister + agency.head +
## state.secretary + party + rollcall, data = dat2, Hess = T,
## method = "logistic")
##
## Coefficients:
## Value Std. Error t value
## literacy 0.463570 0.2166 2.14014
## agriculture 0.008894 0.1682 0.05288
## landholding -0.360708 0.1282 -2.81388
## industry -0.228415 0.2209 -1.03414
## electorate 0.406384 0.2482 1.63760
## mayor -0.439282 0.2611 -1.68246
## governor 0.350654 0.7781 0.45065
## minister -0.038311 0.5355 -0.07154
## agency.head -0.083099 0.4914 -0.16912
## state.secretary 0.222231 0.2545 0.87318
## party12 -0.553325 0.7449 -0.74280
## party14 0.426894 0.3631 1.17575
## party2 1.145693 1.1533 0.99339
## party3 1.048067 0.6940 1.51015
## party4 -0.198874 0.4740 -0.41956
## party8 -0.213800 0.2896 -0.73827
## party9 0.031722 0.4253 0.07458
## rollcall3 0.711863 0.2642 2.69480
## rollcall4 0.940745 0.2487 3.78240
## literacy:agriculture 0.012184 0.1471 0.08280
##
## Intercepts:
## Value Std. Error t value
## 1|2 -1.1118 0.2997 -3.7097
## 2|3 0.4054 0.2937 1.3803
##
## Residual Deviance: 741.544
## AIC: 785.544
fm<-m1
cluster<-state
M <- length(unique(cluster))
N <- length(cluster)
rank<-length(coefficients(fm))
dfc <- (M/(M-1))*((N-1)/(N-rank))
u <- apply(estfun(fm),2,
function(x) tapply(x, cluster, sum))
vcovCL <- dfc*sandwich(fm, meat=crossprod(u)/N)*1
ct <- coeftest(fm, vcovCL)
se1<-sqrt(diag(vcovCL))
pv1<- c(ct[,4],2*pt(-abs(fm$zeta[1]/se1[11]),df=m1$df.residual),2*pt(-abs(fm$zeta[2]/se1[12]),df=m1$df.residual))
model1 <-extract(m1, include.thresholds = TRUE, include.aic = TRUE,include.nobs = TRUE,
include.bic = FALSE, include.loglik = FALSE, include.deviance = FALSE)
#### Model 2
m2<-polr(o.vote~literacy*industry+agriculture+landholding+electorate+mayor+governor+minister+agency.head+state.secretary+party+rollcall,
Hess=T, data=dat2, method="logistic")
summary(m2)
## Call:
## polr(formula = o.vote ~ literacy * industry + agriculture + landholding +
## electorate + mayor + governor + minister + agency.head +
## state.secretary + party + rollcall, data = dat2, Hess = T,
## method = "logistic")
##
## Coefficients:
## Value Std. Error t value
## literacy 0.476129 0.3491 1.36399
## industry -0.235299 0.3089 -0.76164
## agriculture 0.005857 0.1687 0.03472
## landholding -0.358371 0.1275 -2.81040
## electorate 0.392616 0.2553 1.53784
## mayor -0.442181 0.2635 -1.67785
## governor 0.349564 0.7782 0.44921
## minister -0.040178 0.5366 -0.07487
## agency.head -0.085025 0.4914 -0.17303
## state.secretary 0.223087 0.2543 0.87726
## party12 -0.545134 0.7401 -0.73660
## party14 0.430068 0.3618 1.18866
## party2 1.150797 1.1561 0.99543
## party3 1.052620 0.6992 1.50551
## party4 -0.198715 0.4762 -0.41732
## party8 -0.207945 0.2885 -0.72072
## party9 0.039426 0.4264 0.09247
## rollcall3 0.712695 0.2641 2.69908
## rollcall4 0.940202 0.2486 3.78195
## literacy:industry 0.007987 0.2660 0.03003
##
## Intercepts:
## Value Std. Error t value
## 1|2 -1.0935 0.3471 -3.1500
## 2|3 0.4236 0.3424 1.2371
##
## Residual Deviance: 741.5499
## AIC: 785.5499
fm<-m2
cluster<-state
M <- length(unique(cluster))
N <- length(cluster)
rank<-length(coefficients(fm))
dfc <- (M/(M-1))*((N-1)/(N-rank))
u <- apply(estfun(fm),2,
function(x) tapply(x, cluster, sum))
vcovCL <- dfc*sandwich(fm, meat=crossprod(u)/N)*1
ct <- coeftest(fm, vcovCL)
se2<-sqrt(diag(vcovCL))
pv2<- c(ct[,4],2*pt(-abs(fm$zeta[1]/se2[11]),df=m2$df.residual),2*pt(-abs(fm$zeta[2]/se2[12]),df=m2$df.residual))
model2 <-extract(m2, include.thresholds = TRUE, include.aic = TRUE,include.nobs = TRUE,
include.bic = FALSE, include.loglik = FALSE, include.deviance = FALSE)
#### Model 3
m3<-polr(o.vote~literacy*landholding+agriculture+industry+electorate+mayor+governor+minister+agency.head+state.secretary+party+rollcall,
Hess=T, data=dat2, method="logistic")
summary(m3)
## Call:
## polr(formula = o.vote ~ literacy * landholding + agriculture +
## industry + electorate + mayor + governor + minister + agency.head +
## state.secretary + party + rollcall, data = dat2, Hess = T,
## method = "logistic")
##
## Coefficients:
## Value Std. Error t value
## literacy 0.48400 0.2101 2.30416
## landholding -0.33976 0.1289 -2.63531
## agriculture 0.02477 0.1580 0.15680
## industry -0.19286 0.2240 -0.86083
## electorate 0.43335 0.2248 1.92738
## mayor -0.42121 0.2602 -1.61875
## governor 0.30207 0.7723 0.39116
## minister -0.01613 0.5383 -0.02996
## agency.head -0.13787 0.4937 -0.27925
## state.secretary 0.24747 0.2546 0.97191
## party12 -0.42995 0.7440 -0.57786
## party14 0.38911 0.3619 1.07506
## party2 1.21255 1.1531 1.05158
## party3 0.93318 0.6914 1.34961
## party4 -0.14291 0.4753 -0.30069
## party8 -0.19578 0.2865 -0.68339
## party9 0.06015 0.4221 0.14249
## rollcall3 0.73526 0.2656 2.76856
## rollcall4 0.92989 0.2488 3.73753
## literacy:landholding -0.22159 0.1433 -1.54665
##
## Intercepts:
## Value Std. Error t value
## 1|2 -1.0939 0.2673 -4.0926
## 2|3 0.4290 0.2617 1.6391
##
## Residual Deviance: 739.1186
## AIC: 783.1186
fm<-m3
cluster<-state
M <- length(unique(cluster))
N <- length(cluster)
rank<-length(coefficients(fm))
dfc <- (M/(M-1))*((N-1)/(N-rank))
u <- apply(estfun(fm),2,
function(x) tapply(x, cluster, sum))
vcovCL <- dfc*sandwich(fm, meat=crossprod(u)/N)*1
ct <- coeftest(fm, vcovCL)
se3<-sqrt(diag(vcovCL))
pv3<- c(ct[,4],2*pt(-abs(fm$zeta[1]/se3[11]),df=m3$df.residual),2*pt(-abs(fm$zeta[2]/se3[12]),df=m3$df.residual))
model3 <-extract(m3, include.thresholds = TRUE, include.aic = TRUE,include.nobs = TRUE,
include.bic = FALSE, include.loglik = FALSE, include.deviance = FALSE)
#### Model 4
m4<-polr(o.vote~literacy*landholding*agriculture+industry+electorate+mayor+governor+minister+agency.head+state.secretary+party+rollcall,
Hess=T, data=dat2, method="logistic")
summary(m4)
## Call:
## polr(formula = o.vote ~ literacy * landholding * agriculture +
## industry + electorate + mayor + governor + minister + agency.head +
## state.secretary + party + rollcall, data = dat2, Hess = T,
## method = "logistic")
##
## Coefficients:
## Value Std. Error t value
## literacy 0.45742 0.2167 2.11122
## landholding -0.49321 0.1754 -2.81261
## agriculture 0.02306 0.1723 0.13380
## industry -0.18327 0.2269 -0.80768
## electorate 0.47462 0.2580 1.83939
## mayor -0.42254 0.2623 -1.61096
## governor 0.23837 0.7758 0.30727
## minister 0.04120 0.5402 0.07627
## agency.head -0.18234 0.4937 -0.36933
## state.secretary 0.26335 0.2563 1.02757
## party12 -0.41060 0.7589 -0.54107
## party14 0.38975 0.3674 1.06080
## party2 1.35149 1.1683 1.15682
## party3 0.90523 0.6919 1.30825
## party4 -0.17042 0.4775 -0.35689
## party8 -0.18110 0.2956 -0.61266
## party9 0.08273 0.4318 0.19159
## rollcall3 0.72366 0.2664 2.71649
## rollcall4 0.90189 0.2498 3.61017
## literacy:landholding -0.32378 0.2133 -1.51768
## literacy:agriculture 0.07870 0.1556 0.50572
## landholding:agriculture -0.10099 0.1966 -0.51371
## literacy:landholding:agriculture -0.22053 0.1645 -1.34060
##
## Intercepts:
## Value Std. Error t value
## 1|2 -1.1473 0.3079 -3.7263
## 2|3 0.3839 0.3015 1.2733
##
## Residual Deviance: 737.1383
## AIC: 787.1383
fm<-m4
cluster<-state
M <- length(unique(cluster))
N <- length(cluster)
rank<-length(coefficients(fm))
dfc <- (M/(M-1))*((N-1)/(N-rank))
u <- apply(estfun(fm),2,
function(x) tapply(x, cluster, sum))
vcovCL <- dfc*sandwich(fm, meat=crossprod(u)/N)*1
ct <- coeftest(fm, vcovCL)
se4<-sqrt(diag(vcovCL))
pv4<- c(ct[,4],2*pt(-abs(fm$zeta[1]/se4[11]),df=m4$df.residual),2*pt(-abs(fm$zeta[2]/se4[12]),df=m4$df.residual))
model4 <-extract(m4, include.thresholds = TRUE, include.aic = TRUE,include.nobs = TRUE,
include.bic = FALSE, include.loglik = FALSE, include.deviance = FALSE)
#### Model 5
m5<-polr(o.vote~literacy+landholding+agriculture+industry+electorate*mayor+governor+minister+agency.head+state.secretary+party+rollcall,
Hess=T, data=dat2, method="logistic")
summary(m5)
## Call:
## polr(formula = o.vote ~ literacy + landholding + agriculture +
## industry + electorate * mayor + governor + minister + agency.head +
## state.secretary + party + rollcall, data = dat2, Hess = T,
## method = "logistic")
##
## Coefficients:
## Value Std. Error t value
## literacy 0.483074 0.2129 2.269280
## landholding -0.357993 0.1263 -2.833707
## agriculture 0.007096 0.1579 0.044941
## industry -0.280551 0.2412 -1.163137
## electorate 0.415058 0.2228 1.863181
## mayor -0.375832 0.2880 -1.304893
## governor 0.351517 0.7761 0.452939
## minister -0.005153 0.5395 -0.009552
## agency.head -0.082120 0.4912 -0.167189
## state.secretary 0.212745 0.2549 0.834521
## party12 -0.576630 0.7404 -0.778780
## party14 0.435260 0.3617 1.203320
## party2 1.096765 1.1563 0.948493
## party3 1.082507 0.6999 1.546658
## party4 -0.198076 0.4733 -0.418520
## party8 -0.197723 0.2854 -0.692840
## party9 0.039103 0.4198 0.093145
## rollcall3 0.707665 0.2640 2.680175
## rollcall4 0.942082 0.2489 3.785492
## electorate:mayor 0.268974 0.4853 0.554294
##
## Intercepts:
## Value Std. Error t value
## 1|2 -1.0968 0.2654 -4.1328
## 2|3 0.4205 0.2596 1.6200
##
## Residual Deviance: 741.2287
## AIC: 785.2287
fm<-m5
cluster<-state
M <- length(unique(cluster))
N <- length(cluster)
rank<-length(coefficients(fm))
dfc <- (M/(M-1))*((N-1)/(N-rank))
u <- apply(estfun(fm),2,
function(x) tapply(x, cluster, sum))
vcovCL <- dfc*sandwich(fm, meat=crossprod(u)/N)*1
ct <- coeftest(fm, vcovCL)
se5<-sqrt(diag(vcovCL))
pv5<- c(ct[,4],2*pt(-abs(fm$zeta[1]/se5[11]),df=m5$df.residual),2*pt(-abs(fm$zeta[2]/se5[12]),df=m5$df.residual))
model5 <-extract(m5, include.thresholds = TRUE, include.aic = TRUE,include.nobs = TRUE,
include.bic = FALSE, include.loglik = FALSE, include.deviance = FALSE)
#### Model 6
m6<-polr(o.vote~literacy+landholding*agriculture+industry+electorate*mayor+governor+minister+agency.head+state.secretary+party+rollcall,
Hess=T, data=dat2, method="logistic")
summary(m6)
## Call:
## polr(formula = o.vote ~ literacy + landholding * agriculture +
## industry + electorate * mayor + governor + minister + agency.head +
## state.secretary + party + rollcall, data = dat2, Hess = T,
## method = "logistic")
##
## Coefficients:
## Value Std. Error t value
## literacy 0.486600 0.2125 2.29029
## landholding -0.320458 0.1324 -2.42069
## agriculture 0.001253 0.1581 0.00793
## industry -0.293190 0.2422 -1.21040
## electorate 0.441954 0.2269 1.94810
## mayor -0.358403 0.2891 -1.23986
## governor 0.292324 0.7717 0.37883
## minister 0.017691 0.5399 0.03277
## agency.head -0.113410 0.4918 -0.23060
## state.secretary 0.212477 0.2548 0.83396
## party12 -0.557947 0.7393 -0.75471
## party14 0.390359 0.3637 1.07324
## party2 1.073002 1.1549 0.92905
## party3 0.996378 0.7015 1.42030
## party4 -0.172909 0.4726 -0.36589
## party8 -0.212284 0.2867 -0.74044
## party9 0.021958 0.4208 0.05218
## rollcall3 0.711435 0.2646 2.68882
## rollcall4 0.929878 0.2493 3.73015
## landholding:agriculture 0.131125 0.1235 1.06177
## electorate:mayor 0.262909 0.4877 0.53911
##
## Intercepts:
## Value Std. Error t value
## 1|2 -1.1138 0.2671 -4.1698
## 2|3 0.4060 0.2612 1.5543
##
## Residual Deviance: 740.0848
## AIC: 786.0848
fm<-m6
cluster<-state
M <- length(unique(cluster))
N <- length(cluster)
rank<-length(coefficients(fm))
dfc <- (M/(M-1))*((N-1)/(N-rank))
u <- apply(estfun(fm),2,
function(x) tapply(x, cluster, sum))
vcovCL <- dfc*sandwich(fm, meat=crossprod(u)/N)*1
ct <- coeftest(fm, vcovCL)
se6<-sqrt(diag(vcovCL))
pv6<- c(ct[,4],2*pt(-abs(fm$zeta[1]/se6[11]),df=m6$df.residual),2*pt(-abs(fm$zeta[2]/se6[12]),df=m6$df.residual))
model6 <-extract(m6, include.thresholds = TRUE, include.aic = TRUE,include.nobs = TRUE,
include.bic = FALSE, include.loglik = FALSE, include.deviance = FALSE)
####
texreg(list(model1,model2,model3,model4,model5,model6),
override.se = list(se1,se2,se3,se4,se5,se6),
override.pvalues = list(pv1,pv2,pv3,pv4,pv5,pv6),
stars = c(0.01, 0.05, 0.1), digits=2,
omit.coef = "(party)|(rollcall)",
caption.above=TRUE,
caption="Impact of Constituency and Personal Characteristics on Votes for the Official Ballot, 1958 and 1962 roll calls (Ordered logistic regression)",
custom.note = "")
##
## \begin{table}
## \caption{Impact of Constituency and Personal Characteristics on Votes for the Official Ballot, 1958 and 1962 roll calls (Ordered logistic regression)}
## \begin{center}
## \begin{tabular}{l c c c c c c }
## \hline
## & Model 1 & Model 2 & Model 3 & Model 4 & Model 5 & Model 6 \\
## \hline
## literacy & $0.46^{*}$ & $0.48^{*}$ & $0.48^{**}$ & $0.46^{**}$ & $0.48^{**}$ & $0.49^{**}$ \\
## & $(0.26)$ & $(0.26)$ & $(0.21)$ & $(0.21)$ & $(0.25)$ & $(0.24)$ \\
## agriculture & $0.01$ & $0.01$ & $0.02$ & $0.02$ & $0.01$ & $0.00$ \\
## & $(0.23)$ & $(0.19)$ & $(0.20)$ & $(0.22)$ & $(0.21)$ & $(0.21)$ \\
## landholding & $-0.36^{***}$ & $-0.36^{***}$ & $-0.34^{**}$ & $-0.49^{***}$ & $-0.36^{***}$ & $-0.32^{**}$ \\
## & $(0.12)$ & $(0.12)$ & $(0.14)$ & $(0.12)$ & $(0.11)$ & $(0.13)$ \\
## industry & $-0.23$ & $-0.24$ & $-0.19$ & $-0.18$ & $-0.28$ & $-0.29^{*}$ \\
## & $(0.16)$ & $(0.30)$ & $(0.15)$ & $(0.16)$ & $(0.19)$ & $(0.17)$ \\
## electorate & $0.41$ & $0.39$ & $0.43^{**}$ & $0.47$ & $0.42^{*}$ & $0.44^{**}$ \\
## & $(0.29)$ & $(0.27)$ & $(0.21)$ & $(0.31)$ & $(0.23)$ & $(0.22)$ \\
## mayor & $-0.44^{**}$ & $-0.44^{**}$ & $-0.42^{**}$ & $-0.42^{**}$ & $-0.38^{**}$ & $-0.36^{**}$ \\
## & $(0.20)$ & $(0.19)$ & $(0.19)$ & $(0.19)$ & $(0.17)$ & $(0.17)$ \\
## governor & $0.35$ & $0.35$ & $0.30$ & $0.24$ & $0.35$ & $0.29$ \\
## & $(1.14)$ & $(1.14)$ & $(1.10)$ & $(1.13)$ & $(1.12)$ & $(1.09)$ \\
## minister & $-0.04$ & $-0.04$ & $-0.02$ & $0.04$ & $-0.01$ & $0.02$ \\
## & $(0.41)$ & $(0.42)$ & $(0.41)$ & $(0.43)$ & $(0.41)$ & $(0.42)$ \\
## agency.head & $-0.08$ & $-0.09$ & $-0.14$ & $-0.18$ & $-0.08$ & $-0.11$ \\
## & $(0.35)$ & $(0.35)$ & $(0.35)$ & $(0.34)$ & $(0.35)$ & $(0.34)$ \\
## state.secretary & $0.22$ & $0.22$ & $0.25$ & $0.26$ & $0.21$ & $0.21$ \\
## & $(0.28)$ & $(0.28)$ & $(0.26)$ & $(0.28)$ & $(0.27)$ & $(0.26)$ \\
## literacy:agriculture & $0.01$ & & & $0.08$ & & \\
## & $(0.16)$ & & & $(0.15)$ & & \\
## 1|2 & $-1.11^{***}$ & $-1.09^{***}$ & $-1.09^{***}$ & $-1.15^{***}$ & $-1.10^{***}$ & $-1.11^{***}$ \\
## & $(0.32)$ & $(0.38)$ & $(0.34)$ & $(0.33)$ & $(0.33)$ & $(0.35)$ \\
## 2|3 & $0.41$ & $0.42$ & $0.43$ & $0.38$ & $0.42$ & $0.41$ \\
## & $(0.42)$ & $(0.46)$ & $(0.34)$ & $(0.43)$ & $(0.34)$ & $(0.35)$ \\
## literacy:industry & & $0.01$ & & & & \\
## & & $(0.26)$ & & & & \\
## literacy:landholding & & & $-0.22$ & $-0.32^{*}$ & & \\
## & & & $(0.21)$ & $(0.20)$ & & \\
## landholding:agriculture & & & & $-0.10$ & & $0.13$ \\
## & & & & $(0.19)$ & & $(0.16)$ \\
## literacy:landholding:agriculture & & & & $-0.22$ & & \\
## & & & & $(0.14)$ & & \\
## electorate:mayor & & & & & $0.27$ & $0.26$ \\
## & & & & & $(0.35)$ & $(0.34)$ \\
## \hline
## AIC & 785.54 & 785.55 & 783.12 & 787.14 & 785.23 & 786.08 \\
## Num. obs. & 394 & 394 & 394 & 394 & 394 & 394 \\
## \hline
##
## \end{tabular}
## \label{table:coefficients}
## \end{center}
## \end{table}
rm(list=ls(all=TRUE))
data <- read.csv("abvotes.csv",header=TRUE) # Read data into memory and assign it to a data frame
attach(data)
dat<-data[rollcall=="1962",] # Select only the 1962 roll call on the AB
detach(data)
#Non-party line votes only
data <- dat[dat$partyline!=1,]
#### Model 1
vote.out <- as.factor( 0*as.numeric(data$vote==0)+1*as.numeric(data$vote==9)+2*as.numeric(data$vote==1) )
dat1 <- na.omit(cbind(vote.out,data$literacy,
data$land,
data$agriculture,
data$industrial,
data$electorate,
data$mayor,
data$governor,
data$minister,
data$agency.head,
data$state.secretary,
data$state,
data$party))
o.vote <- as.factor(dat1[,1])
literacy <- scale(dat1[,2])
landholding <- scale(dat1[,3])
agriculture <- scale(dat1[,4])
industry <- scale(dat1[,5])
electorate <- scale(dat1[,6])
mayor <-dat1[,7]
governor <-dat1[,8]
minister <-dat1[,9]
agency.head <-dat1[,10]
state.secretary <-dat1[,11]
state <-dat1[,12]
party <- as.character(dat1[,13])
dat2<-data.frame(o.vote,literacy, landholding, agriculture, industry, electorate, mayor, governor, minister, agency.head, state.secretary, state, party)
m1<-polr(o.vote~literacy*agriculture+landholding+industry+electorate+mayor+governor+minister+agency.head+state.secretary+party,
Hess=T, data=dat2, method="logistic")
summary(m1)
## Call:
## polr(formula = o.vote ~ literacy * agriculture + landholding +
## industry + electorate + mayor + governor + minister + agency.head +
## state.secretary + party, data = dat2, Hess = T, method = "logistic")
##
## Coefficients:
## Value Std. Error t value
## literacy 1.23357 0.4243 2.90716
## agriculture 0.33022 0.3372 0.97942
## landholding -0.59549 0.2611 -2.28093
## industry -0.59860 0.4610 -1.29848
## electorate 0.35760 0.4779 0.74834
## mayor -1.34681 0.4748 -2.83687
## governor 0.23972 1.0121 0.23685
## minister -0.51678 0.9010 -0.57354
## agency.head 0.05918 0.7554 0.07834
## state.secretary 0.78882 0.5107 1.54450
## party12 -0.54238 1.3659 -0.39709
## party14 0.81005 0.6396 1.26649
## party2 1.31556 1.2731 1.03334
## party4 -0.83487 0.9065 -0.92101
## party8 -0.24312 0.5480 -0.44368
## party9 0.84800 1.1584 0.73207
## literacy:agriculture 0.03332 0.2920 0.11408
##
## Intercepts:
## Value Std. Error t value
## 1|2 -1.2653 0.5355 -2.3629
## 2|3 -0.9772 0.5313 -1.8394
##
## Residual Deviance: 215.4043
## AIC: 253.4043
fm<-m1
cluster<-state
M <- length(unique(cluster))
N <- length(cluster)
rank<-length(coefficients(fm))
dfc <- (M/(M-1))*((N-1)/(N-rank))
u <- apply(estfun(fm),2,
function(x) tapply(x, cluster, sum))
vcovCL <- dfc*sandwich(fm, meat=crossprod(u)/N)*1
ct <- coeftest(fm, vcovCL)
se1<-sqrt(diag(vcovCL))
pv1<- c(ct[,4],2*pt(-abs(fm$zeta[1]/se1[11]),df=m1$df.residual),2*pt(-abs(fm$zeta[2]/se1[12]),df=m1$df.residual))
model1 <-extract(m1, include.thresholds = TRUE, include.aic = TRUE,include.nobs = TRUE,
include.bic = FALSE, include.loglik = FALSE, include.deviance = FALSE)
#### Model 2
m2<-polr(o.vote~literacy*industry+agriculture+landholding+electorate+mayor+governor+minister+agency.head+state.secretary+party,
Hess=T, data=dat2, method="logistic")
summary(m2)
## Call:
## polr(formula = o.vote ~ literacy * industry + agriculture + landholding +
## electorate + mayor + governor + minister + agency.head +
## state.secretary + party, data = dat2, Hess = T, method = "logistic")
##
## Coefficients:
## Value Std. Error t value
## literacy 1.97589 0.6355 3.10921
## industry -1.09763 0.5569 -1.97081
## agriculture 0.49845 0.3066 1.62578
## landholding -0.63041 0.2667 -2.36364
## electorate -0.26706 0.5728 -0.46621
## mayor -1.49081 0.4834 -3.08405
## governor 0.32272 1.0150 0.31793
## minister -0.68692 0.9084 -0.75615
## agency.head 0.01169 0.7513 0.01555
## state.secretary 0.91140 0.5162 1.76554
## party12 -0.90270 1.4056 -0.64220
## party14 0.83375 0.6457 1.29115
## party2 1.68969 1.3188 1.28123
## party4 -1.08563 0.9361 -1.15979
## party8 -0.19147 0.5492 -0.34861
## party9 0.96796 1.1555 0.83767
## literacy:industry 0.80164 0.4943 1.62187
##
## Intercepts:
## Value Std. Error t value
## 1|2 -0.6452 0.5986 -1.0778
## 2|3 -0.3522 0.5970 -0.5900
##
## Residual Deviance: 212.662
## AIC: 250.662
fm<-m2
cluster<-state
M <- length(unique(cluster))
N <- length(cluster)
rank<-length(coefficients(fm))
dfc <- (M/(M-1))*((N-1)/(N-rank))
u <- apply(estfun(fm),2,
function(x) tapply(x, cluster, sum))
vcovCL <- dfc*sandwich(fm, meat=crossprod(u)/N)*1
ct <- coeftest(fm, vcovCL)
se2<-sqrt(diag(vcovCL))
pv2<- c(ct[,4],2*pt(-abs(fm$zeta[1]/se2[11]),df=m2$df.residual),2*pt(-abs(fm$zeta[2]/se2[12]),df=m2$df.residual))
model2 <-extract(m2, include.thresholds = TRUE, include.aic = TRUE,include.nobs = TRUE,
include.bic = FALSE, include.loglik = FALSE, include.deviance = FALSE)
#### Model 3
m3<-polr(o.vote~literacy*landholding+agriculture+industry+electorate+mayor+governor+minister+agency.head+state.secretary+party,
Hess=T, data=dat2, method="logistic")
summary(m3)
## Call:
## polr(formula = o.vote ~ literacy * landholding + agriculture +
## industry + electorate + mayor + governor + minister + agency.head +
## state.secretary + party, data = dat2, Hess = T, method = "logistic")
##
## Coefficients:
## Value Std. Error t value
## literacy 1.31846 0.4315 3.05519
## landholding -0.74428 0.3008 -2.47449
## agriculture 0.30686 0.2807 1.09329
## industry -0.53090 0.4953 -1.07180
## electorate 0.59943 0.5486 1.09258
## mayor -1.18913 0.4919 -2.41746
## governor 0.07018 1.0263 0.06838
## minister -0.48201 0.9290 -0.51885
## agency.head -0.13153 0.7830 -0.16798
## state.secretary 0.78854 0.5056 1.55973
## party12 -0.35597 1.3902 -0.25605
## party14 0.71911 0.6386 1.12616
## party2 1.58404 1.3010 1.21757
## party4 -0.77702 0.9149 -0.84925
## party8 -0.22215 0.5505 -0.40355
## party9 0.85127 1.1323 0.75177
## literacy:landholding -0.66601 0.3234 -2.05948
##
## Intercepts:
## Value Std. Error t value
## 1|2 -1.3153 0.4940 -2.6626
## 2|3 -1.0189 0.4895 -2.0814
##
## Residual Deviance: 210.4707
## AIC: 248.4707
fm<-m3
cluster<-state
M <- length(unique(cluster))
N <- length(cluster)
rank<-length(coefficients(fm))
dfc <- (M/(M-1))*((N-1)/(N-rank))
u <- apply(estfun(fm),2,
function(x) tapply(x, cluster, sum))
vcovCL <- dfc*sandwich(fm, meat=crossprod(u)/N)*1
ct <- coeftest(fm, vcovCL)
se3<-sqrt(diag(vcovCL))
pv3<- c(ct[,4],2*pt(-abs(fm$zeta[1]/se3[11]),df=m3$df.residual),2*pt(-abs(fm$zeta[2]/se3[12]),df=m3$df.residual))
model3 <-extract(m3, include.thresholds = TRUE, include.aic = TRUE,include.nobs = TRUE,
include.bic = FALSE, include.loglik = FALSE, include.deviance = FALSE)
#### Model 4
m4<-polr(o.vote~literacy*landholding*agriculture+industry+electorate+mayor+governor+minister+agency.head+state.secretary+party,
Hess=T, data=dat2, method="logistic")
summary(m4)
## Call:
## polr(formula = o.vote ~ literacy * landholding * agriculture +
## industry + electorate + mayor + governor + minister + agency.head +
## state.secretary + party, data = dat2, Hess = T, method = "logistic")
##
## Coefficients:
## Value Std. Error t value
## literacy 1.45851 0.4626 3.15300
## landholding -0.73845 0.3633 -2.03257
## agriculture 0.56430 0.3973 1.42044
## industry -0.43040 0.4987 -0.86298
## electorate 0.55932 0.5832 0.95899
## mayor -1.24030 0.5076 -2.44331
## governor 0.20819 1.0451 0.19920
## minister -0.60786 0.9533 -0.63761
## agency.head -0.11397 0.8061 -0.14139
## state.secretary 0.75506 0.5118 1.47523
## party12 -0.45017 1.4054 -0.32032
## party14 0.78616 0.6534 1.20322
## party2 1.55781 1.2996 1.19872
## party4 -0.73889 0.9316 -0.79313
## party8 -0.21411 0.5634 -0.38006
## party9 0.84918 1.1642 0.72940
## literacy:landholding -0.98842 0.4678 -2.11287
## literacy:agriculture 0.07581 0.3471 0.21838
## landholding:agriculture -0.38787 0.4361 -0.88942
## literacy:landholding:agriculture -0.01771 0.3423 -0.05175
##
## Intercepts:
## Value Std. Error t value
## 1|2 -1.3537 0.5587 -2.4228
## 2|3 -1.0549 0.5542 -1.9034
##
## Residual Deviance: 209.2577
## AIC: 253.2577
fm<-m4
cluster<-state
M <- length(unique(cluster))
N <- length(cluster)
rank<-length(coefficients(fm))
dfc <- (M/(M-1))*((N-1)/(N-rank))
u <- apply(estfun(fm),2,
function(x) tapply(x, cluster, sum))
vcovCL <- dfc*sandwich(fm, meat=crossprod(u)/N)*1
ct <- coeftest(fm, vcovCL)
se4<-sqrt(diag(vcovCL))
pv4<- c(ct[,4],2*pt(-abs(fm$zeta[1]/se4[11]),df=m4$df.residual),2*pt(-abs(fm$zeta[2]/se4[12]),df=m4$df.residual))
model4 <-extract(m4, include.thresholds = TRUE, include.aic = TRUE,include.nobs = TRUE,
include.bic = FALSE, include.loglik = FALSE, include.deviance = FALSE)
#### Model 5
m5<-polr(o.vote~literacy+landholding+agriculture+industry+electorate*mayor+governor+minister+agency.head+state.secretary+party,
Hess=T, data=dat2, method="logistic")
summary(m5)
## Call:
## polr(formula = o.vote ~ literacy + landholding + agriculture +
## industry + electorate * mayor + governor + minister + agency.head +
## state.secretary + party, data = dat2, Hess = T, method = "logistic")
##
## Coefficients:
## Value Std. Error t value
## literacy 1.21759 0.4231 2.87782
## landholding -0.59786 0.2608 -2.29278
## agriculture 0.30509 0.2770 1.10126
## industry -0.58404 0.4615 -1.26548
## electorate 0.28065 0.4492 0.62479
## mayor -1.26422 0.5223 -2.42062
## governor 0.23993 1.0144 0.23652
## minister -0.48687 0.8996 -0.54122
## agency.head 0.05476 0.7520 0.07282
## state.secretary 0.78984 0.5086 1.55293
## party12 -0.48180 1.3692 -0.35188
## party14 0.79658 0.6390 1.24657
## party2 1.19511 1.2942 0.92340
## party4 -0.86930 0.9078 -0.95759
## party8 -0.25059 0.5436 -0.46097
## party9 0.83364 1.1506 0.72455
## electorate:mayor 0.34875 0.7909 0.44095
##
## Intercepts:
## Value Std. Error t value
## 1|2 -1.2441 0.4785 -2.6002
## 2|3 -0.9554 0.4742 -2.0148
##
## Residual Deviance: 215.1949
## AIC: 253.1949
fm<-m5
cluster<-state
M <- length(unique(cluster))
N <- length(cluster)
rank<-length(coefficients(fm))
dfc <- (M/(M-1))*((N-1)/(N-rank))
u <- apply(estfun(fm),2,
function(x) tapply(x, cluster, sum))
vcovCL <- dfc*sandwich(fm, meat=crossprod(u)/N)*1
ct <- coeftest(fm, vcovCL)
se5<-sqrt(diag(vcovCL))
pv5<- c(ct[,4],2*pt(-abs(fm$zeta[1]/se5[11]),df=m5$df.residual),2*pt(-abs(fm$zeta[2]/se5[12]),df=m5$df.residual))
model5 <-extract(m5, include.thresholds = TRUE, include.aic = TRUE,include.nobs = TRUE,
include.bic = FALSE, include.loglik = FALSE, include.deviance = FALSE)
#### Model 6
m6<-polr(o.vote~literacy+landholding*agriculture+industry+electorate*mayor+governor+minister+agency.head+state.secretary+party,
Hess=T, data=dat2, method="logistic")
summary(m6)
## Call:
## polr(formula = o.vote ~ literacy + landholding * agriculture +
## industry + electorate * mayor + governor + minister + agency.head +
## state.secretary + party, data = dat2, Hess = T, method = "logistic")
##
## Coefficients:
## Value Std. Error t value
## literacy 1.168400 0.4247 2.75082
## landholding -0.618452 0.2697 -2.29287
## agriculture 0.206128 0.3048 0.67619
## industry -0.615120 0.4709 -1.30623
## electorate 0.377531 0.4903 0.76995
## mayor -1.209331 0.5334 -2.26727
## governor 0.133323 1.0208 0.13060
## minister -0.428987 0.9034 -0.47485
## agency.head 0.009716 0.7570 0.01283
## state.secretary 0.799981 0.5073 1.57685
## party12 -0.399838 1.3754 -0.29070
## party14 0.730269 0.6426 1.13646
## party2 1.281453 1.3148 0.97464
## party4 -0.858386 0.9027 -0.95096
## party8 -0.257917 0.5456 -0.47276
## party9 0.807795 1.1463 0.70469
## landholding:agriculture 0.186685 0.2473 0.75484
## electorate:mayor 0.275297 0.8272 0.33280
##
## Intercepts:
## Value Std. Error t value
## 1|2 -1.2602 0.4822 -2.6136
## 2|3 -0.9711 0.4780 -2.0316
##
## Residual Deviance: 214.6074
## AIC: 254.6074
fm<-m6
cluster<-state
M <- length(unique(cluster))
N <- length(cluster)
rank<-length(coefficients(fm))
dfc <- (M/(M-1))*((N-1)/(N-rank))
u <- apply(estfun(fm),2,
function(x) tapply(x, cluster, sum))
vcovCL <- dfc*sandwich(fm, meat=crossprod(u)/N)*1
ct <- coeftest(fm, vcovCL)
se6<-sqrt(diag(vcovCL))
pv6<- c(ct[,4],2*pt(-abs(fm$zeta[1]/se6[11]),df=m6$df.residual),2*pt(-abs(fm$zeta[2]/se6[12]),df=m6$df.residual))
model6 <-extract(m6, include.thresholds = TRUE, include.aic = TRUE,include.nobs = TRUE,
include.bic = FALSE, include.loglik = FALSE, include.deviance = FALSE)
####
texreg(list(model1,model2,model3,model4,model5,model6),
override.se = list(se1,se2,se3,se4,se5,se6),
override.pvalues = list(pv1,pv2,pv3,pv4,pv5,pv6),
stars = c(0.01, 0.05, 0.1), digits=2,
omit.coef = "(party)|(rollcall)",
caption.above=TRUE,
caption="Impact of Constituency and Personal Characteristics on Votes for the Official Ballot, 1962 roll call (Ordered logistic regression)",
custom.note = "")
##
## \begin{table}
## \caption{Impact of Constituency and Personal Characteristics on Votes for the Official Ballot, 1962 roll call (Ordered logistic regression)}
## \begin{center}
## \begin{tabular}{l c c c c c c }
## \hline
## & Model 1 & Model 2 & Model 3 & Model 4 & Model 5 & Model 6 \\
## \hline
## literacy & $1.23^{**}$ & $1.98^{***}$ & $1.32^{***}$ & $1.46^{***}$ & $1.22^{**}$ & $1.17^{**}$ \\
## & $(0.50)$ & $(0.58)$ & $(0.39)$ & $(0.35)$ & $(0.51)$ & $(0.50)$ \\
## agriculture & $0.33$ & $0.50$ & $0.31$ & $0.56$ & $0.31$ & $0.21$ \\
## & $(0.50)$ & $(0.44)$ & $(0.38)$ & $(0.57)$ & $(0.42)$ & $(0.49)$ \\
## landholding & $-0.60^{**}$ & $-0.63^{**}$ & $-0.74^{***}$ & $-0.74^{***}$ & $-0.60^{**}$ & $-0.62^{**}$ \\
## & $(0.26)$ & $(0.27)$ & $(0.28)$ & $(0.26)$ & $(0.26)$ & $(0.25)$ \\
## industry & $-0.60$ & $-1.10^{**}$ & $-0.53$ & $-0.43$ & $-0.58$ & $-0.62$ \\
## & $(0.39)$ & $(0.42)$ & $(0.39)$ & $(0.40)$ & $(0.39)$ & $(0.38)$ \\
## electorate & $0.36$ & $-0.27$ & $0.60^{*}$ & $0.56$ & $0.28$ & $0.38$ \\
## & $(0.48)$ & $(0.44)$ & $(0.31)$ & $(0.49)$ & $(0.35)$ & $(0.32)$ \\
## mayor & $-1.35^{***}$ & $-1.49^{***}$ & $-1.19^{***}$ & $-1.24^{***}$ & $-1.26^{***}$ & $-1.21^{***}$ \\
## & $(0.33)$ & $(0.33)$ & $(0.40)$ & $(0.47)$ & $(0.24)$ & $(0.27)$ \\
## governor & $0.24$ & $0.32$ & $0.07$ & $0.21$ & $0.24$ & $0.13$ \\
## & $(1.04)$ & $(0.92)$ & $(1.01)$ & $(0.96)$ & $(1.04)$ & $(0.95)$ \\
## minister & $-0.52$ & $-0.69$ & $-0.48$ & $-0.61$ & $-0.49$ & $-0.43$ \\
## & $(0.52)$ & $(0.46)$ & $(0.62)$ & $(0.51)$ & $(0.54)$ & $(0.53)$ \\
## agency.head & $0.06$ & $0.01$ & $-0.13$ & $-0.11$ & $0.05$ & $0.01$ \\
## & $(0.66)$ & $(0.63)$ & $(0.70)$ & $(0.79)$ & $(0.67)$ & $(0.65)$ \\
## state.secretary & $0.79^{**}$ & $0.91^{**}$ & $0.79^{**}$ & $0.76^{**}$ & $0.79^{**}$ & $0.80^{**}$ \\
## & $(0.32)$ & $(0.35)$ & $(0.34)$ & $(0.31)$ & $(0.32)$ & $(0.33)$ \\
## literacy:agriculture & $0.03$ & & & $0.08$ & & \\
## & $(0.30)$ & & & $(0.39)$ & & \\
## 1|2 & $-1.27^{**}$ & $-0.65$ & $-1.32^{***}$ & $-1.35^{***}$ & $-1.24^{**}$ & $-1.26^{***}$ \\
## & $(0.60)$ & $(0.43)$ & $(0.48)$ & $(0.57)$ & $(0.53)$ & $(0.51)$ \\
## 2|3 & $-0.98$ & $-0.35$ & $-1.02$ & $-1.05$ & $-0.96$ & $-0.97$ \\
## & $(0.59)$ & $(0.42)$ & $(0.48)$ & $(0.54)$ & $(0.54)$ & $(0.52)$ \\
## literacy:industry & & $0.80^{***}$ & & & & \\
## & & $(0.28)$ & & & & \\
## literacy:landholding & & & $-0.67$ & $-0.99^{**}$ & & \\
## & & & $(0.43)$ & $(0.50)$ & & \\
## landholding:agriculture & & & & $-0.39$ & & $0.19$ \\
## & & & & $(0.46)$ & & $(0.30)$ \\
## literacy:landholding:agriculture & & & & $-0.02$ & & \\
## & & & & $(0.23)$ & & \\
## electorate:mayor & & & & & $0.35$ & $0.28$ \\
## & & & & & $(0.43)$ & $(0.50)$ \\
## \hline
## AIC & 253.40 & 250.66 & 248.47 & 253.26 & 253.19 & 254.61 \\
## Num. obs. & 165 & 165 & 165 & 165 & 165 & 165 \\
## \hline
##
## \end{tabular}
## \label{table:coefficients}
## \end{center}
## \end{table}
In “Vote Secrecy with Diverse Voters” we relied on five different data sets to produce the analyses. This codebook presents these data sets.
The abvotes.csv file contains the data employed in most of the analyses. Federal deputies who voted on the Australian Ballot (AB) in Brazil during the 1950’s and 1960’s in Brazil are the units. A federal deputy can enter the data more than once if she participated in more than one roll call. For each legislator, there are variables indicating how they voted in each of the four AB roll calls, their biographical information, and sociodemographic characteristics of their electoral bases (which take into account the proportion of votes they had in each municipality within the district they represent). To produce this final data set, we gathered five source data sets: (1) recorded votes in the Brazilian Chamber of Deputies, (2) the 1954 and 1958 federal deputies’ electoral returns at the municipal level, (3) biographical information, (4) demographic census, and (5) agrarian census. Details on how the data set was constructed is available in the appendix.
Variables:
The stronghold.csv file has the same structure of the abvotes.csv, but sociodemographic variables reflect only deputies’ strongholds (i.e., the municipality where the federal deputy received the most votes).
Variables:
The participation.txt file has data on wasted votes in Federal Deputy elections (form 1945 to 2014) as a percentage of all votes cast in the country as a whole as well as in the state of Sao Paulo.
Variables:
The demog.csv file contains data from the Brazilian 1960 census (conducted by IBGE, the Brazilian Institute for Geography and Statistics) and also from electoral registry in 1960 (TSE, Superior Electoral Court). The units in this data set are municipalities.
Variables:
The brelectoral.csv contains the municipality level electoral returns from the federal deputies we include in our analysis. Two federal deputy electoral cycles are present in these data: 1954 and 1958.
Variables: