2

I'm trying to estimate parameter for Zero-inflated Conway Maxwell Poisson Mixed Model. I'm not getting why GlmmTMP function is giving approx half value for the non zero effect part and giving nice estimates for the Zero part and dispersion part?

E.g:- Actual value for intercept is 2.5 and I'm getting 1.21 for sexfemale actual value is 1.2 and I'm getting 0.548342 please help me out in this situation? Thank you

#--------Simulation from ZICOMP mix lambda---------
library(COMPoissonReg)
library(glmmTMB)
set.seed(123)
n <- 100 # number of subjects
K <- 8 # number of measurements per subject
t_max <- 5 # maximum follow-up time

# we constuct a data frame with the design: 
# everyone has a baseline measurment, and then measurements at random follow-up times
DF_CMP <- data.frame(id = rep(seq_len(n), each = K),
                     time = c(replicate(n, c(0, sort(runif(K - 1, 0, t_max))))),
                     sex = rep(gl(2, n/2, labels = c("male", "female")), each = K))

# design matrices for the fixed and random effects non-zero part
X <- model.matrix(~ sex * time, data = DF_CMP)
Z <- model.matrix(~ 1, data = DF_CMP)
# design matrices for the fixed and random effects zero part
X_zi <- model.matrix(~ sex, data = DF_CMP)

betas <- c(2.5 , 1.2 , 2.3, -1.5) # fixed effects coefficients non-zero part
shape <- 2 
gammas <- c(-1.5, 0.9) # fixed effects coefficients zero part
D11 <- 0.5 # variance of random intercepts non-zero part

# we simulate random effects
b <- rnorm(n, sd = sqrt(D11))
# linear predictor non-zero part
eta_y <- as.vector(X %*% betas + rowSums(Z * b[DF_CMP$id,drop = FALSE]))
# linear predictor zero part
eta_zi <- as.vector(X_zi %*% gammas)
DF_CMP$CMP_y <- rzicmp(n * K, lambda = exp(eta_y), nu = shape, p = plogis(eta_zi))
hist(DF_CMP$CMP_y)
#------ estimation -------------
CMPzicmpm0 = glmmTMB(CMP_y~ sex*time + (1|id) , zi= ~ sex, data = DF_CMP, family=compois)

summary(CMPzicmpm0)
> summary(CMPzicmpm0)
 Family: compois  ( log )
Formula:          CMP_y ~ sex * time + (1 | id)
Zero inflation:         ~sex
Data: DF_CMP

     AIC      BIC   logLik deviance df.resid 
  4586.2   4623.7  -2285.1   4570.2      792 

Random effects:

Conditional model:
 Groups Name        Variance Std.Dev.
 id     (Intercept) 0.1328   0.3644  
Number of obs: 800, groups:  id, 100

Overdispersion parameter for compois family (): 0.557 

Conditional model:
                Estimate Std. Error z value Pr(>|z|)    
(Intercept)     1.217269   0.054297   22.42  < 2e-16 ***
sexfemale       0.548342   0.079830    6.87 6.47e-12 ***
time            1.151549   0.004384  262.70  < 2e-16 ***
sexfemale:time -0.735348   0.009247  -79.52  < 2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Zero-inflation model:
            Estimate Std. Error z value Pr(>|z|)    
(Intercept)  -1.6291     0.1373 -11.866  < 2e-16 ***
sexfemale     0.9977     0.1729   5.771 7.89e-09 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

0 Answers0