ecolRxC {ecolRxC} | R Documentation |
Ecological Inference of RxC Tables by Latent Structure Approaches
Description
Estimates JxK (RxC) vote transfer matrices (ecological contingency tables) based on Thomsen (1987) and Park (2008) approaches.
Usage
ecolRxC(
votes.election1,
votes.election2,
scale = "probit",
method = "Thomsen",
local = TRUE,
census.changes = c("adjust", "raw", "regular", "ordinary", "enriched",
"simultaneous", "semifull", "full", "gold"),
reference = NULL,
confidence = NULL,
B = 500,
Yule.aprox = FALSE,
tol = 1e-06,
...
)
Arguments
votes.election1 |
data.frame (or matrix) of order IxJ1 with the votes gained by (or the counts corresponding to) the J1 (social classes) political options competing (available) on election 1 (or origin) in the I units considered. |
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. |
scale |
A character string indicating the type of transformation to be applied to the vote
fractions for applying ecological inference. Only |
method |
A character string indicating the algorithm to be used for adjusting (making congruent with
the observed margins) the initial crude fractions attained in a 2x2 fashion.
Only |
local |
A TRUE/FALSE argument indicating whether local solutions (solutions for each polling unit)
must be computed. In that case, the global solution is attained as composition/aggregation
of local solutions. When |
census.changes |
A character string informing about the level of information available
in |
reference |
A vector of two components indicating (parties) options in election 1
and 2, respectively, to be used as reference with |
confidence |
A number between 0 and 1 to be used as level of confidence for the
confidence intervals of the transition rates. By default |
B |
An integer indicating the number of samples to be drawn from each crude estimated
confidence interval for estimating final confidence intervals when either
R (J) or C (K) is higher than two. This is not relevant for the 2x2 case.
It can take a while to compute confidence intervals, mainly when |
Yule.aprox |
|
tol |
A number indicating the level of precision to be used to stop the
adjustment of initial/crude count estimates reached using a 2x2 approach in a
general RxC case. This is not relevant for the 2x2 case. Default, |
... |
Other arguments to be passed to the function. Not currently used. |
Details
Description of the census.changes
argument in more detail.
adjust
: The default value. This is the simplest solution for handling discrepancies between the total number of counts for the first and second elections. With this value the J1 column-aggregations of the counts invotes.election1
of the first election are proportionally adjusted to equal the aggregation of the counts invotes.election2
of the second election. In this scenario, J is equal to J1 and K equal to K2.raw
: This argument accounts for 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 and net entries and net exits are approached from the available information. In this scenario, net exits and net entries are estimated according to Pavia (2022). When both net entries and exits are no null, constraint (15) of Pavia (2022) applies: no transfer between entries and exits are allowed. In this scenario, J could be equal to J1 or J1 + 1 and K equal to K2 or K2 + 1.simultaneous
: This is the value to be used in classical ecological inference problems, such as in ecological studies of social or racial voting, and in scenarios with two simultaneous elections. In this scenario, the sum by rows ofvotes.election1
andvotes.election2
must coincide.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 Pavia (2022). When both net entries and exits are no null, constraints (13) and (15) of Pavia (2022) apply. In this scenario, J could be equal to J1 or J1 + 1 and K equal to K2 or K2 + 1.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 interperiod election, (ii) net entries and maybe other additional net exits are computed according to Pavia (2022). When both net entries and net exits are no null, constraints (14) and (15) of Pavia (2022) apply. In this scenario, J could be equal to J1 or J1 + 1 and K equal to K2 or K2 + 1.enriched
: This value accounts for a scenario that somewhat 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 Pavia (2022). When both net entries and net exits are no null, constraints (12) to (15) of Pavia (2022) apply. In this scenario, J could be equal to J1 or J1 + 1 and K equal to K2 or K2 + 1.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 in each polling unit 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 (2022) apply.full
: This value accounts for a scenario with two elections elapsed at least some months, where J = J1, K = K2 and (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 ofvotes.election1
measures new immigrants that have the right to vote and (iii) the column 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 constraints (13) and (15) of Pavia (2022) apply.gold
: This value accounts for a scenario similar tofull
, where J = J1, K = K2 and 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 (2022) apply.
Value
A list with the following components
VTM |
A matrix of order JxK (RxC) with the estimated proportions of the row-standardized vote transitions from election 1 to election 2.
In |
VTM.votes |
A matrix of order JxK (RxC) with the estimated vote transfers from election 1 to election 2.
In |
VTM.global |
A matrix of order JxK (RxC) with the estimated proportions of the row-standardized vote transitions from election 1 to election 2,
attained directly from the global (whole electoral space) proportions. When |
VTM.votes.global |
A matrix of order JxK (RxC) with the estimated vote transfers from election 1 to election 2,
attained directly from the global proportions. When |
VTM.lower |
A matrix of order JxK (RxC) with the estimated lower limits of the confidence intervals for
the proportions of the row-standardized vote transitions from election 1 to election 2.
In |
VTM.upper |
A matrix of order JxK (RxC) with the estimated upper limits of the confidence intervals for
the proportions of the row-standardized vote transitions from election 1 to election 2.
In |
VTM.crude.global |
A matrix of order JxK (RxC) with the (inconsistent) crude estimated proportions for the row-standardized
vote transitions from election 1 to election 2 in the whole space attained in a 2x2 fashion before making them
consistent using the iterative proportional fitting algorithm or the Thomsen iteratuve algortihm.
In |
VTM.units |
An array of order JxKxI (RxCxI) with the estimated proportions of the row-standardized vote transitions from election 1 to election 2
attained for each unit. When |
VTM.votes.units |
An array of order JxKxI (RxCxI) with the estimated transfer of votes from election 1 to election 2
attained for each unit. When |
VTM.lower.units |
An array of order JxKxI (RxCxI) with the estimated lower limits of the confidence intervals for
the proportions of the row-standardized vote transitions from election 1 to election 2 corresponding to each unit.
When either |
VTM.upper.units |
An array of order JxKxI (RxCxI) with the estimated upper limits of the confidence intervals for
the proportions of the row-standardized vote transitions from election 1 to election 2 corresponding to each unit.
When either |
VTM.crude.units |
An array of order JxKxI (RxCxI) with the (inconsistent) crude estimated proportions of the row-standardized vote transitions from election 1 to election 2
attained for each unit in a 2x2 fashion before making them consistent using the iterative proportional fitting algorithm or the Thomsen iterative algorithm.
When |
correlations |
A matrix of order JxK (Rxc) with the across units correlations between options for the proportions in the transformed scale. |
reference.outputs |
A list with three components: |
iter |
A vector of either length 1 (when |
inputs |
A list containing all the objects with the values used as arguments by the function. |
Note
This function somewhere builds on the .ado (STATA) functions written by Won-ho Park, in 2002.
Author(s)
Jose M. Pavia, pavia@uv.es
References
Achen, C.H. (2000). The Thomsen Estimator for Ecological Inference (Unpublished manuscript). University of Michigan.
Park, W.-H. (2008). Ecological Inference and Aggregate Analysis of Elections. PhD Dissertation. University of Michigan.
Pavia, J.M. (2022). Adjustment of initial estimates of voter transition probabilities to guarantee consistency and completeness.
Thomsen, S.R. (1987). Danish Elections 1920-79: a Logit Approach to Ecological Analysis and Inference. Politica, Aarhus, Denmark.
Examples
votes1 <- structure(list(P1 = c(16L, 4L, 13L, 6L, 1L, 16L, 6L, 17L, 48L, 14L),
P2 = c(8L, 3L, 0L, 5L, 1L, 4L, 7L, 6L, 28L, 8L),
P3 = c(38L, 11L, 11L, 3L, 13L, 39L, 14L, 34L, 280L, 84L),
P4 = c(66L, 5L, 18L, 39L, 30L, 57L, 35L, 65L, 180L, 78L),
P5 = c(14L, 0L, 5L, 2L, 4L, 21L, 6L, 11L, 54L, 9L),
P6 = c(8L, 2L, 5L, 3L, 0L, 7L, 7L, 11L, 45L, 17L),
P7 = c(7L, 3L, 5L, 2L, 3L, 17L, 7L, 13L, 40L, 8L)),
row.names = c(NA, 10L), class = "data.frame")
votes2 <- structure(list(C1 = c(2L, 1L, 2L, 2L, 0L, 4L, 0L, 4L, 19L, 14L),
C2 = c(7L, 3L, 1L, 7L, 2L, 5L, 3L, 10L, 21L, 6L),
C3 = c(78L, 7L, 28L, 42L, 28L, 84L, 49L, 85L, 260L, 100L),
C4 = c(56L, 14L, 20L, 7L, 19L, 54L, 22L, 50L, 330L, 91L),
C5 = c(14L, 3L, 6L, 2L, 3L, 14L, 8L, 8L, 45L, 7L)),
row.names = c(NA, 10L), class = "data.frame")
example <- ecolRxC(votes1, votes2, method = "IPF")$VTM