Add confidence intervals to GLM allEffects plot

梦想与她 提交于 2019-12-10 23:58:54

问题


I need to add 95% confidence intervals on my glm plot.

When I do multiline=T (because I need my 2 treatments on the same plot, so I did this), the intervals disappear. How can I get them back?

This is what I have now:

plot(allEffects(fit1), ylab= "Age of onset of foraging", main="",
     type="rescale", multiline=T, rescale.axis=F)

as data I have -RFID is the technique to identify the honeybees and follow their movements; 2 treatments: control and a pathogen-treatment; "first.trip" - days until their first foraging trip. This (first/trip) is am intersted in and for which I need the 95% confidence intervals on my allEffectsplot..

RFID = 01 0c 1d 1e 1f
colony = A  A  A  B  B
treatment = control DWV control control DWV  
first.trip = 19 NA NA 17 17 17
last.trip = 22  NA NA 17 31 30

回答1:


From ?plot.eff:

ci.style: confidence bounds can be indicated using error bars, using lines or confidence bands, depending on the plot type. ... For multiline plots, the default is ‘"none"’ for no confidence bounds, but style ‘"bars"’ or ‘"bands"’ can also be used.

Using an example from ?plot.eff:

library(effects)
mod.cowles <- glm(volunteer ~ sex + neuroticism*extraversion,
         data=Cowles, family=binomial)
eff.cowles <- allEffects(mod.cowles, xlevels=list(extraversion=seq(0, 24, 6)),
         given.values=c(sexmale=0.5))
plot(eff.cowles, 'neuroticism:extraversion',multiline=TRUE,
     ci.style="band")



来源:https://stackoverflow.com/questions/34472203/add-confidence-intervals-to-glm-alleffects-plot

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!