# Method to obtain density function [closed]

Let us suppose that some real-world experiment is described by a random variable $X$ which is assumed to be (absolutely) continous. The results of the experiment have been written down. My question is how does one recover the density function $f(x)$ such that $P(X\in E) = \int_E f(x)$?

The first idea that I had is to create a histogram plot with a very fine interval subdivision. However, this is not a true histogram plot, rather the height of each bar is replaced by its frequency percentage. We can then connect the midpoints on each bar and get a piecewise linear curve that will approximate some density curve.

However, there is an issue that bothers me. Density functions are not required to satisfy the condition that $0\leq f(x)\leq 1$, while the frequency-percentage histogram plot will generate a function that is bounded in such a way.

• Maybe, this en.wikipedia.org/wiki/Kernel_density_estimation is what you look for. Mar 23, 2016 at 7:39
• Because empirical density is a frequency per unit value, you should be looking at honest-to-goodness histograms, which plot that quantity. (The plot you describe is not, properly speaking a histogram. The distinction is that histograms represent frequencies with area whereas bar charts represent it with length.) For instance, if you collect $20$ beetles and $10$ have body lengths between $3$ and $3.25$ mm, then the height of the histogram bar for the interval $[3,3.25]$ should be $(10/20)/(3.25-3)=2$, not $1/2$.
– whuber
Mar 23, 2016 at 14:58