[Rd] Buglet in qbeta?

Josef Leydold leydold at statmath.wu.ac.at
Wed Oct 7 14:48:26 CEST 2009


Hi,

I sometimes play around with extreme parameters for distributions and
found that qbeta is not always monotone as the following example shows.
I don't know whether this is serious enough to submit a bug report (as
this example is near to the limitations of floating point arithmetic).

Josef

> x <- qbeta((0:100)/100,0.01,5)
> x
  [1]  0.000000e+00 1.253990e-201 1.589622e-171 6.462785e-154 2.015085e-141
  [6] 9.892240e-132 8.192553e-124 4.056003e-117 2.554424e-111 3.330774e-106
 [11] 1.253990e-101  1.728076e-97  1.038529e-93  3.109063e-90 5.141594e-87
 [16]  5.098238e-84  3.238117e-81  1.390549e-78  4.222258e-76 9.411402e-74
 [21]  1.589622e-71  2.090373e-69  2.190596e-67  1.866714e-65 1.316493e-63
 [26]  7.803602e-62  3.941205e-60  1.716606e-58  6.517745e-57 2.178181e-55
 [31]  6.462785e-54  1.715788e-52  4.104801e-51  8.906113e-50 1.762731e-48
 [36]  3.199622e-47  5.352348e-46  8.288322e-45  1.193037e-43 1.602341e-42
 [41]  2.015085e-41  2.380564e-40  2.649862e-39  2.787018e-38 2.776910e-37
 [46]  2.627517e-36  2.366341e-35  2.032732e-34  1.668853e-33 1.311905e-32
 [51]  9.892240e-32  2.220446e-15  2.331468e-15  2.553513e-15 1.110223e-16
 [56]  3.330669e-16  9.992007e-16  8.881784e-16  4.440892e-16 7.771561e-16
 [61]  1.554312e-15  8.881784e-16  9.992007e-16  2.109424e-15 2.331468e-15
 [66]  2.553513e-15  2.553513e-15  1.110223e-16  6.661338e-16 1.221245e-15
 [71]  1.443290e-15  2.220446e-16  6.661338e-16  2.664535e-15 1.054712e-14
 [76]  4.019007e-14  1.512124e-13  5.589973e-13  2.031153e-12 7.261081e-12
 [81]  2.554423e-11  8.847001e-11  3.017724e-10  1.014153e-09 3.359099e-09
 [86]  1.096950e-08  3.532966e-08  1.122586e-07  3.520157e-07 1.089674e-06
 [91]  3.330818e-06  1.005659e-05  3.000050e-05  8.845884e-05 2.579427e-04
 [96]  7.446202e-04  2.133444e-03  6.108393e-03  1.783085e-02 5.699554e-02
[101]  1.000000e+00
> order(x)
  [1]   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16  17  18
 [19]  19  20  21  22  23  24  25  26  27  28  29  30  31  32  33  34  35  36
 [37]  37  38  39  40  41  42  43  44  45  46  47  48  49  50  51  55  68  72
 [55]  56  59  69  73  60  58  62  57  63  70  71  61  64  52  53  65  54  66
 [73]  67  74  75  76  77  78  79  80  81  82  83  84  85  86  87  88  89  90
 [91]  91  92  93  94  95  96  97  98  99 100 101
> pbeta(x,0.01,5)
  [1] 0.0000000 0.0100000 0.0200000 0.0300000 0.0400000 0.0500000 0.0600000
  [8] 0.0700000 0.0800000 0.0900000 0.1000000 0.1100000 0.1200000 0.1300000
 [15] 0.1400000 0.1500000 0.1600000 0.1700000 0.1800000 0.1900000 0.2000000
 [22] 0.2100000 0.2200000 0.2300000 0.2400000 0.2500000 0.2600000 0.2700000
 [29] 0.2800000 0.2900000 0.3000000 0.3100000 0.3200000 0.3300000 0.3400000
 [36] 0.3500000 0.3600000 0.3700000 0.3800000 0.3900000 0.4000000 0.4100000
 [43] 0.4200000 0.4300000 0.4400000 0.4500000 0.4600000 0.4700000 0.4800000
 [50] 0.4900000 0.5000000 0.7285871 0.7289426 0.7296061 0.7070842 0.7148952
 [57] 0.7227924 0.7219416 0.7169548 0.7209782 0.7259930 0.7219416 0.7227924
 [64] 0.7282134 0.7289426 0.7296061 0.7296061 0.7070842 0.7198677 0.7242443
 [71] 0.7254552 0.7120024 0.7198677 0.7299167 0.7400284 0.7499948 0.7599988
 [78] 0.7700008 0.7799998 0.7900000 0.8000000 0.8100000 0.8200000 0.8300000
 [85] 0.8400000 0.8500000 0.8600000 0.8700000 0.8800000 0.8900000 0.9000000
 [92] 0.9100000 0.9200000 0.9300000 0.9400000 0.9500000 0.9600000 0.9700000
 [99] 0.9800000 0.9900000 1.0000000
> version
               _                                                                
platform       x86_64-unknown-linux-gnu                                         
arch           x86_64                                                           
os             linux-gnu                                                        
system         x86_64, linux-gnu                                                
status         Under development (unstable)                                     
major          2                                                                
minor          11.0                                                             
year           2009                                                             
month          10                                                               
day            07                                                               
svn rev        49963                                                            
language       R                                                                
version.string R version 2.11.0 Under development (unstable) (2009-10-07
r49963)

p.s. there are similar results for R-2.9.2 in Windows (with
different round-off errors).


-- 


-----------------------------------------------------------------------------
Josef Leydold   |  WU (Vienna University of Economics and Business)
                |  Department of Statistics and Mathematics
-----------------------------------------------------------------------------
Augasse 2-6     |  Tel.   +43 1 31336 4695
A-1090 Vienna   |  FAX    +43 1 31336 774
European Union  |  email  josef.leydold at wu.ac.at
-----------------------------------------------------------------------------
Alles Unglueck kam daher, dass die Denkenden nicht mehr handeln konnten,
und die Handelnden keine Zeit mehr fanden zu denken.       (Marlen Haushofer)



More information about the R-devel mailing list