Package 'vottrans'

Title: Voter Transition Analysis
Description: Calculates voter transitions comparing two elections, using the function solve.QP() in package 'quadprog'.
Authors: Michael Gampmayer
Maintainer: Michael Gampmayer <[email protected]>
License: GPL-3
Version: 1.0
Built: 2024-11-13 06:16:17 UTC
Source: CRAN

Help Index


Voter Transfer Analysis

Description

Calculates the voter transfers between two elections

Details

Package: vottrans
Type: Package
Version: 1.0
Date: 2016-03-15
License: GPL-3

'Vottrans' calculates voter shifts between the partys comparing two elections. Rn is the matrix with the results of the first election in total. Ro the matrix with the results of the second one. The first columns must contain the respective numbers of eligible voters.

Author(s)

Michael Gampmayer

Maintainer: Michael Gampmayer <[email protected]>

Examples

data(X1) ## loading the example data of 2009

##    [,1]	 [,2]	 [,3]	[,4]	 [,5]	[,6]	[,7]
##  101131	21491	16006	7480	7095	2483	46576
##    4388	 1463	 1487	 290	 128	  80	  940
##    2658	  744	  940	 250	 124	  79	  521
##    1728	  484	  661	 154	  26	  25	  378   
##     ... 	  ...	  ...	 ...      ... 	 ...	  ...
 
data(Y1)  ## loading the example data of 2013

##    [,1]	 [,2] 	[,3]	 [,4]	[,5]   [,6]	[,7]
##   99723	15204	13755	9402	16147	4752	40463
##    4396	  979	 1240	 373	  479	 196	 1129
##    2744	  402	  771	 300	  497	 150	  624
##    1702	  308	  594	 195	  129	  71	  405
##     ...	  ...	  ...     ...	  ...	 ...      ...

vottrans(X1,Y1,v=1)  ## calculating the estimated voter transitions


##       [,1]           [,2]            [,3]           [,4]        [,5]             [,6]
##  5.171150e-01   -6.904960e-18   1.051492e-01   1.992879e-02    8.083999e-02   2.769671e-01
##  0.000000e+00   7.593029e-01   2.750599e-02   8.736985e-02    6.013103e-02   6.569028e-02
## -1.738393e-18  -2.520292e-18   8.263083e-01  -8.776092e-19    4.631644e-02   1.273753e-01
## -1.242397e-17   3.955979e-17  -1.412332e-17   1.000000e+00    5.387532e-18  -1.168024e-16
##  5.551115e-17    0.000000e+00  -8.729910e-18   8.325580e-01    1.674420e-01  -2.108759e-17
##  6.898481e-02    2.959417e-02   1.703398e-02   1.273023e-01    3.641480e-02   7.206699e-01

Voter Transfer Analysis

Description

Calculates the voter transfers between two elections

Usage

vottrans(Ro, Rn, v = 1, nw = FALSE)

Arguments

Ro

Matrix containing the results of the first election in total. The first column has to contain the number of eligible voters.

Rn

Matrix containing the results of the second election in total. The first column has to contain the number of eligible voters.

v

Specifies how the entries are weighted. Version 1 calculates with the percentage values, but weights the residuals with the number of eligible voters per municipalities. Version 2 uses the percentage values without any weight. Version 3 calculates with absolute figures without any weight. (Default: v=1)

nw

Specifies whether the difference in the numbers of eligible voters between the two elections is added to the nonvoters of the second election or not. (Default= FALSE)

Value

Returns a matrix containing the percentage of voter shifts. The voter shifts from party 1 to party 2 are found in entry a_1,2

Author(s)

Michael Gampmayer

Examples

data(X1) ## loading the example data of 2009

##    [,1]	 [,2]	 [,3]	[,4]	 [,5]	[,6]	[,7]
##  101131	21491	16006	7480	7095	2483	46576
##    4388	 1463	 1487	 290	 128	  80	  940
##    2658	  744	  940	 250	 124	  79	  521
##    1728	  484	  661	 154	  26	  25	  378   
##     ... 	  ...	  ...	 ...      ... 	 ...	  ...
 
data(Y1)  ## loading the example data of 2013

##    [,1]	 [,2] 	[,3]	 [,4]	[,5]   [,6]	[,7]
##   99723	15204	13755	9402	16147	4752	40463
##    4396	  979	 1240	 373	  479	 196	 1129
##    2744	  402	  771	 300	  497	 150	  624
##    1702	  308	  594	 195	  129	  71	  405
##     ...	  ...	  ...     ...	  ...	 ...      ...


vottrans(X1,Y1,v=1)  ## calculating the estimated voter transitions


##       [,1]           [,2]            [,3]           [,4]        [,5]             [,6]
##  5.171150e-01   -6.904960e-18   1.051492e-01   1.992879e-02    8.083999e-02   2.769671e-01
##  0.000000e+00   7.593029e-01   2.750599e-02   8.736985e-02    6.013103e-02   6.569028e-02
## -1.738393e-18  -2.520292e-18   8.263083e-01  -8.776092e-19    4.631644e-02   1.273753e-01
## -1.242397e-17   3.955979e-17  -1.412332e-17   1.000000e+00    5.387532e-18  -1.168024e-16
##  5.551115e-17    0.000000e+00  -8.729910e-18   8.325580e-01    1.674420e-01  -2.108759e-17
##  6.898481e-02    2.959417e-02   1.703398e-02   1.273023e-01    3.641480e-02   7.206699e-01

Example data X1

Description

The package includes the official results of the state elections in Salzburg of 2009 and 2013. X1 contains the results of the election of 2009, Y1 the results of the election of 2013. Load data(X1) and data(Y1); 'loesung(X1,Y1)' calculates the voter shifts between the parties of the two elections. The example data set X1 contains the results of the following parties: SPOE, OEVP, FPOE, GRUENE, BZOE, OTHERS, NONVOTERS. Each row contains the result of one of the 119 municipalities.

Usage

data(X1)

Source

http://www.salzburg.gv.at/20003stat/wahlen/ltw/index.htm#dl.5


Example Data Y1

Description

Official results of the state election in Salzburg 2013. The example dataset Y1 contains the results of the following parties: SPOE, OEVP, FPOE, GRUENE, TEAM, OTHERS, NONVOTERS. Each row contains the result of one of the 119 municipalities.

Usage

data(Y1)

Source

http://www.salzburg.gv.at/20003stat/wahlen/ltw/index.htm#dl.5