[R] plot.drm in "drc" package

li li hannah.hlx at gmail.com
Tue Aug 30 17:07:17 CEST 2016


Hi all,
  I am trying to use the drc package to fit 4L curve.
I am so confused about the plot.drm function in the drc package.
Particularly, I am confused about the scale of the xaxis in the plots
generated using the plot.drm function. See the example below:

## generate data and fit the model
dose <- rep(50*2^(-(0:11)),3)
dose
d <- 100
c <- 1
b <- 1
e <- 1.6
y <- rnorm(length(dose))+ c+ (d-c)/(1+exp(b*(log(dose)-log(e))))
library(drc)
mod <- drm(y~dose, fct = LL.4())
summary(mod)

Now I plot the data and the fitted curve with the plot.drm using the code
below and get the figure 1 below.


##obtaining figure 1
plot(mod, type="all",log="x")


Next I plot the raw data and add the curve by extracting the estimate of
the parameters.

##extract parameters
para <- mod$fit$par
bhat<- para[1]
chat <- para[2]
dhat <- para[3]
ehat <- para[4]

##plot figure 2
plot(log(dose),y)
points(log(50*2^(-(0:11))),  chat +
(dhat-chat)/(1+exp(bhat*(log(50*2^(-(0:11)))-log(ehat)))), type="l")

My question is regarding the figure 1 generated by the plot.drm.
The x axis is the not the log scale of the doses. I checked the package
manual, it says the default is log base 10. But it is not true in this case.
Does some have some insight on the correct usage of the plot.drm function.

Thanks much in advance.
  Hanna

	[[alternative HTML version deleted]]



More information about the R-help mailing list