Ask Your Question
0

Unexpected result from r.quantile function

asked 2020-02-19 14:26:43 +0100

gg gravatar image

updated 2020-02-19 14:28:19 +0100

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

image description

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 flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2020-02-19 15:09:38 +0100

rburing gravatar image

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
edit flag offensive delete link more

Comments

Thanks type=5 did it.

gg gravatar imagegg ( 2020-02-19 15:19:54 +0100 )edit
1

answered 2020-02-19 15:13:10 +0100

Emmanuel Charpentier gravatar image

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...

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

1 follower

Stats

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

Seen: 355 times

Last updated: Feb 19 '20