2
$\begingroup$

I have some data in the following manner. 10 3 4 5 6 9 ...

I have to check that the difference between returns is log normal by doing ln(return/previous return).

I know some tests for normality if i do (return - previous return) such as chi square test, kolmogorov-smirnov test, qq test.

I was wondering if there are any similar tests for the lognormal, or perhaps if I could apply the normality tests in the same way

$\endgroup$
5

2 Answers 2

1
$\begingroup$

The usual way to test for lognormality would be to take logs and test for normality.

Then any suitable test of normality would do; a Shapiro Wilk would be a reasonable choice.


However, this leads to the question "why are you testing that?"

"Check" is not the same as "test". Hypothesis tests are not generally useful as checks of assumptions.

In particular, goodness-of-fit tests are only really useful in a limited set of circumstances -- mostly they're used to answer a question we already know the answer to (and one which is actually not the same one we need an answer to).

Your data aren't lognormal, so there is no point in testing a question you know the answer to. A more relevant question would be 'how badly non-lognormal might it be?' or even better 'how much will this affect my inference?'. Those aren't answered by hypothesis tests. They're more like "effect-size" sorts of problems.

$\endgroup$
1
  • $\begingroup$ Some references detailing the check--test dichotomy would be helpful. $\endgroup$
    – Aubergine
    Dec 7, 2021 at 22:47
1
$\begingroup$

If you are using python, normaltest is the function to test if your distribution is normal

import numpy as np
import pandas as pd
import scipy as sp
a=pd.read_csv('your_data_file.csv')
p=sp.stats.mstats.normaltest(a, axis=0).pvalue
if p<0.01:
   print ('distribution is not normal')
p=sp.stats.mstats.normaltest(np.log(a), axis=0).pvalue
if p<0.01:
   print ('distribution is not log-normal')
$\endgroup$
3
  • $\begingroup$ shouldn't it be np.log(x) instead of np.exp(x)? $\endgroup$
    – Stef
    Jul 11, 2020 at 20:57
  • $\begingroup$ @UriGoren you are wrong. It should be np.log(x), not np.exp(x). $\endgroup$
    – tornikeo
    Jan 24, 2021 at 12:27
  • $\begingroup$ I corrected my answer $\endgroup$
    – Uri Goren
    Feb 3, 2021 at 17:53

Your Answer

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

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