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
and 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?
EDIT:
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: