First time here? Check out the FAQ!

Ask Your Question
0

Unexpected result from r.quantile function

asked 5 years ago

gg gravatar image

updated 5 years ago

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?

Preview: (hide)

2 Answers

Sort by » oldest newest most voted
1

answered 5 years ago

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
Preview: (hide)
link

Comments

Thanks type=5 did it.

gg gravatar imagegg ( 5 years ago )
1

answered 5 years ago

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

Preview: (hide)
link

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: 5 years ago

Seen: 429 times

Last updated: Feb 19 '20