As a follow up to this question, I fitted the Multiple Logistic Regression with Interaction between Quantitative and Qualitative Explanatory Variables. MWE is given below:>
You use the drc
package to fit logistic dose-response models.
First fit the model
require(drc)
mod <- drm(Kill/Total ~ Conc,
curveid = Type,
weights = Total,
data = df,
fct = L.4(fixed = c(NA, 0, 1, NA)),
type = 'binomial')
Here curveid=
specifies the grouping of the data and fct=
specifies a 4 parameter logistic function, with parameters for lower and upper bond fixed at 0 and 1.
Note the differences to glm
are negligible:
df2 <- with(data=df,
expand.grid(Conc=seq(from=min(Conc), to=max(Conc), length=51),
Type=levels(Type)))
df2$Pred <- predict(object=mod, newdata = df2)
Here's a histgramm of the differences to the glm prediction
hist(df2$Pred - df1$Pred)
Estimate Effective Doses (and CI) from the model
This is easy with the ED()
function:
ED(mod, c(50, 90, 95), interval = 'delta')
Estimated effective doses
(Delta method-based confidence interval(s))
Estimate Std. Error Lower Upper
A:50 9.1468 2.3257 4.5885 13.705
A:90 39.8216 4.3444 31.3068 48.336
A:95 50.2532 5.8773 38.7338 61.773
B:50 16.2936 2.2893 11.8067 20.780
B:90 52.0214 6.0556 40.1527 63.890
B:95 64.1714 8.0068 48.4784 79.864
C:50 12.5477 1.5568 9.4963 15.599
C:90 33.4740 2.7863 28.0129 38.935
C:95 40.5904 3.6006 33.5334 47.648
For each group we get ED50, ED90 & ED95 with CI.