Learn R Programming

voteSim (version 0.1.1)

generate_dirichlet: Generate multinomial scores

Description

This function generates scores following a Dirichlet distribution

Usage

generate_dirichlet(n_voters, n_candidates, probs = 0)

Value

A matrix of scores with 'n_candidates' rows and 'n_voters' columns.

Arguments

n_voters

integer, the number of voters to generate scores for.

n_candidates

integer, The number of candidates to generate scores for.

probs

A vector of size n_candidates corresponding to the parameters of the Dirichlet distribution. By default all values are equal to 1.

Examples

Run this code
voting_situation <- generate_dirichlet(n_voters=10, n_candidates=3,  probs=c(0.5, 0.3, 0.2))

Run the code above in your browser using DataLab