From bhs2 at mevik.net  Wed Dec 15 13:21:19 2004
From: bhs2 at mevik.net (=?iso-8859-1?q?Bj=F8rn-Helge_Mevik?=)
Date: Wed Dec 15 13:21:25 2004
Subject: [Rd] R stat functions do not work as stated on the mannual
	(PR#7419)
In-Reply-To: <20041214112717.6C25010F38@slim.kubism.ku.dk> (casadoj@ecc.es's
	message of "Tue, 14 Dec 2004 12:27:17 +0100 (CET)")
References: <20041214112717.6C25010F38@slim.kubism.ku.dk>
Message-ID: <m0y8fz69c0.fsf@bar.nemo-project.org>

> 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

AFAIK, R has no concept of "last parameter" in a function call.  It
has the concept of "first parameter", "second paramter", etc., but not
"last".

>> 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

> 4.- Acording to the mannual, the lower.tail should be the third argument an=
> d not the last one.

No. According to ?pt or args(pt), pt can take five parameters, the
third of which (when they aren't named) is `ncp', not `lower.tail'.

What happens in your calls is that your third argument F is converted
to 0, which is the default for ncp (and then the T is given to
`lower.tail', which is the default value for that parameter).

It is often a very good practice to name the arguments explicitly in
function calls.  Your calls above would be equivalent to

pt(q = 1.1, df = 5)
pt(q = 1.1, df = 5, ncp = F)  # or ncp = 0
pt(q = 1.1, df = 5, ncp = F, lower.tail = T)  # or ncp = 0

You will find that

pt(q = 1.1, df = 5, lower.tail = F)
and
pt(q = 1.1, df = 5, lower.tail = F, log.p = T)
give quite different answers.

-- 
Bj?rn-Helge Mevik


[Rd] R stat functions do not work as stated on the mannual (PR#7419)
=?iso-8859-1?q?Bj=F8rn-Helge_Mevik?=