score: Score

Description Usage Arguments Value Examples

View source: R/HighestMedianRules.R

Description

This function returns the score of a candidate, using a custom voting rule.

Usage

1
2
3
4
5
6
7
8
9
score(
  rule = "mj",
  grades = elec2012["Hollande", ],
  k = 0.5,
  scale = c(),
  name = "",
  print = TRUE,
  return_text = FALSE
)

Arguments

rule

The voting rule to be used. Default to 'mj'. Possible values: 'mj' (majority judgment), 'd' (difference), 's' (relative share), 'n' (normalized difference), 'mean' (range voting). For more details, see "Tie-Breaking the Highest Median", Fabre, Social Choice & Welfare (forthcoming).

grades

A numeric vector containing the shares of each grades of a candidate, from the lowest grade to the highest.

k

The quantile used to compute the gauge. Default to 0.5 (the median). For more details, see paragraph Extensions in 3.2.1 of "Tie-Breaking the Highest Median", Fabre, Social Choice & Welfare (forthcoming).

scale

A numeric vector containing the values of the scale of grades. Default to c((floor(-length(grades)/2)+1):(length(grades)+floor(-length(grades)/2))).

name

Text to be printed along the gauge in case print = TRUE and return_text = FALSE. Defaults to "".

print

Prints the gauge and the argument 'name'. Default to TRUE.

return_text

Prints the gauge. Defaults to FALSE. The gauge is less informative than the score, it is the median grade and + if there are grades higher than the median than lower, - otherwise.

Value

A double or a character. The score (a double) if return_text = FALSE, the gauge (a character) otherwise.

Examples

1
score(rule='d', elec2012['Hollande',], scale=-2:4, name="Hollande")

HighestMedianRules documentation built on March 26, 2020, 7:28 p.m.