Learn R Programming

plgraphics (version 1.2)

quinterpol: Interpolated Quantiles

Description

This function implements a version of empirical quantiles based on interpolation

Usage

quinterpol(x, probs = c(0.25, 0.5, 0.75), extend = FALSE)

Value

vector of quantiles

Arguments

x

vector of data determining the quantiles

probs

vector of probabilities defining which quantiles should be produced

extend

logical: Should quantiled be calculated outside the range of the data by linear extrapolation? This may make sense if the sample is small or the data is rounded or grouped or a score.

Author

Werner A. Stahel

Details

The empirical quantile function jumps at the data values according to the usual definition. The version of quantiles calculated by 'quinterpol' avoids jumps. It is based on linear interpolation of the step version of the empirical cumulative distribution function, using as the given points the midpoints of both vertical and horizontal pieces of the latter. See 'examples' for a visualization.

See Also

quantile

Examples

Run this code
## This example illustrates the definition of the "interpolated quantiles"

set.seed(2)
t.x <- sort(round(2*rchisq(20,2)))
table(t.x)
t.p <- ppoints(100)
plot(quinterpol(t.x,t.p),t.p, type="l")

Run the code above in your browser using DataLab