lphom {lphom} | R Documentation |
Implements lphom algorithm
Description
Estimates RxC (JxK) vote transfer matrices (ecological contingency tables) with lphom
Usage
lphom(
votes_election1,
votes_election2,
new_and_exit_voters = c("raw", "regular", "ordinary", "enriched", "adjust1", "adjust2",
"simultaneous", "semifull", "full", "fullreverse", "gold"),
apriori = NULL,
lambda = 0.5,
uniform = TRUE,
structural_zeros = NULL,
integers = FALSE,
verbose = TRUE,
solver = "lp_solve",
integers.solver = "symphony",
...
)
Arguments
votes_election1 |
data.frame (or matrix) of order IxJ1 with the votes gained by (or the counts corresponding to) the J1 political options competing (available) on election 1 (or origin) in the I units considered. In general, the row marginals of the I tables corresponding to the units. |
votes_election2 |
data.frame (or matrix) of order IxK2 with the votes gained by (or the counts corresponding to) the K2 political options competing (available) on election 2 (or destination) in the I (territorial) units considered. In general, the column marginals of the I tables corresponding to the units. |
new_and_exit_voters |
A character string indicating the level of information available
in |
apriori |
data.frame (or matrix) of order J0xK0 with an initial estimate of the
(row-standarized) global voter transition proportions/fractions, pjk0, between
the first J0 (election) options of election 1 and the first K0 (election) options
of election 2. This matrix can contain some missing values. When no a priori
information is available |
lambda |
A number between 0 and 1, informing the relative weight the user assigns to the
|
uniform |
A |
structural_zeros |
Default |
integers |
A |
verbose |
A |
solver |
A character string indicating the linear programming solver to be used, only
|
integers.solver |
A character string indicating the linear programming solver to be used for
approximating the LP solution to the closest integer solution.
Only |
... |
Other arguments to be passed to the function. Not currently used. |
Details
Description of the new_and_exit_voters
argument in more detail.
-
raw
: The default value. This argument accounts for the most plausible scenario when estimating vote transfer matrices. A scenario with two elections elapsed at least some months where only the raw election data recorded in the I (territorial) units, in which the electoral space under study is divided, are available. In this scenario, net exits and net entries are estimated according to equation (7) of Romero et al. (2020). When both net entries and exits are no null, constraint (15) of Pavia (2023) applies. If there are net exits anduniform = TRUE
either constraints (6) or (8) and (15) of Pavia (2023) are imposed. In this scenario, J could be equal to J1 or J1 + 1 and K equal to K2 or K2 + 1. -
regular
: This value accounts for a scenario with two elections elapsed at least some months where (i) the column J1 ofvotes_election1
corresponds to new young electors who have the right to vote for the first time, (ii) net exits and maybe other additional net entries are computed according to equation (7) of Romero et al. (2020), and (iii) we can (or not) assume that net exits impact equally all the first J1 - 1 options of election 1. When both net entries and exits are no null, constraints (13) and (15) of Pavia (2023) apply. Ifuniform = TRUE
and there are net exits either constraints (8) or (11) of Pavia (2023), depending on whether there are or not net entries, are also imposed. In this scenario, J could be equal to J1 or J1 + 1 and K equal to K2 or K2 + 1. Note that this scenario could be also used if column J1 ofvotes_election1
would correspond to immigrants instead of new young electors. -
ordinary
: This value accounts for a scenario with two elections elapsed at least some months where (i) the column K1 ofvotes_election2
corresponds to electors who died in the period between elections, (ii) net entries and maybe other additional net exits are computed according to equation (7) of Romero et al. (2020), and (iii) we can assume (or not) that exits impact equally all the J1 options of election 1. When both net entries and exits are no null, constraints (14) and (15) of Pavia (2023) apply and ifuniform = TRUE
either constraints (8) and (9) or, without net entries, (6) and (7) of Pavia (2023) are also imposed. In this scenario, J could be equal to J1 or J1 + 1 and K equal to K2 or K2 + 1. Note that this scenario could be also used if column K1 ofvotes_election2
would correspond to emigrants instead of deaths. -
enriched
: This value accounts for a scenario that somehow combineregular
andordinary
scenarios. We consider two elections elapsed at least some months where (i) the column J1 ofvotes_election1
corresponds to new young electors who have the right to vote for the first time, (ii) the column K2 ofvotes_election2
corresponds to electors who died in the interperiod election, (iii) other (net) entries and (net) exits are computed according to equation (7) of Romero et al. (2020), and (iv) we can assume (or not) that exits impact equally all the J1 - 1 options of election 1. When both net entries and exits are no null, constraints (12) to (15) of Pavia (2023) apply and ifuniform = TRUE
constraints (10) and (11) of Pavia (2023) are also imposed. In this scenario, J could be equal to J1 or J1 + 1 and K equal to K2 or K2 + 1. Note that this scenario could be also used if the column J1 ofvotes_election1
would correspond to immigrants instead of new young electors and/or if column K1 ofvotes_election2
would correspond to emigrants instead of deaths. -
adjust1
: This value accounts for a scenario with two elections elapsed at least some months where the census in each of the I polling units of the first election (the row-sums ofvotes_election1
) are proportionally adjusted to match the corresponding census of the polling units in the second election (the row-sums ofvotes_election2
). Ifintegers = TRUE
, each row invotes_election1
is proportionally adjusted to the closest integer vector whose sum is equal to the sum of the corresponding row invotes_election2
. -
adjust2
: This value accounts for a scenario with two elections elapsed at least some months where the census in each of the I polling units of the second election (the row-sums ofvotes_election2
) are proportionally adjusted to match the corresponding census of the polling units in the first election (the row-sums ofvotes_election1
). Ifintegers = TRUE
, each row invotes_election2
is adjusted to the closest integer vector whose sum is equal to the sum of the corresponding row invotes_election1
. -
simultaneous
: This is the value to be used in classical ecological inference problems, such as in ecological studies of racial voting, and in scenarios with two simultaneous elections. In this scenario, the sum by rows ofvotes_election1
andvotes_election2
must coincide. Constraints defined by equations (8) and (9) of Romero et al. (2020) are not included in the model. In this case, the lphom function just implements the basic model defined, for instance, by equations (1) to (5) of Pavia (2024). -
semifull
: This value accounts for a scenario with two elections elapsed at least some months, where: (i) the column J1 = J ofvotes_election1
totals new electors (young and immigrants) that have the right to vote for the first time and (ii) the column K2 = K ofvotes_election2
corresponds to total exits of the census lists (due to death or emigration). In this scenario, the sum by rows ofvotes_election1
andvotes_election2
must agree and constraint (15) of Pavia (2023) apply. Additionally, ifuniform = TRUE
constraints (8) of Pavia (2023) are also imposed. -
full
: This value accounts for a scenario with two elections elapsed at least some months, where (i) the column J - 1 ofvotes_election1
totals new young electors that have the right to vote for the first time, (ii) the column J (=J1) ofvotes_election1
measures new immigrants that have the right to vote and (iii) the column K (=K2) ofvotes_election2
corresponds to total exits of the census lists (due to death or emigration). In this scenario, the sum by rows ofvotes_election1
andvotes_election2
must agree and constraints (13) and (15) of Pavia (2023) apply. Additionally, ifuniform = TRUE
constraints (11) of Pavia (2023) are also imposed. -
fullreverse
: This value is somehow the mirror version offull
. It accounts for a scenario with two elections elapsed at least some months, where (i) the column J1 = J ofvotes_election1
totals new electors (young and immigrants) that have the right to vote for the first time and (ii) where total exits are separated out between exits due to emigration (column K - 1 ofvotes_election2
) and death (column K ofvotes_election2
). In this scenario, the sum by rows ofvotes_election1
andvotes_election2
must agree and constraints (14) and (15) of Pavia (2023) apply. Additionally, ifuniform = TRUE
constraints (8) and (9) of Pavia (2023) are also imposed. -
gold
: This value accounts for a scenario similar tofull
, where total exits are separated out between exits due to emigration (column K - 1 ofvotes_election2
) and death (column K ofvotes_election2
). In this scenario, the sum by rows ofvotes_election1
andvotes_election2
must agree. Constraints (12) to (15) of Pavia (2023) apply and ifuniform = TRUE
constraints (10) and (11) of Pavia (2023) are also imposed.
Value
A list with the following components
VTM |
A matrix of order J'xK' (where J'=J-1 or J and K'=K-1 or K) with the estimated percentages of row-standardized vote transitions from election 1 to election 2.
In |
VTM.votes |
A matrix of order J'xK' (where J'=J-1 or J and K'=K-1 or K) with the estimated vote transitions from election 1 to election 2.
In |
OTM |
A matrix of order KxJ with the estimated percentages of the origin of the votes obtained for the different options of election 2. |
HETe |
The estimated heterogeneity index defined in equation (11) of Romero et al. (2020). |
VTM.complete |
A matrix of order JxK with the estimated proportions of row-standardized vote transitions from election 1 to election 2.
In |
VTM.complete.votes |
A matrix of order JxK with the estimated vote transitions from election 1 to election 2.
In |
deterministic.bounds |
A list of two matrices of order JxK containing for each vote transition the lower and upper proportions allowed given the observed aggregates. |
inputs |
A list containing all the objects with the values used as arguments by the function. |
origin |
A matrix with the final data used as votes of the origin election after taking into account the level of information available regarding to new entries and exits of the election censuses between the two elections. |
destination |
A matrix with the final data used as votes of the origin election after taking into account the level of information available regarding to new entries and exits of the election censuses between the two elections. |
EHet |
A matrix of order IxK measuring in each spatial unit a distance to the homogeneity hypothesis. That is, the differences under the homogeneity hypothesis between the actual recorded results and the expected results in each territorial unit for each option of election 2. |
Author(s)
Jose M. Pavia, pavia@uv.es
Rafael Romero rromero@eio.upv.es
References
Romero, R, Pavia, JM, Martin, J and Romero G (2020). Assessing uncertainty of voter transitions estimated from aggregated data. Application to the 2017 French presidential election. Journal of Applied Statistics, 47(13-15), 2711-2736. doi:10.1080/02664763.2020.1804842
See Also
tslphom
nslphom
lclphom
rslphom
Other linear programing ecological inference functions:
lclphom()
,
lp_apriori()
,
lphom_dual()
,
lphom_joint()
,
nslphom_dual()
,
nslphom_joint()
,
nslphom()
,
rslphom()
,
tslphom_dual()
,
tslphom_joint()
,
tslphom()
Examples
lphom(France2017P[, 1:8] , France2017P[, 9:12], new_and_exit_voters= "raw")