Just a thought that I had recently. Suppose given discrete data points for a random variable, could one numerically generate the probability function values at these discrete values? I tried looking into this subject but I couldn't find this subject in numerical analysis. I was interested in this for approximating expected values, standard deviations, etc. 


Maybe someone has encountered this subject before. Thank you.



Finding the distribution of a random variable numerically with sample data?
IANAS, but I'll try an answer.


The problem is known as [density estimation](https://en.wikipedia.org/wiki/Density_estimation). A first option (which you probably will not find satisfactory) is an average of Kronecker deltas centered at the sampled points. Or you can replace the deltas with Gaussians or other shapes ([kernel estimation](https://en.wikipedia.org/wiki/Kernel_smoother)).


As far as I know, in practice it is more common to assume a fixed (parameter-dependent) distribution and fit its parameters to the observed points with techniques such as [maximum likelihood](https://en.wikipedia.org/wiki/Maximum_likelihood).


If you just need to find mean and variance, [sample estimators](https://en.wikipedia.org/wiki/Sample_mean_and_sample_covariance) are the traditional choice, and they do not go through the distribution. Their statistical properties are well studied.


