问题
As a follow up to this question answered by @EDi. I wonder how to fit the following glm
model with drc
function from drc
package.
GLM Code
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 Code
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)
I think drm
code also includes the interaction between Rep
and Type
which is not required.
来源:https://stackoverflow.com/questions/36382349/fitting-multiple-logistic-regression-with-interaction-between-quantitative-and-q