smaa.pvf | R Documentation |
Given a set of reference levels and their values, compute a linearly interpolated (piece-wise linear) partial value function.
smaa.pvf(x, cutoffs, values, outOfBounds="error")
x |
Values to compute the PVF for, a numeric vector |
cutoffs |
Reference levels (ascending order) |
values |
Values of the reference levels |
outOfBounds |
What to do when some of the |
A numeric vector the same length as x
.
The values are computed by linear interpolation between the values of the two closest reference levels. This has been implemented in C for a dramatic performance improvement.
Gert van Valkenhoef
x <- c(50, 90, 100, 10, 40, 101, 120)
values <- smaa.pvf(x,
cutoffs=c(50, 75, 90, 100),
values=c(1, 0.8, 0.5, 0),
outOfBounds="clip")
stopifnot(all.equal(values, c(1.0, 0.5, 0.0, 1.0, 1.0, 0.0, 0.0)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.