Plot GEE confindence interval band ggplot2

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Plot GEE confindence interval band ggplot2

LFG85
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]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Plot GEE confindence interval band ggplot2

Rui Barradas
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]]
>
> ______________________________________________
> [hidden email] 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.
>

______________________________________________
[hidden email] 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.