[R] ks.test

Martin Maechler
Fri, 09 Nov 2001 16:41:57 -0000

>>>>> "aolinto" == aolinto  <aolinto at
bignet.com.br> writes:

    aolinto> I want to check if a set of measurements follows better a
    aolinto> gamma or a lognormal distribution (see data below).

        ....

    aolinto> To test for gamma (and normal) distribution I would use
    aolinto> ks.test but I need to specify its shape and scale. How should
    aolinto> I calculate these values in R?

    aolinto> I tried

    >> Lt.fit <- glm(Lt ~ 1, family=Gamma)
    >> gamma.shape(Lt.fit)

    aolinto> Alpha: 18.851759
    aolinto> SE:     3.737472

As the function name suggests and  help(gamma.shape) clearly says,
its estimating the shape parameter alpha, and *ITS* standard error which is
not at all the same as the scale parameter you need (and in your case get
from  coef(Lt.fit) !


    >> ks.test(Lt,"pgamma",18.851759,3.737472)
				     ^^^^^^^^
which is wrong!


Martin Maechler <maechler at stat.math.ethz.ch>
http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum  LEO D10	Leonhardstr. 27
ETH (Federal Inst. Technology)	8092 Zurich	SWITZERLAND
phone: x-41-1-632-3408		fax: ...-1228			<><