Learn R Programming

voteSim (version 0.1.1)

generate_norm: Generate truncated normal scores

Description

This function generates truncated normal scores using the 'rtruncnorm' function from the 'truncnorm' package.

Usage

generate_norm(n_voters, n_candidates, min = 0, max = 1, mean = 0.5, sd = 0.25)

Value

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

Arguments

n_voters

The number of voters to generate scores for.

n_candidates

The number of candidates to generate scores for.

min

The minimum value of the truncated normal distribution.

max

The maximum value of the truncated normal distribution.

mean

The mean of the truncated normal distribution.

sd

The standard deviation of the truncated normal distribution.

Examples

Run this code
voting_situation<- generate_norm(n_voters=10, n_candidates=3, min=0, max=10, mean=0.7)

Run the code above in your browser using DataLab