作为this question的后续行动,由@EDi回答。我想知道如何使用glm
包中的drc
函数来拟合以下drc
模型。
GLM代码
Type <- rep(x=LETTERS[1:3], each=5, times=2)
Conc <- rep(rep(x=seq(from=0, to=40, by=10), times=3), 2)
Rep <- factor(rep(x=1:2, each=15))
Total <- 50
Kill <- c(
10, 30, 40, 45, 38, 5, 25, 35, 40, 32, 0, 32, 38, 47, 40,
11, 33, 38, 43, 36, 4, 23, 34, 42, 34, 2, 35, 39, 46, 42
)
df <- data.frame(Type, Conc, Rep, Total, Kill)
fm1 <-
glm(
formula = Kill/Total~Rep+Type*Conc
, family = binomial(link="logit")
, data = df
, weights = Total
)
summary(fm1)
summary(fm1)$coef
anova(object=fm1, test="LRT")
drc代码
library(drc)
fm2 <- drm(Kill/Total ~ Rep+Conc,
curveid = Type,
weights = Total,
data = df,
fct = L.4(fixed = c(NA, 0, 1, NA)),
type = 'binomial'
)
summary(fm2)
我认为drm
代码还包含Rep
和Type
之间的互动,这不是必需的。