4
$\begingroup$

When I compute the five-number summary on my sample, I obtain quantiles that differ from the quantiles I got from the empirical cdf, since they are not normally distributed data.

Can you help me in the interpretation of this difference?

For instance, with a randomly-generated Poisson dataset x

x=rpois(50, 2)
summary(x)
Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
0.00    1.00    1.50    1.82    2.75    6.00 
y=ecdf(x)
summary(y)
Empirical CDF:    7 unique values with summary
Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
0.0     1.5     3.0     3.0     4.5     6.0

What does it mean that the 3rd quantile of the sample is 2.75 while it is 4.5 for the ecdf?

$\endgroup$
1
  • 2
    $\begingroup$ The second summary is summary(0:6), that is, the summary of the unique values 0, 1, 2, 3, 4, 5, 6. $\endgroup$
    – mark999
    Commented Mar 5, 2012 at 9:43

1 Answer 1

8
$\begingroup$

This has nothing to do with being non-normal.

summary(x) is computing sample quantiles of your data, using type 7 quantiles (see help(quantile) in R for the various quantile types).

I'm guessing that you've used summary(y) to produce the second set of values. In that case, the results are probably not what you want as they are giving you quantiles of the data set {0,1,2,3,4,5,6}, the step points of the empirical cdf.

You can get the quantiles from the ecdf object using quantile(y) which should give you the same results as quantile(x).

$\endgroup$
2
  • $\begingroup$ thanks Rob! I see the point now. However the quantile function does not work on ecdf, quantile(y) gives error. How can I retrieve the quantiles from the ecdf then? $\endgroup$
    – kiki
    Commented Mar 5, 2012 at 17:08
  • $\begingroup$ It works for me. $\endgroup$ Commented Mar 5, 2012 at 22:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.