Skip to contents

Likert distribution function

Usage

plikert(q, prob, labels = names(prob))

Arguments

q

the vector of quantiles

prob

a vector of probabilities or counts; if named, the output is a factor

labels

a vector of values, defaults to names(prob) or 1:length(prob), if numeric, the output is numeric

Value

a vector of the densities

Examples

q <- 1:5
prob <- c(.1, .2, .4, .2, .1)
plikert(q, prob)
#>   1   2   3   4   5 
#> 0.1 0.3 0.7 0.9 1.0 

q <- c("A", "C", "B", "B")
prob <- c(A = 10, B = 20, C = 30)
plikert(q, prob)
#>         A         C         B         B 
#> 0.1666667 1.0000000 0.5000000 0.5000000 

# specify labels if prob not named and not 1:length(prob)
labels <- -2:2 
q <- labels
prob <- rep(1, length(labels)) # uniform probability
plikert(q, prob, labels)
#>  -2  -1   0   1   2 
#> 0.2 0.4 0.6 0.8 1.0