# Unexpected result from r.quantile function

I am watching some old videos of chalkdust on statistics. In one of the videos, the professor calculates quartiles as follows:

But the r.quantile function gives completely different result:

sage:
sage: r.quantile([89, 90, 86, 96, 84, 100, 85, 96, 88, 89])
0%   25%   50%   75%  100%
84.0  86.5  89.0  94.5 100.0
sage:


Why is that?

edit retag close merge delete

Sort by ยป oldest newest most voted

According to the documentation of quantile it takes an optional argument named type which is an integer from 1 to 9. These correspond to different algorithms for calculating quantiles; the default is algorithm 7. You will have to find out which one corresponds to the lecture; my guess is type 5.

sage: r.quantile([89, 90, 86, 96, 84, 100, 85, 96, 88, 89], type=5)
0%  25%  50%  75% 100%
84   86   89   96  100

more

Thanks type=5 did it.

( 2020-02-19 15:19:54 +0200 )edit

Have a serious look at the section Type of r.help("quantile"). Quantile estimation from a sample is non a trivialproblem, and has caused ink overflows by the barrel...

more

Please start posting anonymously - your entry will be published after you log in or create a new account.

## Stats

Asked: 2020-02-19 14:26:43 +0200

Seen: 336 times

Last updated: Feb 19 '20