sample_dirichlet_quantiles: Empirical Dirichlet Quantiles from Multinomial Election Poll

Description Usage Arguments Value Warning Examples

View source: R/polling.R

Description

Calculate empirical quantiles from a sample created by sample_dirichlet of a multinomial election poll

Usage

1
2
3
sample_dirichlet_quantiles(vote = c(cdu = 0.5, spd = 0.4, fdp = 0.1),
  sample_n = 1000, n_draw = 10000, show_mean = TRUE,
  show_quantiles = c(0.05, 0.95), round = 2)

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.

show_mean

Logical T/F: Show sample mean.

show_quantiles

Vector of quantiles/confidence boundaries to calculate.

round

Logical T/F Round Results to k decimal digits.

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
10
11
sample_dirichlet_quantiles(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,
                 show_mean = TRUE,
                 show_quantiles = c(0.05,0.95))

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