simula_BPF {eiCircles}R Documentation

Simulate RxC Tables from Overdispersed-Multinomial Models

Description

Generates at random a set of RxC tables with the joint distribution of voters in two elections according to the model proposed in Forcina et al. (2012), as extension of Brown and Payne (1986), under the assumption that local units are homogeneous (no covariates). Results in the first election may be provided by the user or generated at random according to the overdispersed multinomial model.

Usage

simula_BPF(
  n.units,
  TM,
  prop1,
  polling.sizes,
  theta1 = 0.1,
  theta2 = 0.1,
  cs = 50,
  noise = 0,
  simplify = FALSE,
  ...
)

Arguments

n.units

Either a positive integer number, K, indicating the number of polling units to be simulated, or a KxR data.frame of a matrix with the number of votes gained in election 1 for each of the R options in each of the K units. If n.units is a matrix (data.frame) of counts (votes) the values of arguments prop1 and theta1 are ommitted.

TM

A row-standardized RxC matrix with the underlying global transition probabilities of the simulated elections. If the matrix is not row-standardized, it is internally row-standardized by the function.

prop1

A vector of length R with the initial assumed probabilities of voting (to be simulated) for each of the R competing options in the first election. If the provided vector is not a set of probabilities (i.e., a vector of positive numbers adding to 1), it is internally standardized by the function.

polling.sizes

Either a vector of two components with two positive integer numbers indicating the minimum and maximum number of voters for each unit or a vector of length n.units of positive integer numbers informing about the number of voters in each unit. When polling.sizes is a vector of length two, a number of voters is randomly assigned for each unit using a uniform distribution with parameters the minimum and maximum values included in polling.sizes.

theta1

A number between 0 and 1 used as the overdispersion parameter. This parameter is employed by the underlying Dirichlet distribution, in conjunction with prop1, to randomly generate vectors of probabilities for each unit. These vectors are then used to simulate the results of the first election. The smaller the value of this parameter, the closer the unit-level marginal distributions for the first election are to prop1. Default, 0.1.

theta2

Either a single number between 0 and 1 or a vector of length nrow(TM) containing numbers between 0 and 1. The values in theta2 serve as overdispersion parameters and are used alongside the row-probability vectors in TM within the underlying Dirichlet distributions. These distributions are employed to generate probability vectors for each combination of unit, cluster, and row, which are then used to simulate vote transfers from the first to the second election. If theta2 is a vector, each row is assigned a distinct overdispersion parameter based on its corresponding value. Default, 0.1.

cs

A positive number indicating the average number of cluster size. Default, 50.

noise

Either a single number between 0 and 1 or a vector of length nrow(TM) containing numbers between 0 and 1. These numbers account for the proportion of causal voters of each origin party (row). These numbers are used to introduce more variability, compared to the BPF model, into the simulations. If noise > 0, a 100*noise percentage of votes of each row of each unit are randomly assigned among the column parties. Default, 0.

simplify

A TRUE/FALSE argument indicating whether the simulated RxCxK array of counts by polling unit should be rearranged as a matrix of order Kx(RC). Default, FALSE.

...

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

Value

A list with the following components

votes1

A matrix of order KxR with the results simulated in each polling unit for the first election.

votes2

A matrix of order KxC with the results simulated in each polling unit for the second election..

TM.global

A matrix of order RxC with the actual simulated global transfer matrix of counts.

TM.units

An array of order RxCxK with the simulated transfer matrices of votes by polling unit. If simplify = TRUE the simulated transfer matrices of votes are returned organized in a Kx(RC) matrix.

inputs

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

Author(s)

Antonio Forcina, forcinarosara@gmail.com

Jose M. Pavia, pavia@uv.es

References

Brown, P. and Payne, C. (1986). Aggregate data, ecological regression and voting transitions. Journal of the American Statistical Association, 81, 453–460. doi:10.1080/01621459.1986.10478290

Forcina, A., Gnaldi, M. and Bracalente, B. (2012). A revised Brown and Payne model of voting behaviour applied to the 2009 elections in Italy. Statistical Methods & Applications, 21, 109–119. doi:10.1007/s10260-011-0184-x

See Also

Other simulators for ecological inference overdispersed-multinomial models: simula_BPF_with_deviations()

Examples

TMg <- matrix(c(0.6, 0.1, 0.3, 0.1, 0.7, 0.2, 0.1, 0.1, 0.8),
             byrow = TRUE, nrow = 3)
example <- simula_BPF(n.units = 100, TM = TMg, prop1 = c(0.3, 0.3, 0.4),
                      polling.sizes = c(750, 850))

[Package eiCircles version 0.0.1-12 Index]