Author: Miguel Rodriguez
Date: 2020-06-13

# Electoral Volatility

#### Miguel Rodriguez

#### 2020-06-13

# Introduction.

Another of the electoral dimensions that acquires special relevance in the electoral studies is the one known as volatility. Basically, what it tries to measure is how the electoral behavior of the voters changes from one electoral process to another and, in short, the level of fidelity of the voters in relation to their democratically elected representatives. Once the concept is defined, the difficulty comes in the way of measuring it, given the wide field that we want to cover with this dimension.

In 1979 it was Pederson who proposed the formula that allows its calculation and whose mathematical expression is the following:

\[VT=\frac{1}{2}\sum_{i=1}^{n}\left|\triangle p_{i}\right| \] Where \(\triangle p_{i}\) denotes the increase or decrease of electoral support between two elections expressed as a percentage of the vote.

Although there are other different approaches that seek to measure that magnitude as well. In this sense, the individual measurement of the change in the vote of each voter can also be done [^1](In this case, a totally disaggregated volatility would be calculated where the changes in the tendency of the electorate would be clearly manifested. The difficulty in this case would come from the impossibility of obtaining this information at this level of detail, since to achieve this objective it would be necessary to carry out a complete census, requiring a disproportionate effort to achieve the set objective). To get closer to this ideal situation, it would be possible to perform surveys that would give us an approximation of the problem. One of the statistical studies that could provide us with this information can be found in the opinion barometers that the Spanish Sociological Research Centre (CIS) periodically publishes (Spanish Sociological Research Centre ), which usually include a question about the informant’s voting intention and which political party he/she voted for in previous elections. With sufficient caution, and even if it is only to obtain an estimated value of the reality to be measured, it would be possible to cross these two variables and in this way obtain an approximation of the volatility of the electorate at individual level.

As explained by Oñate and Ocaña (1999), aggregate volatility (VT) has subsequently been broken down into two other components, which clarify and complement the possible conclusions that can be drawn from aggregate volatility. On the one hand, there is the volatility between blocks (VB), which tries to measure how the vote has changed between two ideological blocks (such as right-left, or even center-periphery). The measurement of this magnitude is performed by means of the following formula:

\[VB=\frac{\left|\triangle p_{i}+...+\triangle p_{k}\right|}{2}+\frac{\left|\triangle p_{x}+...\triangle p_{z}\right|}{2} \] Indicating with i…k the parties classified within a block and with x…z those corresponding to the other block.

The other component of the total or aggregate volatility is called Intrablock Volatility (VIB), which attempts to measure the changes in electoral or parliamentary support within each ideological block considered. The way to calculate its value is through the expression: \[ VIB = VT -VB \]

# Volatility calculation.

The computation of these indicators is not easy to obtain and, since it involves the comparison of two electoral processes, it is necessary to have data that allows the comparison between the two processes considered. In order to establish this relationship between the two processes, the following aspects must be taken into account:

- The parties or groupings of parties must be linked between the two time periods.
- There may be parties that are only present in one period, either because they disappear or are newly created.
- A party or coalition may disaggregate into other groups between the two time periods.

In the Relectoral package the function called volatilidad() has been implemented, which has a parameter called enlace and it is the one that refers to a data.frame that contains the data that will allow to make comparisons between the two different electoral processes, whose structure is going to be described later.

The parameters to be provided to the volatilidad() function are the following:

1.- A data.frame made up of two columns. The first contains the names of the parties and the second the votes/seats. This information refers to the first comparison period. If votes are provided, the electoral volatility will be obtained, and if seats are provided, the parliamentary volatility will be obtained.

2.- A second data.frame made up of two columns. The first contains the names of the parties and the second the votes/seats. The data will correspond to the results obtained in the second election under comparison.

3.- A third data.frame that will serve as a link between the two previous ones. Its generic name is enlace, and since its structure is more complex, we will now proceed to give a more detailed description of it.

To try to explain better how the structure of the data.frame referenced in the enlace parameter should be, the following figure has been created, which aims to clarify completely how it should look like.

Fichero de enlace

As it can be see, the format of this data.frame can be divided into four sections. The first section consists of the names of the parties or electoral groups. The second section is made up of 10 columns with “p1_i” names for i=1,2,…10. The third section is also made up of other columns with the names ‘p2_i’ for i=1,2,…,10, and the last section is made up of a single column with the name ‘bloque’ and must contain the values ‘D’ (first letter of the word ‘Right’ in Spanish) or ‘I’ (first letter of the word ‘Left’ in Spanish) to indicate that the party in the first column belongs to the ideological right-wing group (‘D’) or left-wing group (‘I’).

