# [R-sig-ME] Zero-truncated Poisson distribution in glmmTMB

Erik Solbu er|k@@o|bu @end|ng |rom n|b|o@no
Sat Apr 25 15:55:00 CEST 2020

```Thank you for your reply and reference. I see that they're equivalent, but isn't the term '(1|species)' already an OLRE effect?

Regards,

Erik

Last ned Outlook for iOS<https://aka.ms/o0ukef>
________________________________
Fra: Mollie Brooks <mollieebrooks using gmail.com>
Sendt: Saturday, April 25, 2020 12:17:37 PM
Til: Erik Solbu <erik.solbu using nibio.no>
Kopi: r-sig-mixed-models using r-project.org <r-sig-mixed-models using r-project.org>
Emne: Re: [R-sig-ME] Zero-truncated Poisson distribution in glmmTMB

The poilogMLE function is fitting a Poisson-lognormal which is equivalent to a Poisson with an observation level random effect (OLRE) to account for overdispersion. So to make the models similar, you probably need to add
df_01\$obs = row.names(df_01)
and then add (1|obs) to your model formulas.

Here is a reference about OLREs https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4194460/

cheers,
Mollie

On 25Apr 2020, at 9:24, Erik Solbu <erik.solbu using nibio.no<mailto:erik.solbu using nibio.no>> wrote:

Hi everyone,

I'm trying to replace a package called 'poilog' with glmmTMB, but the results differ in such a way that I'm not sure how to interpret the results from glmmTMB.  I've written a short example below:

#### Start of code ####

# Required packages
library(poilog)
library(glmmTMB)

# Simulate using the 'poilog' package
# sim_01 <- rpoilog(S = 1000, mu = 0, sig = 2, keep0 = TRUE)
# This is the same as
sim_01 <- rpois(n = 1000, lambda = exp(rnorm(n = 1000, mean = 0, sd = 2)))

# estimate the parameters
# using the 'poilog' package, assume regular Poisson distribution
est_01 <- poilogMLE(n = sim_01, zTrunc = FALSE)
# using the 'poilog' package, assume zero truncated Poisson distribution
est_02 <- poilogMLE(n = sim_01[sim_01>0], zTrunc = TRUE)

# make data.frame for glmmTMB estimation
df_01 <- data.frame(abundance = sim_01,
species = 1:length(sim_01))

# using the 'glmmTMB' package, assume regular Poisson distribution
est_03 <- glmmTMB(abundance ~ (1 | species),
family = poisson(link = "log"),
data = df_01)
# using the 'glmmTMB' package, assume zero truncated Poisson distribution
est_04 <- glmmTMB(abundance ~ (1 | species),
family = truncated_poisson(link = "log"),
data = df_01[df_01\$abundance>0, ])

# Compare estimates
est_df <- data.frame(method = rep(c("poilog", "glmmmTMB"), each = 2),
assumptions = rep(c("poisson", "truncated_poisson"), 2),
mu = c(est_01\$par, est_02\$par,
est_03\$fit\$par, est_04\$fit\$par),
sigma = c(est_01\$par, est_02\$par,
exp(c(est_03\$fit\$par, est_04\$fit\$par))))

est_df

#### End of code ####

When I fit the truncated_poisson model in glmmTMB, the mean increases and the standard deviation decreases, which is similar to what happens if you ignore the zeros and fit a regular poisson distribution, but it doesn't seem to be doing quite that either.

So, I'm hoping anyone knew how to interpret the mean and standard deviation from the truncated_poisson output and how they relate to the mean and standard deviation of a regular poisson model?

Thank you very much for reading this and any response is much appreciated.

Best regards,

Erik

[[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

[[alternative HTML version deleted]]

```