From savicky at cs.cas.cz  Fri Jun 29 11:04:06 2007
From: savicky at cs.cas.cz (Petr Savicky)
Date: Fri, 29 Jun 2007 11:04:06 +0200
Subject: [Rd] inaccuracy in qbinom with partial argument matching
In-Reply-To: <Pine.LNX.4.64.0706290701540.30346@gannet.stats.ox.ac.uk>
References: <468422A0.1040808@uni-bayreuth.de>
	<Pine.LNX.4.64.0706290701540.30346@gannet.stats.ox.ac.uk>
Message-ID: <20070629090405.GA8425@cs.cas.cz>

> > ## partial argument matching:
> > qbinom(p0     , s = 3,    p    = 0.25)  ## 1 ???
> > qbinom(p0-0.05, s = 3,    p    = 0.25)  ## 1 ???
> > qbinom(p0-0.06, s = 3,    p    = 0.25)  ## 0 o.K.
> >
> > Unfortunately I have no I idea how to fix this.
> 
> You use a call that specifies your intentions accurately.  This is not 
> 'partial argument matching': 'p' is an exact match to the first argument 
> of
> 
> > args(qbinom)
> function (p, size, prob, lower.tail = TRUE, log.p = FALSE)
> 
> and that is how argument matching in R is documented to work.
> 
> The 'inaccuracy' is in the diagnosis: please see the FAQ.
 
Let me add an explanation, why
  qbinom(p0     , s = 3,    p    = 0.25)
does not produce an error message about missing "prob" argument:
Since "size" and "p" arguments are given, p0 is used for
the third argument and not for the first.

Although the behavior is logical, it may not be immediately clear.
I do not see this case explicitly in FAQ or R-intro.pdf 10.3.

Petr.



[Rd] inaccuracy in qbinom with partial argument matching
Petr Savicky