From murdoch at stats.uwo.ca  Tue Dec 14 12:55:02 2004
From: murdoch at stats.uwo.ca (murdoch@stats.uwo.ca)
Date: Tue Dec 14 12:55:08 2004
Subject: [Rd] R stat functions do not work as stated on the mannual
	(PR#7419)
Message-ID: <20041214115502.2E2A710F1D@slim.kubism.ku.dk>

On Tue, 14 Dec 2004 12:27:17 +0100 (CET), casadoj@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.

Yes, but this is not what you were testing.  You seem to have missed
the ncp parameter.  Is there some documentation somewhere that
neglects to mention the ncp parameter?  Where?

>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

Here you're setting ncp=F, not log.p=F or lower.tail=F.  ncp is the
non-centrality parameter.  If you use a logical there, it will be
treated as 0.

>> pt (1.1, 5, F, T)
>[1] 0.8392746

Here you have ncp=F and lower.tail = T.

Duncan Murdoch

>>=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.
>
>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).


[Rd] R stat functions do not work as stated on the mannual (PR#7419)
murdoch@stats.uwo.ca