GROUPED PERCENTILE
GROUPED QUANTILE
Name:
GROUPED PERCENTILE (LET)
GROUPED QUANTILE (LET)
Type:
Purpose:
Compute the percentile (or quantile) for grouped data.
Description:
The PERCENTILE
(QUANTILE) command is used to compute a
specified percentile (quantile) of a univariate response variable.
However, there may be cases where your data is only available as a
frequency table. For these cases, the GROUPED PERCENTILE (QUANTILE)
command can be used to compute a specified percentile (quantile).
If the groups are equi-spaced and the underlying data is continuous,
then the group-id variable may be given as the mid-points of the
group intervals. If the groups are not equi-spaced or if the
underlying data is not continuous, then two group-id variables
should be given: the first specifies the lower limits for the
groups and the second specifies the upper limits for the groups.
To compute the i-th percentile for grouped data, Dataplot does
the following
- If only the group mid-points are provided, these are first
converted to lower and upper class boundaries. The class
width is computed as XMID(2) - XMID(1) (where XMID is the
variable containing the group mid-points). Then the lower
boundary for class i is XMID(i) -
(class width/2) and the upper boundary for class i is
XMID(i) + (class width/2).
- The percentiles corresponding to the upper class boundaries
are computed (100*F(i)/NTOTAL where F(i) is the cumulative
frequency of class i and NTOTAL is the sum of the frequencies
for all classes).
LI>Determine which class the specified percentile falls into. Call
this ICLASS.
- Then use the following formula to compute the specified
percentile
\( p_{i} = l + \frac{(iN/100) - F(ICLASS-1)}{f(ICLASS)} C \)
where
|
i
|
=
|
the specified percentile (a value between 0 and 100)
|
|
l
|
=
|
the lower limit of the ICLASS group
|
|
N
|
=
|
the sum of the frequencies for all groups
|
|
F
|
=
|
the cumulative frequuency for the ICLASS - 1 group
|
|
f
|
=
|
the frequuency for the ICLASS group
|
|
C
|
=
|
the class width for the ICLASS group
|
Note that this formula implicitly assumes that the frequencies are
uniformly distributed within a class.
Syntax 1:
LET <par> = <percentile> GROUPED PERCENTILE <freq>
<xmid>
<SUBSET/EXCEPT/FOR qualification>
where <percentile> is a number or parameter with a value between
0 and 100 that specifies the desired percentile;
<freq> is the variable containing the frequencies;
<xmid> is the variable containing the mid-points of the
groups;
<par> is a parameter where the computed percentile is
saved;
and where the <SUBSET/EXCEPT/FOR qualification> is optional.
This is used for the case where you have equi-spaced intervals for the
groups and the underlying data is assumed to be continuous. The class
width is set to XMID(2) - XMID(1) (where XMID is the group-id
variable), the lower boundary is set to XMID(i) -
(class width/2) and the upper boundary is set to XMID(i) +
(class width/2).
Syntax 2:
LET <par> = <percentile> GROUPED PERCENTILE
<freq> <xlow> <xhigh>
<SUBSET/EXCEPT/FOR qualification>
where <percentile> is a number or parameter with a value between
0 and 100 that specifies the desired percentile;
<freq> is the variable containing the frequencies;
<xlow> is the variable containing the mid-points of the
groups;
<par> is a parameter where the computed percentile is
saved;
and where the <SUBSET/EXCEPT/FOR qualification> is optional.
This is used for the case where you have unequally spaced intervals
or the underlying data may not be continuous. The class width for the
i-th group is XHIGH(i) - XLOW(i) (where XHIGH and
XLOW are the upper and lower class boundaries, respectively).
Syntax 3:
LET <par> = <quantile> GROUPED QUANTILE <freq>
<xmid>
<SUBSET/EXCEPT/FOR qualification>
where <quantile> is a number or parameter with a value between
0 and 1 that specifies the desired quantile;
<freq> is the variable containing the frequencies;
<xmid> is the variable containing the mid-points of the
groups;
<par> is a parameter where the computed quantile is
saved;
and where the <SUBSET/EXCEPT/FOR qualification> is optional.
This is used for the case where you have equi-spaced intervals for the
groups and the underlying data is assumed to be continuous. The class
width is set to XMID(2) - XMID(1) (where XMID is the group-id
variable), the lower boundary is set to XMID(i) -
(class width/2) and the upper boundary is set to XMID(i) +
(class width/2).
Syntax 4:
LET <par> = <quantile> GROUPED quantile
<freq> <xlow> <xhigh>
<SUBSET/EXCEPT/FOR qualification>
where <quantile> is a number or parameter with a value between
0 and 1 that specifies the desired quantile;
<freq> is the variable containing the frequencies;
<xlow> is the variable containing the mid-points of the
groups;
<par> is a parameter where the computed quantile is
saved;
and where the <SUBSET/EXCEPT/FOR qualification> is optional.
This is used for the case where you have unequally spaced intervals
or the underlying data may not be continuous. The class width for the
i-th group is XHIGH(i) - XLOW(i) (where XHIGH and
XLOW are the upper and lower class boundaries, respectively).
Examples:
LET XPERC = 70 GROUPED PERCENTILE FREQ XMID
LET XPERC = 70 GROUPED PERCENTILE FREQ XLOWER XUPPER
LET P = 70
LET XPERC = P GROUPED PERCENTILE Y X
LET XPERC = P GROUPED PERCENTILE Y X1 X2
LET XQUAN = 0.70 GROUPED QUANTILE FREQ XMID
LET XQUAN = 0.90 GROUPED QUANTILE FEEQ XLOWER XUPPER
LET QUANT = 0.80
LET XQUAN = P GROUPED QUANTILE Y X
LET XQUAN = P GROUPED QUANTILE Y X1 X2
Note:
Dataplot statistics can be used in a number of commands. For
details, enter
Default:
Synonyms:
The following can also be used
Related Commands:
|
PERCENTILE
|
=
|
Compute a specified percentile of a response variable.
|
|
QUANTILE
|
=
|
Compute a specified quantile of a response variable.
|
Reference:
Selby (1974), "CRC Standard Mathematical Tables", 22nd Edition,
CRC Press, p. 572.
Applications:
Implementation Date:
Program:
let y = double exponential random numbers for i = 1 1 1000
set histogram empty bins off
set histogram class width normal corrected
let y2 x2 = binned y
.
LET P05 = 5 GROUPED PERCENTILE Y2 X2
LET P10 = 10 GROUPED PERCENTILE Y2 X2
LET P20 = 20 GROUPED PERCENTILE Y2 X2
LET P50 = 50 GROUPED PERCENTILE Y2 X2
LET P80 = 80 GROUPED PERCENTILE Y2 X2
LET P90 = 90 GROUPED PERCENTILE Y2 X2
LET P95 = 95 GROUPED PERCENTILE Y2 X2
PRINT P05 P10 P20 P50 P80 P90 P95
The following output is generated
PARAMETERS AND CONSTANTS--
P05 -- -2.28593
P10 -- -1.59587
P20 -- -0.85970
P50 -- -0.03325
P80 -- 0.77356
P90 -- 1.52499
P95 -- 2.10227
Date created: 09/13/2024
Last updated: 09/13/2024
Please email comments on this WWW page to
[email protected].
|