I have a dataset and I want to show that it has lognormal distribution by using estimated logmu and logsd of it by MLE.

I have read about making dat into bins by using predetermined intervals, but I really do not know how I should provide the test after it!

Consider you have a dataset, and the threshold,logmu,and logsd are estimated. How would you do the Chi squared goodness of fit test for it?

  • $\begingroup$ It's usually better to describe the problem at hand and then allows others to suggest how to go about best solving it. $\endgroup$ Commented Feb 18, 2015 at 19:01

1 Answer 1


I want to show that it has lognormal distribution

Generally speaking, you literally can't. You cannot show that data does have some distribution. You might be able to show it's reasonably close, or that specific alternatives are less likely to have produced the data, but you can't show it has a particular distribution.

If you have enough data you can show it doesn't have a particular distribution, but that's not at all the same thing (and often, an almost useless thing to show when you have the best chance to show it)

How would you do the Chi squared goodness of fit test for it?

  1. If you really want to test goodness of fit*, don't do this. Better to take logs and test normality using a test with decent power. Of the commonly used and widely available tests for normality with a test which has some good power properties against a broad range of alternatives, I'd suggest the Shapiro-Wilk test, unless you have a specific alternative you seek power against, in which case choose your test so as to have good power against that alternative.

    * but ... see 2.

  2. The circumstances where it really makes much sense to formally test goodness of fit are surprisingly few. Usually doing something else makes more sense. So ... why do you want to do this?

  3. if you really must use a chi-squared test, using MLE on the unbinned data means that the distribution is no longer chi-square. It is, however, bounded between a $\chi^2_{m-1}$ and a $\chi^2_{m-p-1}$ distribution function so you can get upper and lower bounds on p-values (and you can use simulation to get the null distribution of the test statistic in any case)

    a) I'd still work on the log-scale (but it's not critical to do so). Divide the range into $m$ sections (bins) of equal probability (power is better, and you can push the expected number per cell lower). Optimally, $m$ should be proportional to $n^{2/5}$ I'd suggest taking something more or less in the vicinity of $1\leq \frac{m}{n^{2/5}}\leq 2$, especially at small $n$, since it can be impractical for several reasons to use the test when there's very few observations per cell. Mann and Wald (1942)[1] suggest that in the limit (as $n\to\infty$), $m\approx 4[\sqrt{2}(n-1)/\Phi^{-1}(1-\alpha)]^{2/5}$ which at $\alpha=0.05^\dagger$ is around $3.75n^{2/5}$; this is quite a broad maximum, however, and smaller values are frequently chosen. You'll want the inverse cdf for calculating the bin boundaries. Find $O_i$, the number of observations in each bin.

    $\dagger$ on the other hand I would generally avoid using $\alpha=0.05$ for testing goodness of fit. Depending on why you are doing it (and how that impacts the relative costs of the two error types) and your sample size, either substantially larger or smaller values are likely to be better. That doesn't affect the calculation of $m$ by all that much, fortunately.

    b) The expected count in each bin is $E_i=n/m$

    c) calculate the chi-squared statistic in the usual manner (the easy bit)

    d) find the bounds on the p-value if working by hand. If you're using a computer, use simulation to get a more accurate p-value.

    [1]: Mann, H. B. and Wald, A (1942),
    "On the Choice of the Number of Class Intervals in the Application of the Chi Square Test"
    Ann. Math. Statist., 13, no. 3, p306-317.
    pdf at project Euclid

  • $\begingroup$ Another question! Do outliers effect X2 test? $\endgroup$
    – Ehsan
    Commented Feb 19, 2015 at 17:25
  • $\begingroup$ If you adopt the usual approach outlined above (which is making the best of a bad situation powerwise more generally), the chi-squared goodness of fit test is quite insensitive to a few even very extreme outliers (this is bad, of course, because you would usually want to reject in the presence of highly unusual outliers). If you want a test that will reject in the presence of outliers, you should look to the Shapiro-Wilk or the Anderson-Darling test (but properly adapted to the case where parameters are estimated, as outlined in D'Agostino and Stephens' book Goodness of fit techniques). $\endgroup$
    – Glen_b
    Commented Feb 19, 2015 at 23:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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