drc
drc copied to clipboard
problem in 3-parameter weibull?
I've been using W1.3() and W2.3() to fit a 3-parameter Weibull model to data. drc gives 2 parameterizations of the 3-parameter weibull (https://cran.r-project.org/web/packages/drc/drc.pdf):
f(x) = 0 + (d − 0) exp(− exp(b(log(x) − log(e))))
f(x) = 0 + (d − 0)(1 − exp(− exp(b(log(x) − log(e)))))
The documentation states that d represents the upper asymptote, b is the slope at inflection (maximum of first derivative?), and that the curve has an inflection point at dose e. However, plotting these functions and using R to solve for when the 2nd derivative = 0 gives a value different than e for the inflection point. For example:
dd=1
bb = -5
ee = 30
curve(dd*exp(-exp(bb * (log(x) - log(ee))) ) , xlim=c(0,100))
abline(v=ee)
# 1st deriv
g <- function(x) {}
body(g) <- D( expression(dd*exp(-exp(bb * (log(x) - log(ee))) )), "x")
curve(g, xlim=c(0, 100))
abline(v=ee)
# 2nd deriv
g <- function(x) {}
body(g) <- D(D( expression(dd*exp(-exp(bb * (log(x) - log(ee))) )), "x"), "x")
curve(g, xlim=c(0, 100))
abline(v=ee)
uniroot(g, c(20,50)) # should be 30, but is not?
Is the documentation incorrect that e represents the inflection point? Or is there some other explanation?