[R-sig-ME] Interrupted time series on grouped data with count outcome in glmmTMB

Sokolovsky, Alexander @|ex@nder_@oko|ov@ky @end|ng |rom brown@edu
Wed Aug 23 05:39:56 CEST 2023


Hello Ben,

Thanks for the reply I totally missed the part on "bias adjustment"; this
seems to have done the trick. Wasn't able to figure out how to send it
through to emmeans from ggmeans for whatever reason, but I just went
through the emmeans vignette to get them. Appreciate your help and I'll
avoid cross-posting in the future.

All the best,
-- Alex

On Tue, Aug 22, 2023 at 9:59 PM Ben Bolker <bbolker using gmail.com> wrote:

>     Check the section on "bias adjustment" in the emmeans vignette:
>
>
> https://cran.r-project.org/web/packages/emmeans/vignettes/transformations.html#bias-adj
>
>    I think? you can probably pass these options through ggpredict ...
>
> On 2023-08-22 9:48 p.m., Sokolovsky, Alexander wrote:
> > Hi all,
> >
> > This is my first time sending a question to this list so apologies if I
> > miss something that is typically expected. I am trying to fit an
> > interrupted time series type model on grouped data (by individual).
> > Specifically, I am modeling compliance with a remote survey tool that
> > delivered 5 surveys a day for 28 days across two bursts. The outcome
> > variable is a count of missed surveys on days with any engagement (so
> range
> > 0-4) (https://i.stack.imgur.com/FThRs.png). Ignoring covariates, the
> three
> > focal predictors are thus time (studyday_new), burst (wave), and time
> after
> > burst 2 starts (studyday_new_post). The model is specified as follows
> (and
> > I acknowledge I could be making a mistake here, I tried to follow Ben
> > Bolker's thoughts on fitting this models with temporal autocorrelation in
> > glmmTMB from
> > https://bbolker.github.io/mixedmodels-misc/notes/corr_braindump.html):
> >
> > mod1_mde <- glmmTMB(missed_surveys ~ w1age + school + w1sex + w1hislat +
> > w1racer + studyday_new + wave + studyday_new_post + ar1(studyday_new_t +
> > 0|id) + (1 |id), data = daily_data3_mde, family = "poisson")
> >
> > This model converges. But when I plot the predicted values
> > (using ggpredict from ggeffects) over the observed daily means, the
> > predicted values appear to be underestimating the observed means.
> >
> > Here is the plot: https://i.stack.imgur.com/bRfue.png
> >
> > Now what's interesting to me is that when I fit this model to a gaussian
> > distribution instead, the resulting predicted values are reasonable:
> > https://i.stack.imgur.com/rIYnZ.png
> >
> > And when I fit this model to a poisson distribution but exclude the AR
> > covariance structure and random intercept (both of which are obviously
> > critical) I also get reasonable predicted values:
> > https://i.stack.imgur.com/dWlho.png
> >
> > (Please ignore the different labels on the plots I just copied the syntax
> > from other parts of my code when I was writing it).
> >
> > So is there something I'm missing about getting predicted values from
> this
> > model?
> >
> > All the best,
> > -- Alex
> >
>
> _______________________________________________
> R-sig-mixed-models using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>


-- 
*Alexander W. Sokolovsky, PhD*
Assistant Professor
Center for Alcohol and Addiction Studies
Department of Behavioral and Social Sciences
E: Alexander_Sokolovsky using Brown.edu
P: (401) 863-6629(401) 863-6697 (Fax)
A: Box G-S121-5, Providence, RI 02912
<https://maps.google.com/?q=Box%20G-S121-5%2C%20Providence%2C%20RI%2002912>
W: https://vivo.brown.edu/display/asokolo1
[image: Twitter]AlexSokoPhD <https://twitter.com/AlexSokoPhD>
“The greatest enemy of knowledge is not ignorance, it is the illusion of
knowledge.”
- Stephen Hawking

	[[alternative HTML version deleted]]



More information about the R-sig-mixed-models mailing list