[R-sig-ME] compare result of ZINB model between glmmtmb and zeroinfl function

Ben Bolker bbo|ker @end|ng |rom gm@||@com
Fri May 7 01:33:24 CEST 2021


   Very hard to know what's going on without a reproducible example. 
Can you provide a link to some data?


   Does the glmmTMB model perform equivalently to the zeroinfl model if 
you leave out the random effect term (so that the models should be 
*exactly* equivalent?



On 5/5/21 8:09 AM, ornicha anuchitchanchai wrote:
> Hi,
> 
> 
> I want to run spatial zero-inflated negative binomial regression model. So, I planned to run spatial correlation from glmtmb package but I found problems:
> 
> When running model with function zeroinfl, the model works fine
> 
> 
> Here is my model with zeroinfl function:
> 
> zinbz <- zeroinfl(driver~zone+pop+market+depstore+religious+med+edu+res+conv+busstop+busline+rail+pier+transit+dist_sta+RL_motorway+RL_trunk+

RL_primary+RL_secondary+RL_tertiary+RL_residential+RL_track+RL_footway+RL_livingstreet|pop+market+religious+med+edu+res+

conv+busstop+busline+RL_motorway+RL_trunk+RL_primary+RL_secondary+RL_tertiary+RL_residential+RL_track+RL_footway+RL_livingstreet, 
data=wingrid, dist="negbin")
> 
> 
> but when running with glmmTMB, I got warning:
> 
> Warning messages:
> 1: In fitTMB(TMBStruc) :
> Model convergence problem; non-positive-definite Hessian matrix. See vignette('troubleshooting')
> 2: In fitTMB(TMBStruc) :
> Model convergence problem; function evaluation limit reached without convergence (9). See vignette('troubleshooting')
> 
> here is my code:
> 
> zinb_glmm <- glmmTMB(driver~zone+pop+market+depstore+religious+med+edu+res+conv+busstop+busline+rail+pier+transit+dist_sta+RL_motorway+RL_trunk+RL_primary+RL_secondary+RL_tertiary+RL_residential+RL_track+RL_footway+RL_livingstreet+(1|null), zi=~pop+market+religious+med+edu+res+conv+busstop+busline+RL_motorway+RL_trunk+RL_primary+RL_secondary+RL_tertiary+RL_residential+RL_track+RL_footway+RL_livingstreet, data=wingrid, family=nbinom2)
> 
> 
> (wingrid is my data,
> null is column with value of 1 for all rows)
> 
> And I got this result:
> 
>       AIC      BIC   logLik deviance df.resid
>        NA       NA       NA       NA     1535
> 
> Random effects:
> 
> Conditional model:
>   Groups Name        Variance Std.Dev.
>   null   (Intercept) 1.01     1.005
> Number of obs: 1582, groups:  null, 1
> 
> Overdispersion parameter for nbinom2 family (): 1.02
> 
> Conditional model:
>                    Estimate Std. Error z value Pr(>|z|)
> (Intercept)      1.803e-03         NA      NA       NA
> zonemiddle      -1.047e-02  1.062e-01  -0.099 0.921486
> zoneouter        1.286e-02  1.254e-01   0.103 0.918278
> pop              6.892e-05         NA      NA       NA
> market           1.625e-02  7.505e-02   0.217 0.828535
> depstore         2.863e-02  6.749e-02   0.424 0.671412
> religious       -4.474e-03  3.638e-02  -0.123 0.902110
> med              1.074e-02  2.731e-02   0.393 0.694192
> edu              4.624e-03  2.955e-02   0.156 0.875670
> res              3.904e-02  1.988e-02   1.964 0.049515 *
> conv             4.895e-02  1.474e-02   3.320 0.000901 ***
> busstop          5.870e-02  8.705e-03   6.744 1.54e-11 ***
> busline          1.312e-02  1.480e-02   0.886 0.375492
> rail            -2.076e-03  2.156e-01  -0.010 0.992317
> pier            -8.357e-04  6.122e-02  -0.014 0.989108
> transit          9.169e-03  1.333e-01   0.069 0.945176
> dist_sta        -3.943e-02  6.868e-03  -5.741 9.42e-09 ***
> RL_motorway      6.116e-07  1.991e-05   0.031 0.975492
> RL_trunk         7.563e-05  2.669e-05   2.834 0.004603 **
> RL_primary       3.558e-05  2.221e-05   1.602 0.109159
> RL_secondary     9.770e-05  3.489e-05   2.800 0.005103 **
> RL_tertiary      2.199e-05  2.884e-05   0.762 0.445778
> RL_residential   5.639e-05  1.319e-05   4.276 1.90e-05 ***
> RL_track        -1.745e-04  1.092e-04  -1.599 0.109862
> RL_footway       5.313e-05  2.070e-05   2.567 0.010259 *
> RL_livingstreet  1.314e-06  3.377e-05   0.039 0.968950
> ---
> Signif. codes:  0 �***� 0.001 �**� 0.01 �*� 0.05 �.� 0.1 � � 1
> 
> Zero-inflation model:
>                    Estimate Std. Error z value Pr(>|z|)
> (Intercept)      6.020e-02  6.701e-02   0.898 0.368988
> pop              1.177e-05  1.019e-04   0.116 0.907995
> market          -4.133e-03  3.436e-01  -0.012 0.990401
> religious       -1.511e-02  1.222e-01  -0.124 0.901611
> med             -3.991e-02  9.085e-02  -0.439 0.660462
> edu             -3.506e-02  9.395e-02  -0.373 0.709055
> res             -5.044e-02  5.976e-02  -0.844 0.398597
> conv            -3.881e-02  6.847e-02  -0.567 0.570848
> busstop         -1.306e-01  3.946e-02  -3.310 0.000933 ***
> busline         -1.364e-02  5.989e-02  -0.228 0.819842
> RL_motorway     -4.707e-05  9.994e-05  -0.471 0.637641
> RL_trunk         7.902e-05  1.280e-04   0.617 0.536956
> RL_primary      -2.021e-04  7.746e-05  -2.609 0.009093 **
> RL_secondary    -5.684e-04  1.251e-04  -4.543 5.54e-06 ***
> RL_tertiary      3.062e-05  1.093e-04   0.280 0.779452
> RL_residential  -3.759e-05  7.273e-06  -5.168 2.37e-07 ***
> RL_track         8.114e-04  1.565e-04   5.186 2.15e-07 ***
> RL_footway      -2.662e-04  1.280e-04  -2.079 0.037595 *
> RL_livingstreet  6.237e-05  1.205e-04   0.518 0.604594
> ---
> Signif. codes:  0 �***� 0.001 �**� 0.01 �*� 0.05 �.� 0.1 � � 1
> Warning message:
> In sqrt(diag(vcov)) : NaNs produced
> 
> 
> There is NA result. Also, the result is totally different from result from function zeroinf.
> 
> 
> Regards,
> 
> nichalala
> 
> 
> 
> 	[[alternative HTML version deleted]]
> 
> 
> _______________________________________________
> R-sig-mixed-models using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>



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