[R] ks.test

Martin Maechler maechler at stat.math.ethz.ch
Fri Nov 9 17:41:57 CET 2001

>>>>> "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			<><
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list