I have the following dose response data and wish to plot dose response model and global fit curve. [xdata = drug concentration; ydata(0-5) = response values at different con
First note that the ratio of the largest value of xdata
to the smallest is 2 million so we likely want to use log(xdata)
in place of xdata
.
Now, making this change we get the 4 parameter log-logistic LL2.4
model of the drc package but with a slightly different parameterization than in the question. Assuming that you are ok with these changes we can fit the first model as follows. See ?LL2.4 for the details of the parameterization and see the relevant examples at the bottom of ?ryegrass . Here df
is the df
shown in the question -- the LL2.4 model itself makes the log(xdata)
transformation.
library(drc)
fm1 <- drm(ydata1 ~ xdata, data = df, fct = LL2.4())
fm1
plot(fm1)
Here we fit all 5 models and visually we see from the plot at the end that the fits are pretty good.
library(drc)
fun <- function(yname) {
fo <- as.formula(paste(yname, "~ xdata"))
fit <- do.call("drm", list(fo, data = quote(df), fct = quote(LL2.4())))
plot(fit)
fit
}
par(mfrow = c(3, 2))
L <- Map(fun, names(df)[-1])
par(mfrow = c(1, 1))
sapply(L, coef)
giving:
ydata1 ydata2 ydata3 ydata4 ydata0
b:(Intercept) -1.37395 -1.1411 -1.1337 -1.0633 -1.6525
c:(Intercept) 0.70388 1.9364 1.5800 1.3751 5.7010
d:(Intercept) 101.02741 122.0825 120.8042 108.2420 107.9106
e:(Intercept) 6.17225 5.0686 4.3215 3.7139 3.2813
and the following graphical fits (click on the image to expand it):