gauge {HighestMedianRules}R Documentation

Gauge

Description

This function returns a custom description of the grades of a candidate in terms of the shares of proponents (p), opponents (q), median grades (g), and the gauge (i.e. the median grade followed by + or -, a + corresponding to a larger share of proponents than opponents).

Usage

gauge(grades, k = 0.5, scale = c(), return = "qp")

Arguments

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))).

return

A string containing the information to return. Default to 'qp' (shares of opponents and proponents). Possible values: 'g', 'p', 'q', 'pq', 'qp', 'qpg', 'pqg', 'gpq', 'gqp', 'text' (i.e. the gauge), 'all'. If the string does not match one of the above, 'all' is returned.

Value

A double, a character vector or a double vector. Depending on what is passed in return.

Examples

gauge(elec2012['Hollande',], return = 'gqp')

[Package HighestMedianRules version 1.0 Index]