Let X be a rv with cdf F. The 100pth percentile of X (or F)is any value x
that satisfies the equation: F(x-) <= p <= F(x), where F(x-) = F(x) - P[X=x].
If F is continuous, P[X=x]=0, so that this reduces to solving for x in the
equation: F(x) = p. Since, as I gather, the concern is with sample
percentiles,
it would seem reasonable to replace F, above, with Fn, the empirical CDF of
the data. Many statisticians disagree.
An interesting paper: "Sample Quantiles in Statistical Packages", by
Hyndman and Fan, appeared in The American Statistician, Nov.,1996. It lists
9 ( nine !) definitions of the pth quantile (100pth %ile) of a data set -
each actively used in one or more statistical package. The first 3 are
minor variants of the definition given above applied to the empirical CDF (
e.g. the[np]+1st order statistic). This invariably leads to one of the
order statistics or midway between two of them - a very simple recipe.
The others all involve some sort of interpolation between order statistics
and are justified by reference to properties of estimates (e.g. median
unbiasedness?) that have little to do with the purpose of a descriptive
statistic.
MINITAB doesn't do it automatically, but, nevertheless, it's very easy
to obtain percentiles from some of its functions. An analogous scheme can
be used with any package that calculates percentiles of arbitrary discrete
distributions. [The essential functioin is 'invcdf']
Commands: MTB> Tally c1;
SUBC> percents;
SUBC> store c2 c3.
MTB> let c3=c3/100
MTB> invcdf p;
SUBC> DISCRETE c2 c3.
This sequence of commands yields a diplay from which the 100pth
percentile of the empirical CDF can be trivially obtained. If used with
p=.25,
it will not give what MINITAB calls Q1, which is (technically) one of Tukey's
hinges.
Dorian Feldman
Mich St Univ
At 05:01 PM 11/6/00 -0400, Harper Shull) wrote:
>Does anyone have an algorithm (computer code) for calculating percentiles.
>There is a formula for doing such in Excel, so it must be possible to
>program. A friend is trying to write a macro to do such in another PC
>based software(Filemaker Pro). Thanks.
>
>
>
>=================================================================
>Instructions for joining and leaving this list and remarks about
>the problem of INAPPROPRIATE MESSAGES are available at
> http://jse.stat.ncsu.edu/
>=================================================================
>
>
=================================================================
Instructions for joining and leaving this list and remarks about
the problem of INAPPROPRIATE MESSAGES are available at
http://jse.stat.ncsu.edu/
=================================================================