Title: | Indicators of Electoral Systems and Party Systems |
---|---|
Description: | It allows structuring electoral data of different size and structure to calculate various indicators frequently used in the studies of electoral systems and party systems. Indicators of electoral volatility, electoral disproportionality, party nationalization and the effective number of parties are included. |
Authors: | Nicolas Schmidt [aut, cre] |
Maintainer: | Nicolas Schmidt <[email protected]> |
License: | GPL-2 |
Version: | 0.2.2 |
Built: | 2025-02-18 05:57:12 UTC |
Source: | https://github.com/nicolas-schmidt/esaps |
It allows structuring electoral data of different size and structure to calculate various indicators frequently used in the studies of electoral systems and party systems:
Electoral Volatility:
Pedersen (1979) <doi:10.1111/j.1475-6765.1979.tb01267.x>
Powell and Tucker (2014) <doi:10.1017/S0007123412000531>
Lago and Torcal (2019) <doi:10.1177/1354068818795191>
Effective Number of Parties:
Laakso and Taagepera (1979) <doi:10.1177/001041407901200101>
Electoral disproportionality:
Rae (1971, ISBN:9780300015171)
Loosemore and Hanby (1971) <doi:10.1017/S000712340000925X>
Lijphart (1986, ISBN:0875860648, 0875860745)
Lijphart (1994) <doi:10.1093/acprof:oso/9780198273479.001.0001>
Cox and Shugart (1991) <doi:10.1016/0261-3794(91)90025-N>
Gallagher (1991) <doi:10.1016/0261-3794(91)90004-C>
Party System Nationalization:
Mainwaring and Jones (2003) <doi:10.1177/13540688030092002>
Chhibber and Kollman (2004, ISBN:9781400826377)
Nicolas Schmidt [email protected]
Useful link: https://nicolas-schmidt.github.io/esaps/index.html
Convert data in table format to tidy_data to use in the indicators of the tidy_data.
convert_esaps( path = NULL, dataset = NULL, file.name = NULL, nSheets = 1, election.name, unit.name, M.name = NULL, votes_nac.name = NULL, seats = FALSE, allSheet = FALSE )
convert_esaps( path = NULL, dataset = NULL, file.name = NULL, nSheets = 1, election.name, unit.name, M.name = NULL, votes_nac.name = NULL, seats = FALSE, allSheet = FALSE )
path |
Character vector containing one or more path names. |
dataset |
Electoral results by party. It can be a |
file.name |
Name of the data file with extension. |
nSheets |
Number of countries (number of sheets).' 'Country' is a generic unit of analysis (province, department, etc.) |
election.name |
Name of the variable that contains elections. |
unit.name |
Name of the variable that contains the unit. 'unit' is a generic unit of analysis (province, department, etc.) |
M.name |
Name of the variable that contains the district magnitude (M+1). It is for the calculation of endogenous and exogenous electoral volatility (Torcal and Lago, 2015). |
votes_nac.name |
la la la |
seats |
By default it is |
allSheet |
By default it is |
data.frame
Nicolas Schmidt [email protected]
votes <- list(data.frame(country = rep("ARG", 3), year = c(1995, 2000, 2005), party_A = c(40,10,20), party_B = c(35,20,40), party_C = c(25,70,40)), data.frame(country = rep("URY", 4), year = c(1995, 2000, 2005, 2010), party_A = c(30,30,20,20), party_B = c(30,50,40, 30), party_C = c(30,10,30, 25), party_D = c(10,10,10,25)), data.frame(country = rep("BRA", 2), year = c(1993, 1998), party_A = c(30, 55), party_B = c(70, 45))) votes <- convert_esaps(dataset = votes, unit.name = "country", election.name = "year") votes2 <- data.frame(year = c(2000, 2005), country = "URY", votes_party1 = c(20, 30), votes_party2 = c(30, 35), votes_party3 = c(40, 25), votes_party4 = c(10, 10), seats_party1 = c(25, 35), seats_party2 = c(20, 30), seats_party3 = c(40, 30), seats_party4 = c(15, 5)) votes <- convert_esaps(dataset = votes2, unit.name = "country", election.name = "year", seats = TRUE) ## Not run: v1 <- convert_esaps(path = getwd(), file.name = c("electionBRA.xlsx", "electionARG.xlsx"), election.name = "elec", unit.name = "district", allSheet = TRUE) v2 <-convert_esaps(path = getwd(), file.name = c("ARG.ods", "URY.ods", "BRA.ods"), nCountry = c(2, 3, 1), election.name = "elec", unit.name = "province") v3 <- convert_esaps(path = here::here(), file.name = list.files(pattern = "*.xlsx"), election.name = "year", unit.name = "country", M.name = "magnitude", seats = TRUE, allSheet = TRUE) ## End(Not run)
votes <- list(data.frame(country = rep("ARG", 3), year = c(1995, 2000, 2005), party_A = c(40,10,20), party_B = c(35,20,40), party_C = c(25,70,40)), data.frame(country = rep("URY", 4), year = c(1995, 2000, 2005, 2010), party_A = c(30,30,20,20), party_B = c(30,50,40, 30), party_C = c(30,10,30, 25), party_D = c(10,10,10,25)), data.frame(country = rep("BRA", 2), year = c(1993, 1998), party_A = c(30, 55), party_B = c(70, 45))) votes <- convert_esaps(dataset = votes, unit.name = "country", election.name = "year") votes2 <- data.frame(year = c(2000, 2005), country = "URY", votes_party1 = c(20, 30), votes_party2 = c(30, 35), votes_party3 = c(40, 25), votes_party4 = c(10, 10), seats_party1 = c(25, 35), seats_party2 = c(20, 30), seats_party3 = c(40, 30), seats_party4 = c(15, 5)) votes <- convert_esaps(dataset = votes2, unit.name = "country", election.name = "year", seats = TRUE) ## Not run: v1 <- convert_esaps(path = getwd(), file.name = c("electionBRA.xlsx", "electionARG.xlsx"), election.name = "elec", unit.name = "district", allSheet = TRUE) v2 <-convert_esaps(path = getwd(), file.name = c("ARG.ods", "URY.ods", "BRA.ods"), nCountry = c(2, 3, 1), election.name = "elec", unit.name = "province") v3 <- convert_esaps(path = here::here(), file.name = list.files(pattern = "*.xlsx"), election.name = "year", unit.name = "country", M.name = "magnitude", seats = TRUE, allSheet = TRUE) ## End(Not run)
Electoral Disproportionality: Rae (1971), Loosemore and Hanby (1971), Lijphart (1986), Lijphart (1994), Gallagher (1991) and Cox and Shugart (1991).
dispro(tidy_data, method, scale = 1)
dispro(tidy_data, method, scale = 1)
tidy_data |
data.frame that contains the following variables with these names:
If the data is not structured in this way you can order it with: |
method |
Method to calculate electoral volatility:
|
scale |
By default it is |
data.frame.
Nicolas Schmidt [email protected]
votes <- data.frame(election = rep(c(2000, 2005), each = 4), unit = rep(c("ARG", "URY"), each = 4), party = c("party_A", "party_B","party_C","party_D"), votes = c(20, 30, 40, 10, 30, 35, 25, 10), seats = c(25, 20, 40, 15, 35, 30, 30, 5) ) dispro(votes, 1:6, 1) dispro(votes, 3) dispro(tidy_data = votes, method = 3:5) dispro(tidy_data = votes, method = c(1,3,6)) dispro(tidy_data = votes, method = c("Rae", "Gallagher"))
votes <- data.frame(election = rep(c(2000, 2005), each = 4), unit = rep(c("ARG", "URY"), each = 4), party = c("party_A", "party_B","party_C","party_D"), votes = c(20, 30, 40, 10, 30, 35, 25, 10), seats = c(25, 20, 40, 15, 35, 30, 30, 5) ) dispro(votes, 1:6, 1) dispro(votes, 3) dispro(tidy_data = votes, method = 3:5) dispro(tidy_data = votes, method = c(1,3,6)) dispro(tidy_data = votes, method = c("Rae", "Gallagher"))
The Effective Number of Parties (ENP) is an index developed by Laakso and Taagepera (1979) that allows to count the relevant parties in a party system. The formula consists on dividing one over the sum of the squares of the proportions (votes or seats) that the parties obtain in an electoral instance.
enp(tidy_data, enp_seats = FALSE, summary = FALSE)
enp(tidy_data, enp_seats = FALSE, summary = FALSE)
tidy_data |
data.frame that contains the following variables with these names:
If the data is not structured in this way you can order it with: |
enp_seats |
enp_seats = TRUE allows us to calculate jointly the effective number of electoral parties and in the congress. |
summary |
Summary of the data by unit, by default it is |
if summary = FALSE,
return data.frame.
if summary = TRUE
, return a list with two data.frame.
list[[1]]
Indicator
list[[2]]
Summary
min
variable 'election'
max
variable 'election'
number of elections
mean
indicator
Nicolas Schmidt [email protected]
votes <- data.frame(election = rep(c(2000, 2005), each = 4), unit = rep(c("ARG", "URY"), each = 4), party = c("party_A", "party_B","party_C","party_D"), votes = c(20, 20, 50, 10, 30, 35, 25, 10), seats = c(25, 25, 40, 10, 30, 30, 30, 10) ) enp(votes) enp(votes, enp_seats = TRUE) enp(votes, summary = TRUE)
votes <- data.frame(election = rep(c(2000, 2005), each = 4), unit = rep(c("ARG", "URY"), each = 4), party = c("party_A", "party_B","party_C","party_D"), votes = c(20, 20, 50, 10, 30, 35, 25, 10), seats = c(25, 25, 40, 10, 30, 30, 30, 10) ) enp(votes) enp(votes, enp_seats = TRUE) enp(votes, summary = TRUE)
Electoral volatility calculation: Pedersen (1979), Powell and Tucker (2014) and Torcal and Lago (2015).
evolat( tidy_data, method, threshold = 2, summary = FALSE, digits = 2, scale = 100 )
evolat( tidy_data, method, threshold = 2, summary = FALSE, digits = 2, scale = 100 )
tidy_data |
data.frame that contains the following variables with these names:
If the data is not structured in this way you can order it with: |
method |
Method to calculate electoral volatility:
|
threshold |
Minimum threshold for 'Type A' electoral volatility calculation (Powell and Tucker, 2014). By default is 2%. |
summary |
Summary of data by unit, by default it is |
digits |
integer indicating the number of decimal places to be used. |
scale |
By default it is |
if summary = FALSE,
return data.frame.
if summary = TRUE
, return a list with two data.frame.
list[[1]]
Indicator
list[[2]]
Summary by 'unit'
min
variable 'election'
max
variable 'election'
number of elections
mean
indicator
standard deviation
indicator
Nicolas Schmidt [email protected]
votes <- data.frame(election = rep(c(1995, 2000, 2005, 2010),4), unit = "ARG", party = rep(c("party_A","party_B","party_C","party_D"), each = 4), votes = c(30,30,20,20,30,50,40,30,30,10,30,25,10,10,10,25)) evolat(votes, 1) evolat(tidy_data = votes, method = 1, summary = TRUE)
votes <- data.frame(election = rep(c(1995, 2000, 2005, 2010),4), unit = "ARG", party = rep(c("party_A","party_B","party_C","party_D"), each = 4), votes = c(30,30,20,20,30,50,40,30,30,10,30,25,10,10,10,25)) evolat(votes, 1) evolat(tidy_data = votes, method = 1, summary = TRUE)
Party System Nationalization Score Mainwaring and Jones (2003) and Chhibber and Kollman (2004)
psns(tidy_data, method, pns = FALSE, scale = 100)
psns(tidy_data, method, pns = FALSE, scale = 100)
tidy_data |
data.frame that contains the following variables with these names:
If the data is not structured in this way you can order it with: |
method |
Method to calculate Party System Nationalization Score:
|
pns |
by default it is |
scale |
By default it is |
if pns = FALSE,
return data.frame.
if pns = TRUE
, return a list with two data.frame.
list[[1]]
PSNS: Party System Nationalization Score
list[[2]]
PNS: Party Nationalization Score
Nicolas Schmidt [email protected]
votes <- data.frame(election = rep(2000,4), unit = rep(c("District_1", "District_2"), each = 2), party = rep(c("party_A", "party_B"), 2), votes = c(0.60,0.40, 0.30, 0.70), votes_nac = rep(c(0.55,0.45),2) ) psns(tidy_data = votes, method = 1) psns(tidy_data = votes, method = 1, pns = TRUE)
votes <- data.frame(election = rep(2000,4), unit = rep(c("District_1", "District_2"), each = 2), party = rep(c("party_A", "party_B"), 2), votes = c(0.60,0.40, 0.30, 0.70), votes_nac = rep(c(0.55,0.45),2) ) psns(tidy_data = votes, method = 1) psns(tidy_data = votes, method = 1, pns = TRUE)