# What graphs / plots are best suited to visualise percentiles?

I have Year 12 final exam rank of students which is a percentile and information on if they graduated or not. For these 2 classes I want to visualise Year 12 PERCENTILES.

Is a histogram suited for this purpose? If it’s percentage, then I could say x number of students score y%. I have percentiles. Also, I don’t want to choose arbitrary bins like 85-90. It might distort and not give me the right picture of distribution? Please advise what’s best in this case.

I am trying to visualise and understand how Year 12 rank percentiles are distributed among the 2 classes - graduated and drop-outs and if there is a pattern like very high and very low values are among drop-outs etc. The Year 12 percentile score is released state wide indicating how the student has performed among the students in the state of the same age group.

You don't say percentile scores for what. So I'll answer in terms of a hypothetical final comprehensive exam score. Also, you don't say how you choose the percentile of interest, or what your purpose is. So I'll use the 85th percentile as an example.

Theoretical Density Curves for Populations. Suppose students who graduate have exam scores distributed $$\mathsf{Norm}(\mu = 100, \sigma=15).$$ And suppose students who don't graduate have scores distributed $$\mathsf{Norm}(\mu = 75, \sigma=17).$$ Here are density curves for the two populations of test scores, where the vertical red lines show the 85th percentiles of each distribution.

par(mfrow=c(2,1))
curve(dnorm(x, 100, 15), 0, 170, lwd=2, col="blue", ylab="PDF", main=hdr.1)
abline(h=0, col="green2")
abline(v=qnorm(.85, 100, 15), lwd=2, col="red", lty="dotted")
hdr.2 = "Not Graduating: NORM(65, 17)"
curve(dnorm(x, 65, 17), 0, 170, lwd=2, col="cyan3", ylab="PDF", main=hdr.2)
abline(h=0, col="green2")
abline(v=qnorm(.85, 65, 17), lwd=2, col="red", lty="dotted")
par(mfrow=c(1,1))


Histograms for Current Students. Now if you have scores for 2000 graduating students and 200 who did not graduate, data summaries and histograms of the scores from the two groups might be as illustrated below.

set.seed(2020)
Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
47.98   89.84   99.19   99.81  109.87  155.54
85%
115.628

NonG = rnorm(200, 65, 17)
summary(NonG)
Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
23.02   52.56   63.44   63.89   75.31  113.71
quantile(NonG, .85)
85%
81.12229


Now the vertical red lines are the 85th percentiles of the two samples, which are not the same as the 85th percentiles of the theoretical populations from which they were chosen. You are correct that these lines may come in the middle of histogram intervals.

par(mfrow=c(2,1))
cutp = seq(0,170, by=10)
hist(NonG, prob=T, br=cutp, col="skyblue2")
abline(v=quantile(NonG, .85), col="red")
par(mfrow=c(1,1))


ECDF Plots for Finding Percentiles. Sometimes, when dealing with percentiles, the preferred graphical display of a sample is the empirical CDF (ECDF). The data are sorted from smallest to largest. The ECDF starts at $$0$$ at the left and jumps by $$1/n,$$ where $$n$$ is sample size, at each sorted observation. (If data are rounded to integers so that there are ties, then there is a jump of $$k/n$$ when $$k$$ observations are tied at the same value.) At the far right, the maximum value is plotted at $$1.$$

Percentiles can be read directly from the vertical scale. [Some individual points and jumps are visible for the smaller sample of non-graduates.]

par(mfrow=c(1,2))
abline(h = .85, col="green2")
plot(ecdf(NonG))
abline(h = .85, col="green2")
abline(v = quantile(NonG,.85), col="red")
par(mfrow=c(1,1))


I hope some of the ideas illustrated here are useful. If you want to edit your question to give a more complete description of the data you are using, the percentiles that are important, and the goal of you investigation, perhaps one of us can give additional relevant information. (Comments are fine, but important changes need to go into the original Question; not everyone reads comments.)

set.seed(718)
x = rgamma(3000, 3, .01)
par(mfrow=c(1,2))
hdr1 = "Data from GAMMA(3,.01) with KDE and PDF (dashes)"
hist(x, prob=T, br=30, ylim=c(0,.003), col="skyblue2", main=hdr1)