[R-sig-ME] glmmTMB: Including variable in as fixed effect and in dispersion model (Ben Bolker): R-sig-mixed-models Digest, Vol 174, Issue 21

John Maindonald john@m@|ndon@|d @end|ng |rom @nu@edu@@u
Mon Jun 28 23:37:32 CEST 2021


The gamlss package offers several alternatives to the negative binomial.
The vignette `countDists` in the `qra` package that I have recently sent
to CRAN has a comparison of these (towards the end) on a relatively
simple example.  Shape (where the model has one) as well as scale
parameters can be modelled.  For fitting random effects, see ?gamlss::re
and ?gamlss::random.

The `qra` package implements Fieller’s formula for confidence intervals
for ratios, with the focus on models for a binomial-like response. There
are a couple of other vignettes that investigate a variety of models and
model fits, for binomial-like data and for counts.


John Maindonald             email: john.maindonald using anu.edu.au<mailto:john.maindonald using anu.edu.au>

On 28/06/2021, at 23:29, Andre Syvertsen <Andre.Syvertsen using uib.no<mailto:Andre.Syvertsen using uib.no>> wrote:

Thank you for the feedback. I have attempted NB1 without any luck (model did not converge). Adding "time" to the dispersion model did not seem to influence the resulting simulation either. I have been trying several different adjustments to the models without success. The more general issue that motivated my question is covered in depth at https://stats.stackexchange.com/questions/523171/model-misfit-with-dharma-what-needs-can-be-done

Kind Regards,
Andre

________________________________
Fra: R-sig-mixed-models <r-sig-mixed-models-bounces using r-project.org<mailto:r-sig-mixed-models-bounces using r-project.org>> på vegne av r-sig-mixed-models-request using r-project.org<mailto:r-sig-mixed-models-request using r-project.org> <r-sig-mixed-models-request using r-project.org<mailto:r-sig-mixed-models-request using r-project.org>>
Sendt: lørdag 26. juni 2021 12:00
Til: r-sig-mixed-models using r-project.org<mailto:r-sig-mixed-models using r-project.org> <r-sig-mixed-models using r-project.org<mailto:r-sig-mixed-models using r-project.org>>
Emne: R-sig-mixed-models Digest, Vol 174, Issue 21

Send R-sig-mixed-models mailing list submissions to
       r-sig-mixed-models using r-project.org<mailto:r-sig-mixed-models using r-project.org>

To subscribe or unsubscribe via the World Wide Web, visit
       https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
or, via email, send a message with subject or body 'help' to
       r-sig-mixed-models-request using r-project.org<mailto:r-sig-mixed-models-request using r-project.org>

You can reach the person managing the list at
       r-sig-mixed-models-owner using r-project.org<mailto:r-sig-mixed-models-owner using r-project.org>

When replying, please edit your Subject line so it is more specific
than "Re: Contents of R-sig-mixed-models digest..."


Today's Topics:

  1. glmmTMB: Including variable in as fixed effect and in
     dispersion model (Andre Syvertsen)
  2. Re:  glmmTMB: Including variable in as fixed effect and in
     dispersion model (Ben Bolker)

----------------------------------------------------------------------

Message: 1
Date: Fri, 25 Jun 2021 10:32:49 +0000
From: Andre Syvertsen <Andre.Syvertsen using uib.no<mailto:Andre.Syvertsen using uib.no>>
To: "r-sig-mixed-models using r-project.org<mailto:r-sig-mixed-models using r-project.org>"
       <r-sig-mixed-models using r-project.org<mailto:r-sig-mixed-models using r-project.org>>
Subject: [R-sig-ME] glmmTMB: Including variable in as fixed effect and
       in dispersion model
Message-ID:
       <AM0PR0102MB31726D5E121BCF3BE4F6FF5A9E069 using AM0PR0102MB3172.eurprd01.prod.exchangelabs.com<mailto:AM0PR0102MB31726D5E121BCF3BE4F6FF5A9E069 using AM0PR0102MB3172.eurprd01.prod.exchangelabs.com>>

Content-Type: text/plain; charset="utf-8"

Hi guys,

Is it possible/meaningful to include a variable both as a fixed effect and in the dispersion model? For example, I have run the following model:

m4DaysPlayed <- glmmTMB(daysPlayed ~ 1 + time + ageCategory * gender + (time | id), disp = ~time, dfLong, family = truncated_nbinom2)

Rationale: I want to study the effect of time on the outcome variable, but I have also found evidence for heteorskedasticity when simulating through DHARMa. I suspect that the time variable influences this, the sample size decreases/variation increases as time goes on.

Kind regards,
Andr�

       [[alternative HTML version deleted]]




------------------------------

Message: 2
Date: Fri, 25 Jun 2021 20:35:52 -0400
From: Ben Bolker <bbolker using gmail.com<mailto:bbolker using gmail.com>>
To: r-sig-mixed-models using r-project.org<mailto:r-sig-mixed-models using r-project.org>
Subject: Re: [R-sig-ME]  glmmTMB: Including variable in as fixed
       effect and in dispersion model
Message-ID: <8213affb-ee0d-7839-325e-cdd69630d454 using gmail.com<mailto:8213affb-ee0d-7839-325e-cdd69630d454 using gmail.com>>
Content-Type: text/plain; charset="utf-8"; Format="flowed"

  I don't see why not, although to some extent the negative binomial
error structure should account for the phenomenon you're seeing: since
the variance of the nbinom(2) is var = mu*(1+mu/k), the coefficient of
variation is sqrt(var/mu^2) = sqrt(1/mu + k).  I'm not sure what you
mean by "sample size decreasing", but for a large mean (mu), the CV
should be approximately constant (~ sqrt(k)), while for small mean the
CV should be increasing with decreasing mu (~ sqrt(1/mu)).

  It might be worth trying truncated_nbinom1 as well?



On 6/25/21 6:32 AM, Andre Syvertsen wrote:
Hi guys,

Is it possible/meaningful to include a variable both as a fixed effect and in the dispersion model? For example, I have run the following model:

m4DaysPlayed <- glmmTMB(daysPlayed ~ 1 + time + ageCategory * gender + (time | id), disp = ~time, dfLong, family = truncated_nbinom2)

Rationale: I want to study the effect of time on the outcome variable, but I have also found evidence for heteorskedasticity when simulating through DHARMa. I suspect that the time variable influences this, the sample size decreases/variation increases as time goes on.

Kind regards,
Andr�

      [[alternative HTML version deleted]]


_______________________________________________
R-sig-mixed-models using r-project.org<mailto:R-sig-mixed-models using r-project.org> mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models





------------------------------

Subject: Digest Footer

_______________________________________________
R-sig-mixed-models mailing list
R-sig-mixed-models using r-project.org<mailto:R-sig-mixed-models using r-project.org>
https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models


------------------------------

End of R-sig-mixed-models Digest, Vol 174, Issue 21
***************************************************

[[alternative HTML version deleted]]

_______________________________________________
R-sig-mixed-models using r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models


	[[alternative HTML version deleted]]



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