[R-sig-ME] R-sig-mixed-models Digest, Vol 176, Issue 4

Amirhossei@@Amirhossei@T@iebi m@iii@g oii r@dboudumc@@i Amirhossei@@Amirhossei@T@iebi m@iii@g oii r@dboudumc@@i
Fri Aug 20 17:14:03 CEST 2021


Dear Philip , Thierry, Ben and other list followers,

Thanks for your response.
Maybe the following codes can help you get a feel of the data that I am using, due to working in a cloud server I cannot share the real data I use. I also shared the latest models formula I tried to run but every time I have convergence problems :-(

set.seed(1)
df<-data.frame(id=rep(1:3,each=4),treatment=sample(c(0,1),12,replace = T),
               event=sample(c(0,1),12,replace = T),
               person.time=sample(c(15,31,30),12,replace = T),
               age=rep(c(65,58,74),each=4),gender=rep(c("m","f","m"),each=4))
df$person.time<-ave(df$person.time,df$id,FUN = cumsum)
df$logtime<-log(df$person.time)
# codes for model:
library(lme4)
nbm<-glmer.nb(event~treatment+age+gender+offset(logtime)+(1|id),df,glmerControl(optCtrl = list(maxfun=50)),verbose = T)
#END.


Please note that in data an individual can have multiple events over time and the treatment is a time variant variable; in real data I do not have complete separation problem.

Bests, Amir

________________________________________
From: R-sig-mixed-models <r-sig-mixed-models-bounces using r-project.org> on behalf of r-sig-mixed-models-request using r-project.org <r-sig-mixed-models-request using r-project.org>
Sent: Wednesday, August 4, 2021 12:00 PM
To: r-sig-mixed-models using r-project.org
Subject: R-sig-mixed-models Digest, Vol 176, Issue 4

Send R-sig-mixed-models mailing list submissions to
        r-sig-mixed-models using r-project.org

To subscribe or unsubscribe via the World Wide Web, visit
        https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-sig-mixed-models&data=04%7C01%7Camirhossein.amirhosseintalebi%40radboudumc.nl%7C06b1d8846f0d454b11f908d9572ecf29%7Cb208fe69471e48c48d87025e9b9a157f%7C1%7C0%7C637636680823457341%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=xIoOcJB0H2C4oijXwXBbg9Wajk%2FdOFT7zB48skRVRL0%3D&reserved=0
or, via email, send a message with subject or body 'help' to
        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

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. Re: Theta Value in glmer (Ben Bolker)

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

Message: 1
Date: Tue, 3 Aug 2021 18:23:20 -0400
From: Ben Bolker <bbolker using gmail.com>
To: r-sig-mixed-models using r-project.org
Subject: Re: [R-sig-ME] Theta Value in glmer
Message-ID: <cc456f6e-32b1-6a0a-dc98-91e9423fd11a using gmail.com>
Content-Type: text/plain; charset="utf-8"; Format="flowed"

    I also don't really know what's going on here.

Some thoughts:

    * for NB fits, glmmTMB, which is a bit faster & more stable than
glmer for this special case (and is pretty nearly a drop-in replacement
for glmer.nb)
    * A common case of convergence problems for NB models is when you
try to fit data that are equi-dispersed or underdispersed (conditional
variance <= mean rather than >mean), in which case the theta coefficient
gets very large (and the likelihood surface gets very flat).  In this
case you're better of with a Poisson model anyway ...
    * Not sure what you mean by "the vignette of glmer" - there isn't
any vignette describing glmer in the lme4 package AFAIK ...

On 8/3/21 4:39 PM, Phillip Alday wrote:
> Hi Amir,
>
> can you share an anonymized version of your data? Or give a bit more of
> a minimal working example (MWE)? Then we can probably provide more and
> better help. :)
>
> Best,
> Phillip
>
> On 17/07/2021 01:22, Amirhossein.AmirhosseinTalebi using radboudumc.nl wrote:
>> Dear all,
>>
>> I am trying to fit a negative binomial regression using lme4 package. After several attempts using glmer.nb and having error of convergence, I have switched to glmer function to could set the argument nAGQ=0 and used negative binomial function as the family argument.
>> The question here is, as the theta value in negative binomial function I tried to use the theta value that glm.nb of package MASS gave me (157); but based on the vignette of glmer I can use theta=1.75. Could you please clarify that how can I choose the best theta value here and until what extend that can change my results? Or based on what parameter in model output I can understand that I used the best theta value?
>>
>> Kind regards,
>> Amir
>>
>> De informatie in dit bericht is uitsluitend bestemd voor de geadresseerde. Aan dit bericht en de bijlagen kunnen geen rechten worden ontleend. Heeft u deze e-mail onbedoeld ontvangen? Dan verzoeken wij u het te vernietigen en de afzender te informeren. Openbaar maken, kopi�ren en verspreiden van deze e-mail of informatie uit deze e-mail is alleen toegestaan met voorafgaande schriftelijke toestemming van de afzender. Het Radboudumc staat geregistreerd bij de Kamer van Koophandel in het handelsregister onder nummer 80262783.
>>
>> The content of this message is intended solely for the addressee. No rights can be derived from this message or its attachments. If you are not the intended recipient, we kindly request you to delete the message and inform the sender. It is strictly prohibited to disclose, copy or distribute this email or the information inside it, without a written consent from the sender. Radboud university medical center is registered with the Dutch Chamber of Commerce trade register with number 80262783.
>>
>>      [[alternative HTML version deleted]]
>>
>>
>> _______________________________________________
>> R-sig-mixed-models using r-project.org mailing list
>> https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-sig-mixed-models&data=04%7C01%7Camirhossein.amirhosseintalebi%40radboudumc.nl%7C06b1d8846f0d454b11f908d9572ecf29%7Cb208fe69471e48c48d87025e9b9a157f%7C1%7C0%7C637636680823457341%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=xIoOcJB0H2C4oijXwXBbg9Wajk%2FdOFT7zB48skRVRL0%3D&reserved=0
>
>       [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-mixed-models using r-project.org mailing list
> https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-sig-mixed-models&data=04%7C01%7Camirhossein.amirhosseintalebi%40radboudumc.nl%7C06b1d8846f0d454b11f908d9572ecf29%7Cb208fe69471e48c48d87025e9b9a157f%7C1%7C0%7C637636680823457341%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=xIoOcJB0H2C4oijXwXBbg9Wajk%2FdOFT7zB48skRVRL0%3D&reserved=0
>

--
Dr. Benjamin Bolker
Professor, Mathematics & Statistics and Biology, McMaster University
Director, School of Computational Science and Engineering
Graduate chair, Mathematics & Statistics




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

Subject: Digest Footer

_______________________________________________
R-sig-mixed-models mailing list
R-sig-mixed-models using r-project.org
https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-sig-mixed-models&data=04%7C01%7Camirhossein.amirhosseintalebi%40radboudumc.nl%7C06b1d8846f0d454b11f908d9572ecf29%7Cb208fe69471e48c48d87025e9b9a157f%7C1%7C0%7C637636680823457341%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=xIoOcJB0H2C4oijXwXBbg9Wajk%2FdOFT7zB48skRVRL0%3D&reserved=0


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

End of R-sig-mixed-models Digest, Vol 176, Issue 4
**************************************************
De informatie in dit bericht is uitsluitend bestemd voor de geadresseerde. Aan dit bericht en de bijlagen kunnen geen rechten worden ontleend. Heeft u deze e-mail onbedoeld ontvangen? Dan verzoeken wij u het te vernietigen en de afzender te informeren. Openbaar maken, kopiëren en verspreiden van deze e-mail of informatie uit deze e-mail is alleen toegestaan met voorafgaande schriftelijke toestemming van de afzender. Het Radboudumc staat geregistreerd bij de Kamer van Koophandel in het handelsregister onder nummer 80262783.

The content of this message is intended solely for the addressee. No rights can be derived from this message or its attachments. If you are not the intended recipient, we kindly request you to delete the message and inform the sender. It is strictly prohibited to disclose, copy or distribute this email or the information inside it, without a written consent from the sender. Radboud university medical center is registered with the Dutch Chamber of Commerce trade register with number 80262783.


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