【发布时间】:2013-11-19 11:21:30
【问题描述】:
过去我在 lme4 中使用 Effects 包非常成功,但现在我遇到了一个使用 glm 的非常简单的示例。当拟合二项式 glm 然后使用 Effect 绘制交互时,我收到一条错误消息"Error in Analyze.model(focal.predictors, mod, xlevels, default.levels,:the following predictor is not in the model: Freq*Gp"。下面是一个简单的例子来说明我的问题。
感谢您的帮助。
Gp<-c(rep("A",20),rep("B",20))
Freq<-c(rep(1,10),rep(2,10),rep(1,10),rep(2,10))
Resp<-sample(c(0,1),40, replace=T)
data<-data.frame(Gp)
data$Freq<-Freq
data$Resp<-Resp
m2<-glm(Resp~Freq*Gp, data,family=binomial)
eff<-Effect("Freq*Gp",m2)
【问题讨论】: