[R-sig-eco] Fitting a Weibull with a 0 dose

Ben Bolker bbolker at gmail.com
Sun Jan 4 18:25:08 CET 2015


Dixon, Philip M [STAT] <pdixon at ...> writes:

>  Katie, I second Ben's suggestion to use functions in the drc
> library, not nls().  Not only do those functions model binomial or
> overdispersed binomial data, but they provide estimates and
> confidence intervals for the EC50 and any other EC, e.g. EC10.
 
> However, neither handles x=0 very well.  
> The problem is the way the Weibull function is coded.  Instead of
> x^power, both use exp(power*log(x) ...).  
> The first is defined for x=0, the second is not.  
 
> A work around is to use a small positive value for x, e.g. 0.01, as
> you suggest.  If there is some background level of x, so
> experimental dose = 0 is really exposure to a small background
> concentration, that background concentration is an easily justified
> replacement for 0.  If not, I rerun the analysis with different
> choices of small positive value.  If the low dose asymptote is well
> determined by the data, you should get similar parameter values and
> estimated ECx's for any small positive value.  This is a robustness
> check to make sure that an arbitrary choice doesn't affect the
> results.  

> Best wishes, Philip

  I don't disagree with the workaround, but I wanted to point out that
exp(power*log(x)) _does_ work in R when x=0, because log(x) -> -Inf,
any positive number times -Inf is -Inf, and exp(-Inf) -> 0.  This is
sloppy mathematically, but it's according to sensible and well-established
IEEE conventions.  That doesn't mean there aren't other problems ...

> x <- 0
> power <- 0.25
> x^power
[1] 0
> exp(power*log(x))
[1] 0
>



More information about the R-sig-ecology mailing list