[R] Is this a bug of pweibull()?

Sundar Dorai-Raj sundar.dorai-raj at pdf.com
Sat May 11 14:25:17 CEST 2002


> 
> In rw1050, I found that
> > pweibull(3:10, 2)
> [1] 0.9998766 0.9999999 1.0000000 1.0000000       NaN       NaN
> [7]       NaN       NaN
> Warning message:
> NaNs produced in: pweibull(q, shape, scale, lower.tail, log.p)
> 
> more surprisingly,
> > pweibull(3:10, 2.1)
> [1] 0.9999566 1.0000000 1.0000000      -Inf       NaN       NaN
> [7]       NaN       NaN
> Warning message:
> NaNs produced in: pweibull(q, shape, scale, lower.tail, log.p)
> 
> Is this a bug of pweibull() in rw1050?

Looks like a bug in the expm1() C-function.

> expm1(-100)
[1] NaN
Warning message: 
NaNs produced in: expm1(x) 
> exp(-100)-1
[1] -1
> 

One workaround would be to use the lower.tail option:

> 1-pweibull(3:10,2,lower.tail=F)
[1] 0.9998766 0.9999999 1.0000000 1.0000000 1.0000000 1.0000000
1.0000000
[8] 1.0000000
> 1-pweibull(3:10,2.1,lower.tail=F)
[1] 0.9999566 1.0000000 1.0000000 1.0000000 1.0000000 1.0000000
1.0000000
[8] 1.0000000
> 

BTW, this is not a problem in splus6R2.

Sundar

-- 

Sundar Dorai-Raj, Ph.D.
Statistical Methods Engineer
PDF Solutions, Inc.
Richardson TX
(972) 889-3085 x216
(214) 392-7619 cell
sundar.dorai-raj at pdf.com
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list