eiopt2 {eiopt2}R Documentation

Ecological Inference for RxC Tables via Simultaneous Minimization of Euclidean Row-Standardized Unit-to-Global Distances

Description

Estimates RxC vote transfer matrices (ecological contingency tables) from aggregate data by simultaneously minimizing Euclidean row-standardized unit-to-global distances.

Usage

eiopt2(
  votes.election1,
  votes.election2,
  weights = "row",
  census.changes = c("adjust2", "raw", "simultaneous", "regular", "ordinary", "enriched",
    "adjust1", "semifull", "full", "fullreverse", "gold"),
  weights.init = "constant",
  eps = 1e-04,
  ilack.max = 1,
  trace = FALSE,
  kkt2.check = FALSE,
  ...
)

Arguments

votes.election1

data.frame (or matrix) of order NxR1 with the votes gained by (or the counts corresponding to) the R1 (row options) political options competing (available) on election 1 (or origin) in the N units considered. In general, the row margins of the N tables corresponding to the units.

votes.election2

data.frame (or matrix) of order NxC2 with the votes gained by (or the counts corresponding to) the C2 (column options) political options competing (available) on election 2 (or destination) in the N units considered. In general, the column margins of the N tables corresponding to the units.

weights

Weights to be used to ponder in the restricted minimization problem the distances between row-standardized proportions of individual units and the global row-standardized proportions. weights can be provided as a vector of length N, a matrix of order NxR (or order NxR1), or a character string from the set {"constant", "size", "row"}. When weights is a vector of length N, all the proportions of unit i are weighted by the ith coordinate of weights. For instance, weights = "size" assigns the number of votes in each unit as weight. When weights is a matrix of size NxR, the rth row of the ith unit receives as weight the (i,r) cell of the matrix. For instance, weights = "row" is equivalent to defining weights as the matrix votes.election1. When weights = "constant" all the proportions are assigned equal weight. Default, "row".

census.changes

A character string informing about the level of information available in votes.election1 and votes.election2 regarding new entries and exits of the election censuses between the two elections or indicating how their sum discrepancies should be handled. This argument allows eleven options; the eight options discussed in Pavia (2023) as well as two adjusting options and the mirror option of full. The options are: adjust2, raw, simultaneous, regular, ordinary, adjust1, enriched, semifull, full, fullreverse and gold. See Details. Default, adjust2.

weights.init

Weights to be used to estimate the initial crude table of global proportions using quadratic programming. These weights ponder the unit residuals between the observed column margin votes and the expected column margin votes when the estimated global row-standardized proportions are applied to the observed row margins. The value of this argument is typically a character string chosen from the set {"constant", "size", "row"}. Default, weights.init = "constant". When weights.init = "constant", unit residuals are not weighted. When weights.init = "size", each unit residual is weighted with the number of eligible voters of the unit. When weights.init = "row", global row-standardized proportions are estimated using absolute number of votes without any weight. weights.init = "size" is used when weights.init is the vector defined in weights and weights.init = "row" when weights.init is the matrix defined in weights.

eps

A positive real number indicating the tolerance for convergence of outer iterations of the barrier and/or augmented Lagrangian algorithm to be used for the function auglag of the package alabama on which this function relies on. Default, 1e-4.

ilack.max

A positive integer number indicating the maximum number of outer iterations where no change in parameters is tolerated to be used for the function auglag of the package alabama on which this function relies on. The larger this number the most computational cost. Default, 1.

trace

A TRUE/FALSE logical variable indicating whether information on outer iterations should be printed out. to be used for the function auglag of the package alabama on which this function relies on. If TRUE, at each outer iteration information is displayed on: (i) how well the equality constraints are satisfied, (ii) current parameter values, and (iii) current objective function value. Default, FALSE.

kkt2.check

A TRUE/FALSE logical variable indicating whether the second-order Karush-Kuhn-Tucker conditions should be checked. Default is FALSE.

...

Other arguments to be passed to the function. Not currently used.

Details

Description of the census.changes argument in more detail.

Value

A list with the following components

VTM

A matrix of order RxC with the estimated proportions of the row-standardized vote transitions from election 1 to election 2. In raw, regular, ordinary and enriched scenarios, this matrix includes the row and the column corresponding to net entries and net exits (when they are present).

VTM.votes

A matrix of order RxC with the estimated vote transfers from election 1 to election 2. In raw, regular, ordinary and enriched scenarios, this matrix includes the row and the column corresponding to net entries and net exits (when they are present).

VTM.units

An array of order RxCxN with the estimated proportions of the row-standardized vote transitions from election 1 to election 2 attained for each unit. In raw, regular, ordinary and enriched scenarios, each unit matrix includes the row and the column corresponding to net entries and net exits (when they are present).

VTM.votes.units

An array of order RxCxN with the estimated transfer of votes from election 1 to election 2 attained for each unit. In raw, regular, ordinary and enriched scenarios, each unit matrix includes the row and the column corresponding to net entries and net exits (when they are present).

VTM.initial.global

The matrix of order RxC obtained by aggregating across units the initial estimated matrix of row-standardized vote transitions from election 1 to election 2 used as starting points of the iterative process. In raw, regular, ordinary and enriched scenarios, this matrix includes the row and the column corresponding to net entries and net exits (when they are present).

VTM.crude.global

The matrix of order RxC of estimated proportions for the row-standardized vote transitions from election 1 to election 2 in the whole space attained using quadratic programming. In raw, regular, ordinary and enriched scenarios, this matrix includes the row and the column corresponding to net entries and net exits (when they are present).

VTM.initial.units

An array of order RxCxN with, by layer, the initial estimated matrices of row-standardized vote transitions from election 1 to election 2 used as starting points of the iterative process. In raw, regular, ordinary and enriched scenarios, each unit matrix includes the row and the column corresponding to net entries and net exits (when they are present).

VTM.initial.votes.units

An array of order RxCxN with, by layer, the initial estimated matrices of vote transfers from election 1 to election 2. In raw, regular, ordinary and enriched scenarios, this matrix includes the row and the column corresponding to net entries and net exits (when they are present).

iter

The number of iterations employed.

inputs

A list containing all the objects with the values used as arguments by the function.

Author(s)

Jose M. Pavia pavia@uv.es

Victor Fernandez victor.fernandez@uv.es

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 <- eiopt2(votes1, votes2)$VTM


votes1b <- structure(list(P1 = c(16L, 4L),
                          P2 = c(8L, 3L)),
                     row.names = c(NA, 2L),
                     class = "data.frame")
votes2b <- structure(list(C1 = c(10L, 10L),
                          C2 = c(7L, 4L)),
                     row.names = c(NA, 2L),
                     class = "data.frame")
example2 <- eiopt2(votes1b, votes2b)$VTM


[Package eiopt2 version 0.1.1-6 Index]