2
$\begingroup$

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.

$\endgroup$
3
$\begingroup$

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))
 hdr.1 = "Graduating: NORM(100, 15)"
 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))

enter image description here

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)
Grad = rnorm(2000, 100, 15)
summary(Grad)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
  47.98   89.84   99.19   99.81  109.87  155.54 
quantile(Grad, .85)
    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(Grad, prob=T, br=cutp, col="skyblue2")
  abline(v=quantile(Grad, .85), col="red")
 hist(NonG, prob=T, br=cutp, col="skyblue2")
  abline(v=quantile(NonG, .85), col="red")
par(mfrow=c(1,1))

enter image description here

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))
 plot(ecdf(Grad))
  abline(h = .85, col="green2")
  abline(v = quantile(Grad,.85), col="red")
 plot(ecdf(NonG))
  abline(h = .85, col="green2")
  abline(v = quantile(NonG,.85), col="red")
par(mfrow=c(1,1))

enter image description here

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.)

Addendum to show graphs mentioned in 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)
  curve(dgamma(x,3,.01), add=T, col="red", lwd=3, lty="dashed")
  lines(density(x), lwd=2)  # KDE
hdr2 = "ECDF of Data and CDF (dashes) of Population"
plot(ecdf(x), col="blue", main=hdr2)
  curve(pgamma(x,3,.01), add=T, col="red", lwd=3, lty="dashed")
par(mfrow=c(1,1))

enter image description here

$\endgroup$
2
  • $\begingroup$ Is ECDF same as Kernel Density plots ? I have added more information to my question. @bruceet $\endgroup$
    – learner
    Jul 19 '20 at 5:26
  • 1
    $\begingroup$ ECDF of a large dataset will approximate the CDF of the population; Kernel Density Estimate based on a large dataset will approximate the PDF (density) of the population. See Addendum to Answer for graphic. // For clarity discussing percentiles (or other quanitles) it is probably best to use ECDF and CDF. $\endgroup$
    – BruceET
    Jul 19 '20 at 6:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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