The two central sections are those that identify and relate the votes/seats of both electoral processes, for the same political party or group of parties in the following way. In the left zone, the number(s) of the records of the first data.frame that are going to be taken into account to link with the numbers of the records that appear in the right zone for the same row. When the 10 columns enabled for this purpose are not required, the remaining columns are filled with zeros.

For example, in the figure above the first row, corresponding to the “PSOE” party, indicates that the first row of the first data.frame must be linked to the first row of the second data.frame. In the case of the “Cs” party, it is indicated that the third row of the first data.frame must be linked to the fifth row of the second data.frame. The case of “PODEMOS_EU” indicates a special treatment, as it is indicated that the votes/seats in rows 12 and 25 of the first data.frame are added together, and then compared with the data in row 14 of the second data.frame.

As at the end of these links not all the parties will be linked, a kind of “Others” group will be created with two records added and called, for example, “resto_I” and “resto_D” (these would be the names to be placed in the first column), in such a way that the first one includes parties of ideology from block ´“I” and the second party of ideologies from block “D”. Then, in each information section, the numbers of the records of these parties not linked in the way indicated above would be pointed out and in this way these unlinked of parties would be grouped, which on the other hand will have little or no relevance for the calculation of the volatility sought, since the votes obtained would be few, and therefore the number of seats would be zero.

# Example of use.

This example will calculate the estimated volatility between the April and May elections held in Spain to choose the 350 deputies that make up the Spanish Congress.

To obtain these results, the first thing we must have is the total number of votes or seats of each of the parties that took part in that election. To obtain this data, it has been used the resources provided free of charge by the Spanish Ministry of Home Office (MIR). This data can be downloaded via this link http://www.infoelectoral.mir.es/infoelectoral/min/. In that page you must choose each of the two elections indicated above.

This way, two Excell files will be downloaded (in order to be able to read them in R, they have been converted to files with extension .xlsx), which can be imported into R with the following commands:

    if (!require("readxl")) install.packages("readxl");require("readxl")
    #> Loading required package: readxl
    dat1<-read_xlsx("../inst/data_raw/volatilidad/abril_19.xlsx",col_names = TRUE)
    dat2<-read_xlsx("../inst/data_raw/volatilidad/noviembre_19.xlsx",col_names = TRUE)

And if we look at the first data in one of these files, we can see the following:

    head(dat1)
    #> # A tibble: 6 x 7
    #>   Siglas  Candidatura     Votos `% válidos` `% censo` `% candidaturas` Diputados
    #>   <chr>   <chr>           <dbl>       <dbl>     <dbl>            <dbl>     <dbl>
    #> 1 PSOE    PARTIDO SOCIA~ 7.51e6      0.287     0.204            0.289        123
    #> 2 PP      PARTIDO POPUL~ 4.37e6      0.167     0.118            0.168         66
    #> 3 Cs      CIUDADANOS-PA~ 4.16e6      0.159     0.113            0.160         57
    #> 4 PODEMO~ UNIDAS PODEMOS 2.90e6      0.111     0.0785           0.111         33
    #> 5 VOX     VOX            2.69e6      0.103     0.0729           0.103         24
    #> 6 ERC-SO~ ESQUERRA REPU~ 1.02e6      0.0389    0.0277           0.0392        15

Now with each of these files, you must obtain the total votes of each party (if you want the electoral version) or the total number of seats obtained (if you prefer the parliamentary version). In the case of the electoral version, the following data will be obtained:

Ahora con cada uno de estos ficheros, se deben obtener el total de votos de cada partido (si se quiere la versión electoral), o el total de escaños conseguidos ( si se quiere la versión parlamentaria ). Para el caso de la versión electoral, se obtendrán los siguientes datos:

    dat1_electoral<-dat1[,c(1,3)]
    dat2_electoral<-dat2[,c(1,3)]

In case you want to get the parliamentary version of the index, the following data should be taken into account:

    dat1_parlamentaria<-dat1[,c(1,7)]
    dat2_palamentaria<-dat2[,c(1,7)]

