simula_mixture: Simulate RxC Tables with Mixed Electoral Behaviours Using...

View source: R/simula_mixture.R

simula_mixtureR Documentation

Simulate RxC Tables with Mixed Electoral Behaviours Using Overdispersed Multinomial Models

Description

Generates a set of RxC electoral contingency tables under a mixture of voting behaviours, including ecological fallacy effects, within the Overdispersed Multinomial model framework proposed by Forcina et al. (2012), an extension of Brown and Payne (1986). The simulated tables represent the joint distribution of voters in two elections across a set of voting units. Each table is generated using a mixture model that incorporates seven latent voter types, where, consistent with the tradition of mixture models, the number of voters of each type in every unit is assumed to follow a multinomial distribution. The seven electoral behaviours considered (ordinary, faithful, trendy, local retrospective strategic, global retrospective strategic, (global) strategic, and economic voters) are specified in the function's arguments and in Details.

Usage

simula_mixture(
  n.units,
  TP,
  prop1,
  polling.sizes,
  theta1 = 0.1,
  theta2 = 0.1,
  cs = 50,
  tau,
  TP.f,
  TP.t,
  LRSV.par,
  GRSV.par,
  GSV.par,
  eco.par,
  simplify = FALSE,
  ...
)

Arguments

n.units

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

TP

A RxC row-standardized matrix of global transition probabilities for the Overdispersed Multinomial model (ordinary voters). If not row-standardized, rows are internally normalized. The row-standardized matrix is represented as \mathbf{P} = [p_{rc}] = [\mathbf{p}^{T}_{r}].

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(TP) containing numbers between 0 and 1. The values in theta2 serve as overdispersion parameters and are used alongside the row-probability vectors in TP 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.

tau

An Rx7 row-standardized matrix with, by rows (r), the vectors of probabilities of the multinomial distributions used to simulate, in each polling unit, the number of voters by behaviour type among those who chose option r in the first election. Each cell ⁠(r, t)⁠ defines the probability that a voter who chose option r in the first election behaves as type t in the second election. Probabilities corresponding to electoral behaviours are, by columns, in the order: ordinary, faithful, trendy, local retrospective strategic, global retrospective strategic, (global) strategic, and economic voters. If not row-standardized, rows are internally normalized. The row-standardized matrix is represented as \mathbf{\Theta} = [\tau_{rt}] = [\mathbf{\tau}^{T}_{r}]. By default, \mathbf{\tau}_{r} =[1,0,0,0,0,0,0], i.e., all voters are assumed to behave as ordinary voters.

TP.f

A RxC row-standardized matrix of transition probabilities for faithful (strongly party-identified) voters, who will vote for the same party again with (almost) probability 1. The matrix is represented as \mathbf{F} = [\mathbf{f}^{T}_{r}]. By default, it is (initially) the rectangular identity matrix of size RxC (i.e., \mathbf{F} = \mathbf{I}_{RxC}, where (\mathbf{I}_{RxC})_{rc} = 1 if r=c \leq \min(R,C) and 0 otherwise), assuming the same order for the intersecting options in the first and second elections. If the same voting options are available in both elections, this will by default be the identity matrix. If an entire row of TP.f consists of zeroes, it is replaced by the corresponding row in TP, so that faithful voters from the first election linked to the row are still transferred to the second.

TP.t

A non-negative vector of length C that sums to 1, representing the transition probabilities for trendy voters. If not standardized, the vector is internally normalized. By default, TP.t = \mathbf{t} is the vector of expected results in the second election implied by the matrix TP, assuming that all voters behave as ordinary voters. Formally, trendy voters behave according to the RxC matrix of transition probabilities: \mathbf{1}_{R}\mathbf{t}.

LRSV.par

A ⁠4xR⁠ matrix of parameters governing the behaviour of local retrospective strategic voters, who base their decisions on their party's past results in their polling station. The first two rows correspond to minor-party voters and the last two to major-party voters. Within each block, the first row corresponds to proportion thresholds and the second row to beta parameters. Proportion thresholds are non-negative numbers not greater than one, while beta parameters are non-negative for minor parties and non-positive for major parties. A party cannot be treated simultaneously as both a minor and a major party. The sign of beta determines the party's size. See Details to understand how the parameters are combined to define transition probabilities for these voters. By default, all beta parameters are set to zero, which is equivalent to assuming that local retrospective strategic voters behave as ordinary voters.

GRSV.par

A ⁠4xR⁠ matrix of parameters governing the behaviour of global retrospective strategic voters, who base their decisions on their party's global past results. The first two rows correspond to minor-party voters and the last two to major-party voters. Within each block, the first row corresponds to proportion thresholds and the second row to beta parameters. Proportion thresholds are non-negative numbers not greater than one, while beta parameters are non-negative for minor parties and non-positive for major parties. A party cannot be treated simultaneously as both a minor and a major party. The sign of beta determines the party's size. See Details to understand how the parameters are combined to define transition probabilities for these voters. By default, all beta parameters are set to zero, which is equivalent to assuming that global retrospective strategic voters behave as ordinary voters.

