Hi Trent, Yes, I believe it is the former as well. Chris Howden B.Sc. (Hons) Founding Partner Data Analysis, Modelling and Training Evidence Based Strategy/Policy Development, IP Commercialisation and Innovation (mobile) +61 (0) 410 689 945 | (skype) chris at trickysolutions.com.au<mailto:chris at trickysolutions.com.au> From: DENNIS, TRENT <dennis.tm.1 at pg.com> Sent: Tuesday, 30 September 2025 11:02 PM To: Chris Howden <chris at trickysolutions.com.au>; r-sig-mixed-models at r-project.org Subject: Re: glmmTMB Zero-inflated Gamma GLMM Business Use Hi Chris, You've made a great point, my ultimate goal is to simulate new individuals. I should have also reported the estimate of the subject variance component because this would serve as the variance when drawing new random intercepts from a normal distribution. My real question was whether I draw normal rvs that get put into my linear predictor for the gamma, or if I draw normal rvs and these get added to my overall response separately from the gamma rv. I believe it is the former, but I have never read a textbook on the specifics of this topic and wanted to ask some experts. I know that in glmmTMB at least, when you use predict(model) and specify the type, they will bake the random intercepts for a given subject into the linear predictor for the component you fit them in (if you fit random subject in conditional gamma, it will put each subjects random intercept into the gamma linear predictor, same with zero component)...which would support the former of my two options above. Trent,
From: Chris Howden <chris at trickysolutions.com.au<mailto:chris at trickysolutions.com.au>>
Sent: Monday, September 29, 2025 7:13 PM
To: DENNIS, TRENT <dennis.tm.1 at pg.com<mailto:dennis.tm.1 at pg.com>>; r-sig-mixed-models at r-project.org<mailto:r-sig-mixed-models at r-project.org> <r-sig-mixed-models at r-project.org<mailto:r-sig-mixed-models at r-project.org>>
Subject: RE: glmmTMB Zero-inflated Gamma GLMM
Sent: Monday, September 29, 2025 7:13 PM
To: DENNIS, TRENT <dennis.tm.1 at pg.com<mailto:dennis.tm.1 at pg.com>>; r-sig-mixed-models at r-project.org<mailto:r-sig-mixed-models at r-project.org> <r-sig-mixed-models at r-project.org<mailto:r-sig-mixed-models at r-project.org>>
Subject: RE: glmmTMB Zero-inflated Gamma GLMM
[EXTERNAL]
Hi Trent,
I'm not familiar with glmmTMB, so take what I say here with a grain of salt!
Assuming you are adding a random intercept (it looks like that's what yr doing). Then I think it depends on whether you want to simulate just those 3 individuals, or the population.
If its just those 3 individuals then wouldn't you add their BLUP to the overall intercept in the linear predictor? And after that simulate the gamma rv for each of these 3 individuals only?
On the other hand if you want to simulate new individuals than I think you'd draw their simulated "BLUPS" from an appropriate distribution (which I think is usually a normal distribution with mean = 0 and SD as per yr model) - and then continue as above?
Chris Howden B.Sc. (Hons)
Founding Partner
Data Analysis, Modelling and Training
Evidence Based Strategy/Policy Development, IP Commercialisation and Innovation
(mobile) +61 (0) 410 689 945 | (skype) chris at trickysolutions.com.au<mailto:chris at trickysolutions.com.au>
-----Original Message-----
From: R-sig-mixed-models <r-sig-mixed-models-bounces at r-project.org<mailto:r-sig-mixed-models-bounces at r-project.org>> On Behalf Of DENNIS, TRENT via R-sig-mixed-models
Sent: Tuesday, 30 September 2025 7:15 AM
To: r-sig-mixed-models at r-project.org<mailto:r-sig-mixed-models at r-project.org>
Subject: [R-sig-ME] glmmTMB Zero-inflated Gamma GLMM
Business Use
Hello,
I am trying to simulate a response from a zero-inflated Gamma generalized linear mixed-effect model and have a question when it comes to the random effects. I am fitting the models with glmmTMB, using ziGamma as the family with a log link function.
Say I fit the model with a random effect for subject (N=3 subjects) and 1 covariate (treatment), which I only include in the conditional Gamma model. Example code:
model <- glmmTMB(Lactobacillus_crispatus~Treatment+(1|Subject),
ziformula = ~ 1,
family = ziGamma(link="log"),
data=data)
These are the coefficients I get:
Conditional model:
Intercept: 1.5
Treatment A: -1
Zero model:
Intercept: 1.8
Random effects, conditional:
Subject 1: -2
Subject 2: 0.5
Subject 3: 1
Would you incorporate the random effects into the linear predictor for the Gamma component then simulate Gamma rv, or do the random effects get used to simulate a normal rv which is then added to the Gamma rv? (I also simultaneously simulate a binomial rv based on the proability an observation will be non-zero and multiply this by corresponding Gamma rv to complete the zero-inflated component).
I have simplified my data for illustration sake. The real data is metagenomic species data with 23 subjects. Each subject was swabbed/sequenced at 7 visits and 8 anatomical sites per visit.
Any info would be greatly appreciated.
Thank you,
[[alternative HTML version deleted]]
_______________________________________________
R-sig-mixed-models at r-project.org<mailto:R-sig-mixed-models at r-project.org> mailing list https://urldefense.com/v3/__https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models__;!!NgSi4SaN6ydtRVQ-!xnUtAYJ9DWhuOK_-6LpOk9aBPtFCbFFTBAK7slm1k4eg8S2yXWon0hrc2y2ZmfXl7Qp0q4XJ2PpLf7JjP2duAQ$<https://urldefense.com/v3/__https:/stat.ethz.ch/mailman/listinfo/r-sig-mixed-models__;!!NgSi4SaN6ydtRVQ-!xnUtAYJ9DWhuOK_-6LpOk9aBPtFCbFFTBAK7slm1k4eg8S2yXWon0hrc2y2ZmfXl7Qp0q4XJ2PpLf7JjP2duAQ$>