[Rd] qbinom when probability is 1 (PR#5900)

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Dec 18 15:57:44 MET 2003


The cases of prob=0 and prob=1 were specifically excluded in the code,
as well as n=0.  I've added special-case code for all of these.

On Thu, 18 Dec 2003 jonathan-cran at swintons.net wrote:

> Full_Name: Jonathan Swinton
> Version: 1.8.0
> OS: Windows 2000
> Submission from: (NULL) (193.132.159.34)
> 
> 
> Calling qbinom with a sample probability of 1 returns NaN
> > qbinom(p=0.95,size=10,prob=1)
> [1] NaN
> 
> I believe that this is wrong and that qbinom(p,size,prob=1) should always be
> size for 0<p<=1.
> 
> The documentation says that 
> 
>  The quantile is defined as the smallest value x such that F(x) >=
>      p, where F is the distribution function. 
> 
> 
> 
> Version:
>  platform = i386-pc-mingw32
>  arch = i386
>  os = mingw32
>  system = i386, mingw32
>  status = 
>  major = 1
>  minor = 8.0
>  year = 2003
>  month = 10
>  day = 08
>  language = R
> 
> Windows 2000 Professional (build 2195) Service Pack 3.0
> 
> Search Path:
>  .GlobalEnv, package:lattice, package:Hmisc, package:XML, package:graph,
> package:methods, package:ctest, package:mva, package:modreg, package:nls,
> package:ts, Autoloads, package:base
> 
> ______________________________________________
> R-devel at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-devel
> 
> 

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-devel mailing list