View source: R/genCDFInv_quantile.R
genCDFInv_quantile | R Documentation |
This function creates an inverse cumulative distribution function (CDF)
for a given dataset using quantiles. The resulting function maps probabilities
(in the range [0, 1]
) to quantiles of the data.
genCDFInv_quantile(data, type = 1)
data |
A numeric vector. The dataset for which the inverse CDF is to be created. |
type |
Integer. Specifies the algorithm used to compute quantiles.
See |
The function works by wrapping the quantile
function. The
type
parameter controls the quantile computation method. For example:
Type 1 corresponds to inverse of the empirical distribution function (default).
Other types correspond to different quantile algorithms as documented in
quantile
.
A function that takes a single argument, p
, a numeric vector of
probabilities in [0, 1]
, and returns the corresponding quantiles from
the data.
quantile
# Example usage:
data <- c(1, 2, 3, 4, 5)
inv_cdf <- genCDFInv_quantile(data, type = 1)
inv_cdf(c(0.25, 0.5, 0.75)) # Compute the 25th, 50th, and 75th percentiles
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.