plogis bug

Bill Simpson wsimpson@uwinnipeg.ca
Sun, 5 Apr 1998 11:02:14 -0500 (CDT)


plogis seems broken:

> xfit<-seq(1,5,.1)
> pfit<-pnorm(-(3-xfit)/1)
> pfit
 [1] 0.02275013 0.02871656 0.03593032 0.04456546 0.05479929 0.06680720
 [7] 0.08075666 0.09680048 0.11506967 0.13566606 0.15865525 0.18406013
[13] 0.21185540 0.24196365 0.27425312 0.30853754 0.34457826 0.38208858
[19] 0.42074029 0.46017216 0.50000000 0.53982784 0.57925971 0.61791142
[25] 0.65542174 0.69146246 0.72574688 0.75803635 0.78814460 0.81593987
[31] 0.84134475 0.86433394 0.88493033 0.90319952 0.91924334 0.93319280
[37] 0.94520071 0.95543454 0.96406968 0.97128344 0.97724987
> pfit<-plogis(-(3-xfit)/1)
> pfit
 [1] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
 [8] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
[15] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.5000000
[22] 0.5249792 0.5498340 0.5744425 0.5986877 0.6224593 0.6456563 0.6681878
[29] 0.6899745 0.7109495 0.7310586 0.7502601 0.7685248 0.7858350 0.8021839
[36] 0.8175745 0.8320184 0.8455347 0.8581489 0.8698915 0.8807971
notice all the zeros--this is wrong.

> myplogis<-function(q)
{
1/(1+exp(-q))
}+ + + 
> pfit<-myplogis((-(3-xfit)/1))
> pfit
 [1] 0.1192029 0.1301085 0.1418511 0.1544653 0.1679816 0.1824255 0.1978161
 [8] 0.2141650 0.2314752 0.2497399 0.2689414 0.2890505 0.3100255 0.3318122
[15] 0.3543437 0.3775407 0.4013123 0.4255575 0.4501660 0.4750208 0.5000000
[22] 0.5249792 0.5498340 0.5744425 0.5986877 0.6224593 0.6456563 0.6681878
[29] 0.6899745 0.7109495 0.7310586 0.7502601 0.7685248 0.7858350 0.8021839
[36] 0.8175745 0.8320184 0.8455347 0.8581489 0.8698915 0.8807971

I actually looked at plogis.c and it looks fine.  Not sure what is causing
the trouble.

Bill Simpson

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel 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-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._