sample_dirichlet: Dirichlet-sample of a multinomial election poll

Description Usage Arguments Value Warning Examples

View source: R/polling.R

Description

Calculate a dirichlet-sample of a multinomial election poll

Usage

1
2
sample_dirichlet(vote = c(cdu = 0.5, spd = 0.4, fdp = 0.1),
  sample_n = 1000, n_draw = 10000)

Arguments

vote

A labeled party vote share vector.

sample_n

The number of observations in the poll sample.

n_draw

How many samples to draw from the dirichlet distribution.

Value

A data frame containing n rows of samples for each party.

Warning

Do not operate heavy machinery within 8 hours of using this function.

Examples

1
2
3
4
5
6
7
8
9
sample_dirichlet(vote = c(cdu = 0.33,
                          spd = 0.20,
                          fdp = 0.11,
                          linke = 0.09,
                          gruene = 0.09,
                          afd = 0.12,
                          sonstige = 0.05),
                 sample_n = 1000,
                 n_draw = 10000)

schliebs/voteR documentation built on May 7, 2019, 3:33 p.m.