Liaw, Andy
2004-Dec-14 12:42 UTC
[Rd] R stat functions do not work as stated on the mannual ( PR#7419)
> From: casadoj@ecc.es > > > 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 athttp://calculators.stat.ucla.edu/. 1.- This first line shows that when this function has two arguments, the log.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 and not the last one. Which manual did you read? ?pt has: Usage [...] pt(q, df, ncp=0, lower.tail = TRUE, log.p = FALSE) So none of the calls you showed actually passed any thing for log.p to pt(): It's the 5th argument. While it seems to be a convention that log.p is the last argument, the actual position can change from distribution to distribution as the number of parameters can differ. Andy 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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-devel