[R] test for exponential,lognormal and gammadistribution

Christoph Buser buser at stat.math.ethz.ch
Mon Sep 12 08:20:20 CEST 2005

It depends on your purpose. Often people are using tests to show
that a sample follows a distribution (normal, exponential,
lognormal, ...).
If a test rejects the null hypothesis that the sample comes from
the specified distribution, you are on the safe side, since you
are controlling the significance level (e.g. 5%) and therefore
know the alpha error.
But if a test do not reject the null hypothesis, generally you
have NOT shown that the sample has the specified
distribution. This is related to the power of your test (to
detect differences).
If the power of a test is lousy, the conclusion that "your
sample has the distribution ...". based on the nonsignificant
test result is misleading or even wrong.

As you mentioned below the kolmogorov-smirnov test does not
adapt for the fact that the parameters of the distribution you
test against are estimated from the data sample.
It assumes that the parameters are know. But in practice that's
not the case in general.
Since the parameter are estimated from the data, but the test do
not have this information, but assumes that these parameters are
a fixed known quantity, the test is to conservative and has a
small power to detect differences.
Therefore it is quite dangerous to conclude that a sample has a
specified distribution, based on the kolmogorov-smirnov test.

An alternative way might be using graphical tools, e.g. quantile
plots (see ?qqplot and ?qqnorm).
Obviously you have the same difficulty by interpreting the
plots, since nobody can tell you for sure if a deviation from
the straight line is significant or just by chance.
But if you conclude that a sample has a distribution by looking
at the plot you will be aware of this subjectivity that can not
be avoided.
The test result will often give you the wrong impression of
objectivity.
The best example to see this is if you have a very small
sample. In general any test has a small power if your sample is
small and it is most probable that the test is
nonsignificant. If we look at the quantile plot (with a small
sample) we often can not judge if it is a straight line or not
(since the sample is to small) and in this case it is the
correct conclusion that we can not say anything about the
distribution.

I hope this will be helpful.

Regards,

Christoph Buser

--------------------------------------------------------------
Christoph Buser <buser at stat.math.ethz.ch>
Seminar fuer Statistik, LEO C13
ETH (Federal Inst. Technology)	8092 Zurich	 SWITZERLAND
phone: x-41-44-632-4673		fax: 632-1228
http://stat.ethz.ch/~buser/
--------------------------------------------------------------

riedwyl at giub.unibe.ch writes:
>
> hello!
> i don't want to test my sample data for normality, but exponential- lognormal-
> as i've learnt the anderson-darling-test in R is only for normality and i am
> not supposed to use the kolmogorov-smirnov test of R for parameter estimates
> from sample data, is that true?
> can you help me, how to do this anyway!
> thank you very much!