standalone_monte_carlo_methods | R Documentation |
These methods take simulated election results and return a list of
pivot events, each with a pivot probability (integral
) and
P matrix (P
). They produce identical results to
election_event_probs()
(or nearly so) but they are faster because
they are written in a less general way.
plurality_event_probs_from_sims(
sims = NULL,
n = 1000,
window = 0.01,
cand_names = NULL,
sep = "_",
method = "density",
merge = F,
drop = F,
bw_divisor = 1,
skip_non_pivot_events = T,
s = NULL,
raw = F
)
positional_event_probs_from_sims(
sims,
window = 0.01,
n = 1000,
s = 0.5,
cand_names = NULL,
sep = "_",
method = "density",
merge = F,
drop = F,
increments = 10,
bw_divisor = 1,
skip_non_pivot_events = T,
raw = F
)
irv_event_probs_from_sims(
sims,
window = 0.01,
n = 1000,
s = 0,
cand_names = NULL,
sep = "_",
method = "density",
merge = F,
bw_divisor = 1,
skip_non_pivot_events = T
)
condorcet_event_probs_from_sims(
sims,
n = 1000,
window = 0.01,
cand_names = NULL,
sep = "_",
kemeny = T,
method = "density",
merge = F,
bw_divisor = 1,
s = NULL,
skip_non_pivot_events = T
)
sims |
A matrix of simulated election results, with one column per ballot type. Must be 6 columns for the ordinal methods (IRV, Kemeny-Young, positional). |
n |
Size of electorate |
window |
Window within which two candidates are considered to be tied
when |
cand_names |
Names of the candidates. |
sep |
Separation between candidate names. |
merge |
Merge adjacent pivot events? |
drop |
Drop a dimension? |
skip_non_pivot_events |
Skip non pivot events? |
s |
Score allocated to a second-place ranking in positional and IRV elections. |
raw |
Return counts rather than integrals/proportions? |
kemeny |
For Condorcet method, compute Kemeny-Young pivot event probabilities? If |
For plurality elections, any number of candidates can be specified. The other voting systems can only handle three candidates.
Results have been validated against election_event_probs()
.
sims <- gtools::rdirichlet(100000, alpha = c(9,7,3,4,4,6))
plurality_pivot_probs_from_sims(sims)
positional_pivot_probs_from_sims(sims, s=.5)
irv_pivot_probs_from_sims(sims)
condorcet_pivot_probs_from_sims(sims)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.