simula_BPF_with_deviations {eiCircles} | R Documentation |
Simulate RxC Square Tables with Ecological Fallacy Effects Based on Overdispersed-Multinomial Models
Description
Generates a set of RxC square (RxR) tables at random, representing the joint distribution of voters in two elections, according to the model proposed by Forcina et al. (2012) as an extension of Brown and Payne (1986), under the assumption that transition probabilities are non-homogeneous across local units. For each unit, a unique transition table is constructed to simulate voter behavior within that unit. Each table is created using a mixture model that considers four latent types of voters: one group following the underlying global transition probabilities of the BPF model, another composed mainly of loyal voters, a third characterized by strategic voting, and a final group whose probability of loyalty to the party they supported in the first election depends on that party's strength in the unit during the first election
Usage
simula_BPF_with_deviations(
n.units,
TM,
prop1,
polling.sizes,
theta1 = 0.1,
theta2 = 0.1,
cs = 50,
prop.dev = c(0.4, 0.6),
prop.loyal = matrix(0.34, nrow = ifelse(is.null(dim(n.units)), n.units, nrow(n.units)),
ncol = nrow(TM)),
prop.strategic = matrix(0.33, nrow = ifelse(is.null(dim(n.units)), n.units,
nrow(n.units)), ncol = nrow(TM)),
prop.context = matrix(0.33, nrow = ifelse(is.null(dim(n.units)), n.units,
nrow(n.units)), ncol = nrow(TM)),
par.loyal = 0.95,
par.strategic = 0.5,
par.context = 0.5,
simplify = FALSE,
...
)
Arguments
n.units |
Either a positive integer number, |
TM |
A row-standardized RxC matrix with the underlying global transition probabilities for the Overdispersed-Multinomial Model. 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 |
theta1 |
A number between 0 and 1 used as the overdispersion parameter.
This parameter is employed by the underlying Dirichlet distribution,
in conjunction with |
theta2 |
Either a single number between 0 and 1 or a vector of length |
cs |
A positive number indicating the average number of cluster size. Default, |
prop.dev |
Either a two-component vector with positive values between 0 and 1,
indicating the minimum and maximum proportion of voters (to be simulated)
that deviate from the base Overdispersed-Multinomial Model in each unit
or a vector of length |
prop.loyal |
A KxR matrix where each cell |
prop.strategic |
A KxR matrix where each cell |
prop.context |
A KxR matrix where each cell |
par.loyal |
A number between 0.9 and 1 indicating the minimum probability with which loyal
voters will support the same party in the second election as they did in the
first. For each unit, the probability is randomly chosen between |
par.strategic |
A positive number indicating the proportion of increase that
the initial transfer probabilities in |
par.context |
A positive number indicating the factor by which the proportion of
support for a party in each unit should be multiplied to increase
the initial transfer probabilities in |
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
|
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()
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_with_deviations(n.units = 100, TM = TMg, prop1 = c(0.3, 0.3, 0.4),
polling.sizes = c(750, 850))