Dose Response - Global curve fitting using R

半城伤御伤魂 提交于 2019-12-01 00:24:35

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):

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!