--- myst: substitutions: titre: "Empirical computation" --- ```{include} /../core/dataserver/statistics/quantile_computation/compute_quantile.md ``` The way the index $k$ is computed depends on how conservative one wants to be, but also on the case under consideration. For discontinuous cases, one can choose amongst the following list: - $k=\lfloor p\times N \rfloor; \; {\rm if} \; p \times N = k,\; q = x_k. \; q=x_{k+1}\; {\rm otherwise.}$ - $k=\lfloor p\times N \rfloor; \; {\rm if} \; p \times N = k,\; q = 1/2 \times (x_k+x_{k+1}). \; q=x_{k+1} \; {\rm otherwise.}$ - $k=\lfloor p \times N - 0.5 \rfloor; \; {\rm if} \; p \times N -0.5 = k \; {\rm and} \; k \; {\rm is \; even},\; q = x_k. \; q=x_{k+1} \; {\rm otherwise.}$ For piece-wise linear interpolations, the estimation of k can be done in {{uranie}} amongst the following cases: - $k=\lfloor p \times N\rfloor$ - $k=\lfloor p \times N - 0.5\rfloor$ - $k=\lfloor p \times (N + 1) \rfloor$ - $k=\lfloor p \times (N - 1) + 1 \rfloor$ - $k=\lfloor p \times (N + 1/3) + 1/3 \rfloor$, approximately median unbiased. - $k=\lfloor p \times (N + 1/4) + 3/8 \rfloor$, approximately unbiased if $x$ is normally distributed.