提问人:Jc_odogwu 提问时间:11/8/2023 最后编辑:AxemanJc_odogwu 更新时间:11/8/2023 访问量:25
用于零膨胀模型的 ggplot
ggplot for zeroinflated models
问:
我运行了下面的零膨胀模型,并希望使用 ggplot 来显示响应(伤害率)的变化,随着模型中包含多项式项的预测变量百分比的增加。
summary(
m2 <- zeroinfl(
Rates_NH_BlacknewSENSrateX ~ Perc_NHBlacknomiss2 + BlacksqNEW2 +
Perc_Hispanicnomiss + Disadvantage_unwnomissx +
Targets_unwnomissx | Perc_NHBlacknomiss2 + Perc_Hispanicnomiss,
data = data
)
)
下面的泊松模型代码工作正常。我想将代码扩展到零膨胀模型。
summary(
m2 <- glm(
Rates_NH_BlacknewSENSrateX ~ Perc_NHBlacknomiss2 + BlacksqNEW2 +
Perc_Hispanicnomiss + Disadvantage_unwnomissx + Targets_unwnomissx,
family="poisson",
data = data
)
)
ggplot(m2, aes(x = Perc_NHBlacknomiss2, y = Rates_NH_BlacknewSENSrateX)) +
ggtitle("All of Illinois") +
xlab("Percentage of NH-Black individuals in community") +
ylab("Injury Rates for NH-Black individuals") +
geom_point() +
stat_smooth(method = "glm", formula = y ~ poly(x, 2), method.args = list(family = "poisson"), col = "red")
感谢您的帮助。
答: 暂无答案
评论