evolat: Electoral volatility calculation

Description Usage Arguments Value Author(s) Examples

View source: R/evolat.R

Description

Electoral volatility calculation: Pedersen (1979), Powell and Tucker (2014) and Torcal and Lago (2015).

Usage

1
2
3
4
5
6
7
8
evolat(
  tidy_data,
  method,
  threshold = 2,
  summary = FALSE,
  digits = 2,
  scale = 100
)

Arguments

tidy_data

data.frame that contains the following variables with these names:

  • election: year of election.

  • unit: the unit of analysis (province, department ...)

  • party: name of the political parties that obtain votes.

  • votes: votes obtained by each party.

  • M: magnitude of the district. Only if the method = 3. It refers to the M + 1 rule (only 'M' must be loaded).

If the data is not structured in this way you can order it with: convert_esaps.

method

Method to calculate electoral volatility:

  • method = "Pedersen" or method = 1.

  • method = "Powell and Tucker" or method = 2.

  • method = "Torcal and Lago" or method = 3.

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 FALSE.

digits

integer indicating the number of decimal places to be used.

scale

By default it is 100, the indices will vary between 0 and 100. If scale = 1 the variation will be between 0 and 1.

Value

if summary = FALSE, return data.frame.

if summary = TRUE, return a list with two data.frame.

Author(s)

Nicolas Schmidt nschmidt@cienciassociales.edu.uy

Examples

1
2
3
4
5
6
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)

esaps documentation built on Sept. 14, 2021, 1:07 a.m.