Plots the estimated probabilities as pie charts using ggplot2, one per row of the probability matrix.
Each slice displays its percentage label. For the parametric case, it does a weighted average over groups to retrieve the global probabilities.
# S3 method for class 'eim'
plot(
x,
title = "Estimated probabilities",
legend_title = "Candidates",
color_scale = NULL,
min_pct = 3,
pies_per_row = NULL,
...
)An "eim" object.
Title for the plot.
Title for the legend.
A vector of colors or a palette for the candidates.
Minimum percentage required to display a label.
Number of pie charts to display per row. Defaults to ceiling(sqrt(G)),
where G is the number of groups.
Additional arguments that are ignored.
Returns a ggplot2 object representing the pie charts.
# \donttest{
sim <- simulate_election(
num_ballots = 100,
num_candidates = 4,
num_groups = 5,
ballot_voters = 40,
num_covariates = 2,
num_districts = 2,
seed = 42
)
fit <- run_em(sim, maxiter = 5)
plot(fit, title = "Estimated probabilities", legend_title = "Candidates", min_pct = 7)
# }