get_entryprobability: Get probabilities to enter the parliament.

View source: R/entry-probabilities.R

get_entryprobabilityR Documentation

Get probabilities to enter the parliament.

Description

Get probabilities to enter the parliament.

Usage

get_entryprobability(dirichlet.draws, hurdle = 0.05)

Arguments

dirichlet.draws

Matrix or data frame containing draws from the posterior (see draw_from_posterior).

hurdle

The percentage threshold which has to be reached by a party to enter the parliament. Any party called "ssw" will be exempt from the hurdle.

Value

Vector of (named) entry probabilities.

See Also

draw_from_posterior

Examples

library(coalitions)
library(dplyr)
# get the latest survey for a sample of German federal election polls
surveys <- get_latest(surveys_sample)
# use 100 simulations for a fast runtime
surveys <- surveys %>% mutate(draws = purrr::map(survey, draw_from_posterior, nsim = 100),
                              entryProbs = purrr::map(draws, get_entryprobability))
surveys$entryProbs

adibender/coalitions documentation built on Aug. 22, 2022, 5:58 a.m.