[R] rate instead of scale in ?ks.test

Ramón Casero Cañas 8-T at gmx.net
Sun Oct 2 21:03:37 CEST 2005


I am not sure whether I'm doing something wrong or there is a bug in the
documentation of ks.test. Following the posting guide, as I'm not sure,
I haven't found this in the bug tracker, and the R FAQ says that stats
is an Add-on package of R, I think this is the place to send it.


?ks.test provides the example

<QUOTE>
# Does x come from a shifted gamma distribution with shape 3 and scale 2?
ks.test(x+2, "pgamma", 3, 2) # two-sided
</QUOTE>


Maybe it should say ``with shape 3 and rate 2''?


If I do

> x <- rgamma(1e6, shape = 3, scale = 2)
> ks.test( x, 'pgamma', 3, 2 )

	One-sample Kolmogorov-Smirnov test

data:  x
D = 0.7513, p-value < 2.2e-16
alternative hypothesis: two.sided


whereas with


> y <- rgamma(1e6, shape = 3, rate = 2)
 ks.test( y, 'pgamma', 3, 2 )

	One-sample Kolmogorov-Smirnov test

data:  y
D = 5e-04, p-value = 0.9469
alternative hypothesis: two.sided


If forcing the parameter meaning:

> ks.test( x, 'pgamma', shape = 3, scale = 2 )

	One-sample Kolmogorov-Smirnov test

data:  x
D = 9e-04, p-value = 0.3645
alternative hypothesis: two.sided



> version
platform i386-pc-linux-gnu
arch     i386
os       linux-gnu
system   i386, linux-gnu
status
major    2
minor    1.1
year     2005
month    06
day      20
language R

> packageDescription( "stats" )
Package: stats
Version: 2.1.1
Priority: base
Title: The R Stats Package
Author: R Development Core Team and contributors worldwide
Maintainer: R Core Team <R-core at r-project.org>
Description: R statistical functions
License: GPL Version 2 or later.
Built: R 2.1.1; i386-pc-linux-gnu; 2005-06-29 23:30:55; unix

-- File: /usr/lib/R/library/stats/DESCRIPTION

Cheers,

-- 
Ramón Casero Cañas

web:    http://www.robots.ox.ac.uk/~rcasero/




More information about the R-help mailing list