[R] Plot GEE confindence interval band ggplot2
Rui Barradas
ru|pb@rr@d@@ @end|ng |rom @@po@pt
Tue Jun 1 14:10:18 CEST 2021
Hello,
I don't know if the following is what you want but it gives confidence
bars. The error in your code is to have Esp as id.
dat$Id <- as.integer(factor(dat$Esp))
m5 <- geeglm(
formula = tim ~ Pa*Pt,
family = Gamma(link = log),
data = dat,
id = Id,
corstr = "exchangeable"
)
plot_model(m5, type = "pred", terms = c("Pa", "Pt"))
Hope this helps,
Rui Barradas
Às 23:10 de 31/05/21, Luis Fernando García escreveu:
> Dear all,
>
> I want to plot a Generalized Estimating Equation (GEE) model, with
> interactions and the confidence interval using a similar style to ggplot2
> . I have tried several packages but all of them produce errors. My idea
>
> I wanted to know if anyone knows a graphical package which works with GEE
> or simular solution
>
> Dataset in this link:
> https://docs.google.com/spreadsheets/d/1nXerN91Iehe9OM1VGDMS3jnbvvF1tWcuS9bGtlrj_Ss/edit?usp=sharing
>
> Thanks!
>
> code below:
>
> library(geepack)
> library(ggplot2)
> library(visreg)
> library(sjPlot)
>
> #Copy dataset before following the code
>
> dat <- read.delim("clipboard", dec=","); attach(dat)
> head(dat)
> str(dat)
> names(dat)
> m5<- geeglm(tim~Pa*Pt,id=Esp, Gamma(link=log), corstr="exchangeable")
> anova(m5,test="Chisq")
> visreg(m5, "Pt", by="Pa",band=T, overlay=TRUE)
> plot_model(m5, type = "pred", terms = c("Pa","Pt"))
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
More information about the R-help
mailing list