Quantitative Finance Stack Exchange is a question and answer site for finance professionals and academics. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If I have calculated the sample mean, variance, skew and kurtosis of a set of data, how would I go about fitting a probability distribution to match these moments (i.e. choosing a probability distribution and optimizing its parameters to fit the sample moments). Are there any packages in R/MATLAB/etc. that are capable of this?

For context, I believe I can calculate these moments for a portfolio's return distribution, but I actually need a whole probability density function for the portfolio's returns in order to perform additional analysis.

share|improve this question
up vote 1 down vote accepted

I asked an almost identical question on the Cross Validated site here. I think my accepted answer, given by Whuber, might be what you are looking for.

share|improve this answer

You should be able to do this with the fitdistr function in the MASS package. You will certainly be able to hold the mean and variance constant, but I'm less sure about skewness and kurtosis (they would need to be arguments to the density function).

The actuar package may also be useful, as it contains additional density functions.

share|improve this answer

If you have a formula giving you the moments as a function of the parameters of the distribution, you can use gmm, in the gmm package: there is a detailed example for the Gaussian distribution in the documentation.

(Of course, in this case, you are only solving a system of equations, and could probably do it by hand: the generalized method of moments (GMM) is typically used when there are more moments than parameters.)

share|improve this answer

Often, we are interested to check if our data is close to normal, then you can use the Jarque-Bera test, where skewness and kurthosis are directly deployed. Look up Matlab implementation.

If you are not constrained to use the moments, you can calculate histogram and use Komogorov-Smirnov test, which can test similarity to any distribution, not necessarily normal. Look up Matlab implementation.

share|improve this answer

It may never have been done, but it seems to me that the Cornish-Fisher expansion for moments up to 4 could be used to trace a density function from a tabulation of the percentiles of the normal distribution, for instance:

$$ w_{\alpha}\cong z_{\alpha}+\frac{1}{6}\left(z_{\alpha}^{2}-1\right)AS+\frac{1}{24}\left(z_{\alpha}^{3}-3z_{\alpha}\right)EKUR-\frac{1}{36}\left(2z_{\alpha}^{3}-5z_{\alpha}\right)AS^{2} $$ where $w_{\alpha}$ is the revised percentile, $z_{\alpha}$ is the percentile for the standard normal distribution, AS is the skewness coefficient and EKUR is the excess kurtosis coefficient (from a kurtosis coefficient of 3 for a normal distribution).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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