And now it remains to generate the file called enlace, with the structure that has already been commented on in the previous section. The truth is that this is the most delicate part when calculating this indicator. In this specific case, the file that has been taken into account for this example is shown below, and for purely didactic reasons, it is shown entirely.

    enlace <- read.csv("../inst/data_raw/volatilidad/abril_noviembre_2019.csv",
                       header = TRUE,sep=";", stringsAsFactors = FALSE)
    enlace
    #>      denominacion p1_1 p1_2 p1_3 p1_4 p1_5 p1_6 p1_7 p1_8 p1_9 p1_10 p2_1 p2_2
    #> 1            PSOE    1    0    0    0    0    0    0    0    0     0    1    0
    #> 2              PP    2    0    0    0    0    0    0    0    0     0    2    0
    #> 3              Cs    3    0    0    0    0    0    0    0    0     0    5    0
    #> 4         PODEMOS    4    0    0    0    0    0    0    0    0     0    4    0
    #> 5             VOX    5    0    0    0    0    0    0    0    0     0    3    0
    #> 6             ERC    6    0    0    0    0    0    0    0    0     0    6    0
    #> 7             ECP    7    0    0    0    0    0    0    0    0     0    7    0
    #> 8           JxCAT    8    0    0    0    0    0    0    0    0     0    8    0
    #> 9         EAJ_PNV    9    0    0    0    0    0    0    0    0     0    9    0
    #> 10          PACMA   10    0    0    0    0    0    0    0    0     0   13    0
    #> 11       EH_Bildu   11    0    0    0    0    0    0    0    0     0   11    0
    #> 12     PODEMOS_EU   12   25    0    0    0    0    0    0    0     0   14    0
    #> 13      COMPROMIS   13    0    0    0    0    0    0    0    0     0   15    0
    #> 14            CCA   14   20    0    0    0    0    0    0    0     0   16    0
    #> 15            NA+   16    0    0    0    0    0    0    0    0     0   18    0
    #> 16            BNG   17    0    0    0    0    0    0    0    0     0   17    0
    #> 17            PRC   18    0    0    0    0    0    0    0    0     0   19    0
    #> 18  RECORTES_CERO   19    0    0    0    0    0    0    0    0     0   21    0
    #> 19   MES_ESQUERRA   22    0    0    0    0    0    0    0    0     0   25    0
    #> 20           GBAI   23    0    0    0    0    0    0    0    0     0   29    0
    #> 21          PUM+J   24    0    0    0    0    0    0    0    0     0   22    0
    #> 22           PCTE   26    0    0    0    0    0    0    0    0     0   28    0
    #> 23           AXSI   28    0    0    0    0    0    0    0    0     0   26    0
    #> 24           PCOE   29    0    0    0    0    0    0    0    0     0   31    0
    #> 25           PCPE   30    0    0    0    0    0    0    0    0     0   27    0
    #> 26    AVANT-ADELA   31    0    0    0    0    0    0    0    0     0   36    0
    #> 27             EB   32    0    0    0    0    0    0    0    0     0   33    0
    #> 28            CpM   33    0    0    0    0    0    0    0    0     0   32    0
    #> 29    SOMOS-REGIO   34    0    0    0    0    0    0    0    0     0   41    0
    #> 30             PH   36    0    0    0    0    0    0    0    0     0   38    0
    #> 31 UIG_SOM_CUIDES   37    0    0    0    0    0    0    0    0     0   40    0
    #> 32           ERPV   38    0    0    0    0    0    0    0    0     0   34    0
    #> 33           IZQP   39    0    0    0    0    0    0    0    0     0   42    0
    #> 34 AHORA_CANARIAS   41    0    0    0    0    0    0    0    0     0   43    0
    #> 35           PPSO   43    0    0    0    0    0    0    0    0     0   46    0
    #> 36         PREPAL   45    0    0    0    0    0    0    0    0     0   52    0
    #> 37          P_LIB   48    0    0    0    0    0    0    0    0     0   49    0
    #> 38           PYLN   52    0    0    0    0    0    0    0    0     0   55    0
    #> 39            FIA   53    0    0    0    0    0    0    0    0     0   60    0
    #> 40        FE_JONS   54    0    0    0    0    0    0    0    0     0   53    0
    #> 41            DPL   57    0    0    0    0    0    0    0    0     0   64    0
    #> 42    UNION-REGIO   58    0    0    0    0    0    0    0    0     0   58    0
    #> 43      CENTRADOS   59    0    0    0    0    0    0    0    0     0   63    0
    #> 44           IZAR   63    0    0    0    0    0    0    0    0     0   65    0
    #> 45           RISA   64    0    0    0    0    0    0    0    0     0   62    0
    #> 46            C21   65    0    0    0    0    0    0    0    0     0   66    0
    #> 47            UDT   67    0    0    0    0    0    0    0    0     0   67    0
    #> 48       FEMINSTA   55    0    0    0    0    0    0    0    0     0   39    0
    #> 49        RESTO_I   15   27   35   40   42   44   46   47   49    51   10   12
    #> 50        RESTO_D    0    0    0    0    0    0    0    0    0     0   35    0
    #>    p2_3 p2_4 p2_5 p2_6 p2_7 p2_8 p2_9 p2_10 bloque
    #> 1     0    0    0    0    0    0    0     0      I
    #> 2     0    0    0    0    0    0    0     0      D
    #> 3     0    0    0    0    0    0    0     0      D
    #> 4     0    0    0    0    0    0    0     0      I
    #> 5     0    0    0    0    0    0    0     0      D
    #> 6     0    0    0    0    0    0    0     0      I
    #> 7     0    0    0    0    0    0    0     0      I
    #> 8     0    0    0    0    0    0    0     0      D
    #> 9     0    0    0    0    0    0    0     0      D
    #> 10    0    0    0    0    0    0    0     0      I
    #> 11    0    0    0    0    0    0    0     0      I
    #> 12    0    0    0    0    0    0    0     0      I
    #> 13    0    0    0    0    0    0    0     0      I
    #> 14    0    0    0    0    0    0    0     0      D
    #> 15    0    0    0    0    0    0    0     0      D
    #> 16    0    0    0    0    0    0    0     0      I
    #> 17    0    0    0    0    0    0    0     0      D
    #> 18    0    0    0    0    0    0    0     0      I
    #> 19    0    0    0    0    0    0    0     0      I
    #> 20    0    0    0    0    0    0    0     0      I
    #> 21    0    0    0    0    0    0    0     0      I
    #> 22    0    0    0    0    0    0    0     0      I
    #> 23    0    0    0    0    0    0    0     0      I
    #> 24    0    0    0    0    0    0    0     0      I
    #> 25    0    0    0    0    0    0    0     0      I
    #> 26    0    0    0    0    0    0    0     0      I
    #> 27    0    0    0    0    0    0    0     0      I
    #> 28    0    0    0    0    0    0    0     0      I
    #> 29    0    0    0    0    0    0    0     0      I
    #> 30    0    0    0    0    0    0    0     0      I
    #> 31    0    0    0    0    0    0    0     0      I
    #> 32    0    0    0    0    0    0    0     0      I
    #> 33    0    0    0    0    0    0    0     0      I
    #> 34    0    0    0    0    0    0    0     0      I
    #> 35    0    0    0    0    0    0    0     0      I
    #> 36    0    0    0    0    0    0    0     0      I
    #> 37    0    0    0    0    0    0    0     0      I
    #> 38    0    0    0    0    0    0    0     0      I
    #> 39    0    0    0    0    0    0    0     0      I
    #> 40    0    0    0    0    0    0    0     0      D
    #> 41    0    0    0    0    0    0    0     0
    #> 42    0    0    0    0    0    0    0     0      I
    #> 43    0    0    0    0    0    0    0     0
    #> 44    0    0    0    0    0    0    0     0      I
    #> 45    0    0    0    0    0    0    0     0      I
    #> 46    0    0    0    0    0    0    0     0
    #> 47    0    0    0    0    0    0    0     0
    #> 48    0    0    0    0    0    0    0     0      I
    #> 49   20   23   24   30   37   44   45    47      I
    #> 50    0    0    0    0    0    0    0     0      D

To help in the generation of this .csv file, what it has been done first is to build this structure in an Excel spreadsheet and then export it to this csv file.

Now all the ingredients are in place to calculate the volatilities. We start with the electoral volatility and for this purpose the following code has been executed.

    # Loading Relectoral package
    if (!require("Relectoral")) install.packages("Relectoral"); require("Relectoral")
    #> Loading required package: Relectoral
    s<-volatilidad(dat1_electoral,dat2_electoral,enlace)

Then, the total volatility will be:

    s$Total
    #> [1] 12.23833

While the volatility between blocks will be the following:

    s$Entre
    #> [1] 0.1692789

Finally, the intrablock volatility, as indicated above, will be obtained from the difference of these two figures.

For the calculation of parliamentary volatility, the process is similar and would be as follows:

    s1<-volatilidad(dat1_parlamentaria,dat2_palamentaria,enlace)
    s1$Total
    #> [1] 16.85714
    s1$Entre
    #> [1] 1.428571