[Rd] R stat functions do not work as stated on the mannual (PR#7419)

ligges at statistik.uni-dortmund.de ligges at statistik.uni-dortmund.de
Tue Dec 14 13:04:33 CET 2004


casadoj at ecc.es wrote:

> Dear R Developers:
> 
> I have been playing with R, release 2.0.1 for a week now and have detected =
> that all stat functions related to distribution probabilities have the same=
>  problem:
> 
> 1.- According to the manual the log.p parameter is always the last one.
> 2.- When you use the software, the last parameter seems to be lower.tail
> 
> Example:
> 
> 
>>pt (1.1, 5)
> 
> [1] 0.8392746
> 
>>pt (1.1, 5, F)
> 
> [1] 0.8392746
> 
>>pt (1.1, 5, F, T)
> 
> [1] 0.8392746
> 
>>=0D
> 
> 
> On this example, I have used the Student T distribution. The result of this=
>  example has been tested with the stat calculator at http://calculators.sta=
> t.ucla.edu/.
> 1.- This first line shows that when this function has two arguments, the lo=
> g.p default value is false, and the lower.tail is true.
> 2.- The second line shows that when this function has 3 arguments, the last=
>  one is the log.p argument and the lower.tail is taken by default to true.
> 3.- The third line shows that when this function has 4 arguments, the third=
>  one keeps on being the log.p argument and the lower.tail is the last one.
> 4.- Acording to the mannual, the lower.tail should be the third argument an=
> d not the last one.


This is your bug!!!
Please do read the documentation exactly and do think twice before 
posting bug reports!

According to the manual, pt() has 5 (!!!) arguments:
   pt(q, df, ncp=0, lower.tail = TRUE, log.p = FALSE)

If you do want to use more arguments, why not naming them? It's always 
much less irritating for yourself to name arguments rather than wild 
guessing what the hell the 7th argument of foo() was intended to do in 
your code.

See also the corresponding sections in the docs on argument matching.

Uwe Ligges


> Best regards,
> =0D
> Jos=E9 Luis Casado Mart=EDnez
> ------------------------------------------------------------------
> European Computing Consultants
> C/ Hermanos Garc=EDa Noblejas, N=BA 39, 5=AA, N 1
> 28037 Madrid
> Telf.: 34-91-406 19 15. Fax: 34-91-406 19 16
> Movil: 34-607-750 316
> ------------------------------------------------------------------
> 
> The last line shows that the sum of probabilities of 1.1 using 5 degrees of=
>  freedom adding the lower tail (pt (1.1, 5, F, T)) and not adding the lower=
>  tail ( pt (1.1, 5, F, F)) is 1. This is not the case with log (p).
> 
> 
> 
> _____________________________________________________________________
> Mensaje analizado y protegido, tecnologia antivirus www.trendmicro.es
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-devel at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



More information about the R-devel mailing list