Skip to content

Commit f13706e

Browse files
authored
documentation fix for quantile (#139)
1 parent a3feba2 commit f13706e

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/Statistics.jl

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -876,8 +876,12 @@ output array `q` may also be specified. (If not provided, a new output array is
876876
The keyword argument `sorted` indicates whether `v` can be assumed to be sorted; if
877877
`false` (the default), then the elements of `v` will be partially sorted in-place.
878878
879+
Samples quantile are defined by `Q(p) = (1-γ)*x[j] + γ*x[j+1]`,
880+
where `x[j]` is the j-th order statistic of `v`, `j = floor(n*p + m)`,
881+
`m = alpha + p*(1 - alpha - beta)` and `γ = n*p + m - j`.
882+
879883
By default (`alpha = beta = 1`), quantiles are computed via linear interpolation between the points
880-
`((k-1)/(n-1), v[k])`, for `k = 1:n` where `n = length(v)`. This corresponds to Definition 7
884+
`((k-1)/(n-1), x[k])`, for `k = 1:n` where `n = length(v)`. This corresponds to Definition 7
881885
of Hyndman and Fan (1996), and is the same as the R and NumPy default.
882886
883887
The keyword arguments `alpha` and `beta` correspond to the same parameters in Hyndman and Fan,
@@ -1021,12 +1025,11 @@ probabilities `p` on the interval [0,1]. The keyword argument `sorted` indicates
10211025
`itr` can be assumed to be sorted.
10221026
10231027
Samples quantile are defined by `Q(p) = (1-γ)*x[j] + γ*x[j+1]`,
1024-
where ``x[j]`` is the j-th order statistic, and `γ` is a function of
1025-
`j = floor(n*p + m)`, `m = alpha + p*(1 - alpha - beta)` and
1026-
`g = n*p + m - j`.
1028+
where `x[j]` is the j-th order statistic of `itr`, `j = floor(n*p + m)`,
1029+
`m = alpha + p*(1 - alpha - beta)` and `γ = n*p + m - j`.
10271030
10281031
By default (`alpha = beta = 1`), quantiles are computed via linear interpolation between the points
1029-
`((k-1)/(n-1), v[k])`, for `k = 1:n` where `n = length(itr)`. This corresponds to Definition 7
1032+
`((k-1)/(n-1), x[k])`, for `k = 1:n` where `n = length(itr)`. This corresponds to Definition 7
10301033
of Hyndman and Fan (1996), and is the same as the R and NumPy default.
10311034
10321035
The keyword arguments `alpha` and `beta` correspond to the same parameters in Hyndman and Fan,

0 commit comments

Comments
 (0)