GSV.par

A ⁠4xmin(R,C)⁠ matrix of parameters governing the behaviour of global strategic voters, who base their behaviour on expected results in the second election. It is assumed that the order of parties in the first and second elections coincides for the first min(R, C) parties (voting options) in both elections. The first two rows correspond to minor-party voters and the last two to major-party voters. Within each block, the first row corresponds to proportion thresholds and the second row to beta parameters. Proportion thresholds are non-negative numbers not greater than one, while beta parameters are non-negative for minor parties and non-positive for major parties. A party cannot be treated simultaneously as both a minor and a major party. The sign of beta determines the party's size. See Details to understand how the parameters are combined to define transition probabilities for these voters. By default, all beta parameters are set to zero, which is equivalent to assuming that strategic voters behave as ordinary voters.

eco.par

A list with three vectors governing the behaviour of economic voters. These voters prioritise economic performance, rewarding or punishing parties in the governing coalition based on the perceived local change in the economic situation. The first component is a vector of length K, whose elements capture the (perceived) variation in the economy across voting units, with positive values indicating improvement. The second component is a vector of length R with the non-negative beta parameters that map the scale of economic performance to the logits of transition probabilities for each party. The third component is a vector of length C, with entries equal to one for parties in the second election that were part of the governing coalition between the first and second elections, and zero otherwise. See Details to understand how the parameters are combined to define transition probabilities for these voters. By default, all beta parameters are set to zero, which is equivalent to assuming that economic voters behave as ordinary voters.

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.

Details

