bwchen 发表于 2020-5-9 16:51
把你的数据和整个有关代码发上来
class.code <- as.factor(class.code)
sex.code <- as.factor(sex.code)
model0<-glm(n.policies ~ 1, family= poisson(),data = policies_data)
model1<-glm(n.policies ~ class.code, family= poisson(),data = policies_data)
anova(model0, model1, test = "Chisq")
summary(model1)
confint(model1, level = 0.95)
model2<-glm(n.policies ~ class.code+sex.code, family= poisson(),data = policies_data)
summary(model2)
confint(model2, level = 0.95)
anova(model1, model2, test = "Chisq")
newdata <- data.frame(c(sex.code=1,class.code = 2))
predict.glm(model2, newdata=newdata, type = "response")