findPayout: Find payout given a result and a payout grid.

Description Usage Arguments Value Examples

View source: R/findPayout.R

Description

findPayout determines the payout for each level based on a payout grid. Essentially, for a vector of results against a vector of payouts p1..pn it returns p[l] where l is the level, presumably found through findLevel. Note that while findLevel potentially results in one level greater than the number of thresholds, findPayout requires a payout for every level in the vector x.

Usage

1
findPayout(x, p)

Arguments

x

A vector of levels to translate to a payout.

p

A vector of payout thresholds, sorted increasingly.

Value

vector of length length(x).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
x <- c(1,1,2,4)
 p <- c(0, 500, 1000, 2000)
 findPayout(x, p)
 # [1]    0    0  500 2000
## Not run: 
# Not enough payouts for the number of levels provided
x <- sample(rep(1:5, 20))
findPayout(x, p)

## End(Not run)

multiphrenic/IncentiveAnalysis documentation built on May 23, 2019, 8:22 a.m.