Description of how parameters for strategic and economic voters are combined.

  • ⁠local retrospective strategic voters⁠: These are voters who consider retrospective outcomes and make tactical decisions to maximize their preferred outcomes, not necessarily their first choice. Their decisions are assumed to depend on the local strength of the party they supported in the previous election. (i) If their party was a minor one, they will support it again when it appears sufficiently strong, or vote for a different option to avoid wasting their vote; (ii) If their party was a major one, they will support it again when it seems to require their support in order to remain strong enough; otherwise, they may choose differently. Formally, let \mathbf{f}_{r} denote the rth row of the matrix \mathbf{F} for faithful voters, and let \mathbf{\lambda}_{r} denote the vector of logits \log(\mathbf{p}_{r}/p_{rC}) based on the matrix of transition probabilities for ordinary voters. The vector of retrospective-strategy-local-modified logits for voting unit s is defined as \mathbf{\lambda}_{sr}^{LRS} = \mathbf{\lambda}_{r} + \beta_{r}(\pi_{sr} - a_{r}), where a_{r} is the threshold for party r, \pi_{sr} is the proportion of votes gained by party r in voting unit s in the first election, and \beta_{r} is the corresponding mapping parameter, non-negative for minor parties and non-positive for major parties. In words, \mathbf{\lambda}_{r} is the vector of logits for ordinary voters (representing basic preferences), \pi_{sr} represents the local strength of party r in unit s, a_{r} is the threshold parameter that determines the switching point in voter behaviour, and \beta_{r} adjusts the degree of strategic consideration. Under this specification, because of the interaction with the difference (\pi_{sr} - a_{r}), a value of \beta_{r} > 0 makes voters more likely to support their party if it appears sufficiently strong and less likely otherwise, whereas a value of \beta_{r} < 0 makes voters less likely to support their party if it appears sufficiently strong and more likely otherwise.

  • ⁠global retrospective strategic voters⁠: These voters behave similarly to local retrospective ⁠strategic voters⁠, but consider global rather than local results. They take retrospective outcomes into account and make tactical decisions to maximize their preferred outcomes, not necessarily their first choice. Their decisions are assumed to depend on the overall strength of the party they supported in the previous election. (i) If their party was a minor one, they will support it again when it appears sufficiently strong, or vote for a different option to avoid wasting their vote; (ii) If their party was a major one, they will support it again when it seems to require their support in order to remain strong enough; otherwise, they may choose differently. Formally, let \mathbf{f}_{r} denote the rth row of the matrix \mathbf{F} for faithful voters, and let \mathbf{\lambda}_{r} denote the vector of logits \log(\mathbf{p}_{r}/p_{rC}) based on the matrix of transition probabilities for ordinary voters. The vector of retrospective-strategy-global-modified logits is defined as \mathbf{\lambda}_{r}^{GRS} = \mathbf{\lambda}_{r} + \beta_{r}(\pi_{r} - b_{r}), where b_{r} is the threshold for party r, \pi_{r} is the total proportion of votes gained by party r in the first election, and \beta_{r} is the corresponding mapping parameter, non-negative for minor parties and non-positive for major parties. In words, \mathbf{\lambda}_{r} is the vector of logits for ordinary voters (representing basic preferences), \pi_{r} represents the global strength of party r in the first election, b_{r} is the threshold parameter that determines the switching point in voter behaviour, and \beta_{r} adjusts the degree of strategic consideration. Under this specification, because of the interaction with the difference (\pi_{r} - b_{r}), a value of \beta_{r} > 0 makes voters more likely to support their party if it appears sufficiently strong and less likely otherwise, whereas a value of \beta_{r} < 0 makes voters less likely to support their party if it appears sufficiently strong and more likely otherwise.

  • ⁠global strategic voters⁠: These voters behave similarly to global retrospective strategic voters, but base their decisions on expected results in the second election. They consider expected outcomes and make tactical decisions to maximize their preferred outcomes, not necessarily their first choice. Their decisions are assumed to depend on the expected overall strength in the second election of the party they supported in the first election, knowledge that in practice may be obtained from surveys. (i) If their party was a minor one, they will support it again when it appears sufficiently strong, or vote for a different option to avoid wasting their vote; (ii) If their party was a major one, they will support it again when it seems to require their support to remain strong enough; otherwise, they may choose differently. Formally, let \mathbf{f}_{r} denote the rth row of the matrix \mathbf{F} for faithful voters, and let \mathbf{\lambda}_{r} denote the vector of logits \log(\mathbf{p}_{r}/p_{rC}) based on the matrix of transition probabilities for ordinary voters. Assuming the same order of parties in the first and second elections for those parties affected by strategic voters, the vector of strategy-global-modified logits is defined as \mathbf{\lambda}_{r}^{GS} = \mathbf{\lambda}_{r} + \beta_{r}\left(\sum_{j}\pi_{j} p_{jr} - c_{r}\right), where c_{r} is the threshold for party r, \pi_{j} is the total proportion of votes gained by party j in the first election, p_{jr} is the transition probability from party j to party r for ordinary voters, and \beta_{r} is the corresponding transforming parameter, non-negative for minor parties and non-positive for major parties. In words, \mathbf{\lambda}_{r} is the vector of logits for ordinary voters (representing basic preferences), \sum_{j}\pi_{j} p_{jr} represents the expected global strength of party r in the second election, c_{r} is the threshold parameter that determines the switching point in voter behaviour, and \beta_{r} adjusts the degree of strategic consideration. Under this specification, because of the interaction with the difference \sum_{j}(\pi_{j} p_{jr}) - c_{r}, a value of \beta_{r} > 0 makes voters more likely to support their party if it appears sufficiently strong and less likely otherwise, whereas a value of \beta_{r} < 0 makes voters less likely to support their party if it appears sufficiently strong and more likely otherwise.

  • ⁠economic voters⁠: These voters prioritise economic performance, rewarding or punishing parties in the governing coalition based on the perceived change in the local economic situation. Formally, let \mathbf{v}_{s} denote the perceived measure of economic variation in unit s, \mathbf{\lambda}_{r} the vector of logits \log(\mathbf{p}_{r}/p_{rC}) based on the matrix of transition probabilities for ordinary voters, and \mathbf{g} a vector with entries equal to 1 for parties in the governing coalition and 0 otherwise. The vector of economically modified logits for voting unit s is then defined as \mathbf{\lambda}_{sr}^{E} = \mathbf{\lambda}_{r} + \beta_{r} \mathbf{v}_{s} \mathbf{g}, with \beta_{r} > 0 being the mapping parameter. Under this specification, these voters are more likely to support government parties if the local economy improves.

Value

A list with the following components

votes1

A KxR matrix with the (simulated) results in each polling unit for the first election.

votes2

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

TM.global

An RxC matrix with the simulated global transfer matrix of counts.

TM.units

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

TM.by.behaviour

A list with seven components, each of which is itself a list containing the four simulated elements (votes1, votes2, TM.global and TM.units as RxCxK arrays) corresponding to the subgroups of voters by behaviour, in the following order: ordinary, faithful, trendy, local retrospective strategic, global retrospective strategic, (global) strategic, and economic voters.

inputs

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

Note

Compared with simula_BPF_with_deviations, this function (i) is not restricted to square matrices; (ii) considers up to seven voter types; and (iii) because it mixes distributions, it draws from a distribution with larger variance, even when the latent types and their parameters are the same.

Author(s)

Jose M. Pavia, pavia@uv.es

Antonio Forcina, forcinarosara@gmail.com

References

Brown, P. and Payne, C. (1986). Aggregate data, ecological regression and voting transitions. Journal of the American Statistical Association, 81, 453–460. \Sexpr[results=rd]{tools:::Rd_expr_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. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1007/s10260-011-0184-x")}

See Also

simula_BPF 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_mixture(n.units = 100, TP = TMg, prop1 = c(0.3, 0.3, 0.4),
                                      polling.sizes = c(750, 850))

eiCircles documentation built on March 18, 2026, 1:06 a.m.