Setup: I have data that seems to follow a lognormal distribution. By logging every data point, I can also generate a corresponding normal distribution. I wrote a python script to use maximum likelihood estimation to find the optimized parameters mu and sigma. This script is also used to generate a contour plot of an error metric (z-axis) against the parameters (x- and y- axes), for which the error metric is the negative log likelihood and the reduced chi square value. (I will eventually change this such that the z-axis will be the p-value that corresponds to the reduced chi square value). My full code is a few hundred lines long, but I can provide code upon request; I think my problem is more concept-oriented than code-oriented.

Problem: I noticed that the parameters that optimize the distribution using the maximum likelihood estimation are slightly different than the parameters that optimize the distribution using chi square, as can be seen in the contour plots of lognormal

this subplot of the lognormal distribution

and normal distribution

subplot of the corresponding normal distribution

(NOTE: I'm aware that I need to fix the probability; typo -- the title of the lognormal contour plot of chi square is the chi square value, NOT the probability). Is this normal or expected behavior? Is this more likely if there is group of outliars in the fitted distribution, or perhaps a mixed model? Most importantly, when plotting a distribution fit, which method is more conventional or preferred - maximum likelihood estimation or minimizing chi square?


SOLUTION: I realized that I had overlooked a requirement of measuring chi square. By excluding the observed and expected counts at indices for which the expected counts are below a threshold, the optimized parameters become closer in agreement.

Using a threshold of 5, these are the updated plots that serve as an example of the above:

this subplot of the Gaussian distribution][4]][4

this subplot of the lognormal distribution][3]][3


I think small discrepancies are to be expected: you are not optimizing quite the same thing. Nonetheless, if memory serves me well, both methods will be consistent under mild conditions, so on large samples differences should be negligible.

A long time ago,

Berkson, J. (1980) Minimum chi-square, not maximum likelihood!, Ann. of Statistics, vol. 8, p. 457-487

advocated minimum chi square over maximum likelihood, but subsequent scrutiny led to the conclusion that both were similar.

  • $\begingroup$ Thanks for providing a reference alongside the answer, I will look it up. As a ballpark figure, does negligible mean within 0.05 or is that high? (Not sure if relevant, but 80 bins and around 10^4 data points). $\endgroup$ – MPath May 31 '17 at 8:33
  • $\begingroup$ If you mean a difference of 0.05 in estimated parameters, that depends on the parameterization: change the units and the discrepancy will change as well. If you refer to the error metric you describe in your question, I do not know. $\endgroup$ – F. Tusell May 31 '17 at 8:39

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.