2

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

Jim
  • 21
  • 1
  • 1
  • 2
  • could you do a test for normality on the log of the data? If the data is lognormal the log of the data should be normal. – WetlabStudent Jan 26 '15 at 01:49
  • @MHH: So it is theoretically accurate to do normality tests on the log of the data, if that is what I am understanding from your comment – Jim Jan 26 '15 at 01:50
  • 1
    Commandment 1 in statistics is "always plot your data". I would probably plot the data and the log transformed data before doing any tests. Do QQ plots, histograms etc; statistical tests for normality have their pitfalls. I can't think of any reason why log tansformed lognormal data would cause any extra problems on top of the problems that many of the normal tests have with normal data. – WetlabStudent Jan 26 '15 at 02:04
  • 1
    Check the following threads, all of which contain relevant information: 1. [hypothesis testing - what's the point if you can't accept](http://stats.stackexchange.com/questions/114027/distribution-hypothesis-testing-what-is-the-point-of-doing-it-if-you-cant-ac) 2. [What tests do I use to confirm residuals are normally distributed?](http://stats.stackexchange.com/questions/36212/what-tests-do-i-use-to-confirm-that-residuals-are-normally-distributed/) 3. [Is normality testing essentially useless?](http://stats.stackexchange.com/questions/2492/is-normality-testing-essentially-useless) ... (ctd) – Glen_b Jan 26 '15 at 07:20
  • 1
    (ctd)... 4. [My distribution is normal, KS doesn't agree](http://stats.stackexchange.com/questions/103345/my-distribution-is-normal-kolmogorov-smirnov-test-doesnt-agree) 5. [How do I know if my residuals are normally distributed?](http://stats.stackexchange.com/questions/96042/regression-how-do-i-know-if-my-residuals-are-normally-distributed) – Glen_b Jan 26 '15 at 07:20

2 Answers2

1

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')
Uri Goren
  • 1,701
  • 1
  • 10
  • 24
1

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.

Glen_b
  • 257,508
  • 32
  • 553
  • 939