eda_fval: Calculate quantile f-values

View source: R/eda_fval.R

eda_fvalR Documentation

Calculate quantile f-values

Description

Calculates Fractional Values (f-Values).

Usage

eda_fval(x, q.type = 5)

Arguments

x

Vector whose f-values are to be computed.

q.type

An integer specifying the algorithm to use for computing F-values.

Details

This function computes the fractional value (f-value) for each element in a numeric vector x. The f-value provides a measure of the position of a data point relative to the rest of the data, scaled to the range [0,1]. This fraction is sometimes reported as the probability or cumulative frequency.

Different algorithms are used to compute the f-value. eda_fval offers as optional algorithm type 4 through 9 documented in stats::quantile. The algorithms used are:

  • 4: f = i / n,

  • 5: f = (i - 0.5) / n,

  • 6: f = i / (n + 1),

  • 7: f = (i - 1) / (n - 1),

  • 8: f = (i - 1/3) / (n + 1/3),

  • 9: f = (i - 3/8) / (n + 1/4).

Where f is the fraction of values that lies below index i, and n is the total number values.

Value

A numeric vector of the same length as x, containing the f-values for each input value. The order of the returned f-values matches the input vector.

References

  • John M. Chambers, William S. Cleveland, Beat Kleiner, Paul A. Tukey. Graphical Methods for Data Analysis (1983)

See Also

  • stats::quantile() for quantile calculations

  • eda_qq for QQ plots

Examples


 set.seed(321)
 z <- round(runif(10, 1, 20))
 z

 # William Cleveland's f-values algorithm
 eda_fval(z)

 # Algorithm used by the stats::quantile() function
 eda_fval(z, q.type = 7)

mgimond/tukeyedar documentation built on Feb. 1, 2025, 4:02 a.m.