powered by
This function generates discrete scores following a multinomial distribution on a given scale
generate_multinom(n_voters, n_candidates, max = 10, probs = 0)
A matrix of scores with 'n_candidates' rows and 'n_voters' columns.
integer, the number of voters to generate scores for.
integer, The number of candidates to generate scores for.
The maximum value of the distribution, by default 10. It also corresponds to the sum of scores on all the candidates
A vector of size n_candidates corresponding to the parameters of the multinomial distribution. By default all values are equal to 1/n_candidates
voting_situation <- generate_multinom(n_voters=10, n_candidates=3, max=100, probs=c(0.5, 0.3, 0.2))
Run the code above in your browser using DataLab