# Approximate PDF function from “how many in each range” data

I have the following data which represent how many graduates (out of 578) have an average grade in each range:

$$58$$ with average grade in the range $$[5, 5.99]$$

$$336$$ with average grade in the range $$[6, 6.99]$$

$$148$$ with average grade in the range $$[7, 7.99]$$

$$27$$ with average grade in the range $$[8, 8.99]$$

$$9$$ with average grade in the range $$[9, 10]$$

I want to find a way better than using 5 uniform distributions (one for each one of the 5 ranges) to approximate the PDF of the average grade of the students.

I used the data to get some points of the CDF and tried to interpolate it with natural splines (in R) but I get some negative values for some $$x$$'s (for values of $$x$$ a little above $$5$$). Using linear interpolation for the CDF would solve this problem, but it would be the same as using uniform distributions to approximate the PDF. Does anyone have any other suggestions? Any help is appreciated.

Note 1: The average grade of each student is rounded to $$2$$ decimal digits. That's why numbers like $$5.99, 6.99, ...$$ are used in the ranges above.

Note 2: This data is from my department at the university and since the grades of each course are on a scale $$0-10$$ and the passing grade is $$5$$, it is impossible that a student has an average lower than $$5$$ or greater than $$10$$.

• Splining the square root of the ecdf works reasonably well. To make it taper nicely in the tails, first pad the data at both ends with zero counts. Numerically differentiate the square of the spline function to obtain your estimated PDF. – whuber Sep 24 '20 at 22:16
• Thanks! Your solution works well. – michalis vazaios Sep 25 '20 at 0:45