Hello, guys
My name is Tom Hsiung and I’m a healthcare provider. I love statistics. Sometimes we are interested in the median instead of mean when there are outliers.
Can someone guide me where to look for the proof of the method? Thank you.
Maxim 4 helps to answer your question, see https://communities.sas.com/t5/SAS-Communities-Library/Maxims-of-Maximally-Efficient-SAS-Programmers... for details.
data demo;
input value;
datalines;
1
100
3
5
7
2
8
;
proc means data=demo mean median;
var value;
run;
The classical method is to use PROC UNIVARIATE. The mathematical description of how the CIs are estimated is given in the section of the PROC UNIVARIATE documentation "Confidence Limits for Percentiles." The median is the 50th percentile, so plug in p=0.5 into the mathematical formulas. You will see that there are two methods. One assumes that the data are sampled from a normal distribution. The other does not make that assumption.
Here is an example:
proc univariate data=sashelp.class CIPCTLDF CIPCTLNORMAL;
var Height;
ods select quantiles; /* display only the table of quantiles (percentiles) */
run;
The output (shown below) estimates the median height of 19 students to be 62.8 inches. The first 05% CI (which assumes the data are normal) is [59.9, 64.8]. The second interval is wider because it does not assume a distribution of the data. The second CI is [59.0, 66.5]
Hello @TomHsiung,
@TomHsiung wrote:
Can someone guide me where to look for the proof of the method? Thank you.
For a proof see Gibbons and Chakraborti (5th ed., 2010) -- assuming that they haven't removed section 5.2 Confidence Interval for a Population Quantile (p. 157 ff.) from the 4th edition, which I have in front of me. As the heading suggests, they cover the general pth quantile, not only the median.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.