Full_Name: Ole Christensen Version: 1.6.1 OS: linux-gnu Submission from: (NULL) (130.225.18.176) In package boot :> inv.logit(800)[1] NaN where it should have been 1. The problem is caused by exp(x) returning Inf when x is large. One way of fixing the problem [there may be better ways] would be to include the line out[x > 709] <- 1 in inv.logit() Cheers Ole> version_ platform i686-pc-linux-gnu arch i686 os linux-gnu system i686, linux-gnu status major 1 minor 6.1 year 2002 month 11 day 01 language R
olefc@birc.dk writes:> The problem is caused by exp(x) returning Inf when x is large. > > One way of fixing the problem [there may be better ways] would be to include the > line > > out[x > 709] <- 1 > > in inv.logit()Yes, or replace the entire code with something like inv.logit2 <- function(x) ifelse(x > 0, 1 - 1/(1+exp(x)), 1/(1+exp(-x))) -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk) FAX: (+45) 35327907
>>>>> "GB" == Göran Broström <gb@stat.umu.se> >>>>> on Thu, 26 Dec 2002 01:17:21 +0100 (CET) writes:GB> On 25 Dec 2002, Peter Dalgaard BSA wrote: >> olefc@birc.dk writes: >> >> > The problem is caused by exp(x) returning Inf when x is >> large. >> > >> > One way of fixing the problem [there may be better >> ways] would be to include the > line >> > >> > out[x > 709] <- 1 >> > >> > in inv.logit() >> >> Yes, or replace the entire code with something like >> >> inv.logit2 <- function(x) ifelse(x > 0, 1 - 1/(1+exp(x)), >> 1/(1+exp(-x))) GB> Or use 'plogis(x)', eventually with 'lower.tail = ...' GB> ... yes, really! inv.logit() should never have made its way into the boot package at all I think. I mean neither in tto the S-plus "library". plogis() has bveen part of S since ages AFAIK. Martin Maechler <maechler@stat.math.ethz.ch> http://stat.ethz.ch/~maechler/ Seminar fuer Statistik, ETH-Zentrum LEO C16 Leonhardstr. 27 ETH (Federal Inst. Technology) 8092 Zurich SWITZERLAND phone: x-41-1-632-3408 fax: ...-1228 <><