# st: LogL of null model in zinb and zip

 From Garry Anderson <[email protected]> To [email protected] Subject st: LogL of null model in zinb and zip Date Thu, 20 Dec 2007 21:36:54 +1100

```Dear Statalist,

I have a query about the calculation of the log-likelihood for the null
model of a zero-inflated negative binomial or zero-inflated Poisson.

I would have expected the null model to be
-webuse fish-
-zinb count ,inf(_cons)-

However, it appears that the null model is
-zinb count ,inf(varlist)-
where varlist is a floating list of variables depending on what
variables are in the model at the time of estimating the two models that
one wishes to compare.

When two models are compared with a likelihood ratio test and they
differ only in the inflate part of the model, the warning message is

. lrtest full .
log likelihood of null models differ: -442.663 vs. -461.7623
r(498);

. lrtest full .,force stat

Likelihood-ratio test                                  LR chi2(1)  =
70.19
(Assumption: . nested in full)                         Prob > chi2 =
0.0000

------------------------------------------------------------------------
-----
Model |    Obs    ll(null)   ll(model)     df          AIC
BIC
-------------+----------------------------------------------------------
-----
. |    250   -461.7623   -436.6451      6     885.2902
906.419
full |    250    -442.663   -401.5478      7     817.0955
841.7457
------------------------------------------------------------------------
-----

The question is why is a ll(null) calculated that differs between the
models?
I think calculation of a null model without any variables in the count
part and inflate part of the model would suppress the warning message.

Further output follows

webuse fish

. zinb count persons livebait,inf(child camper) nolog

Zero-inflated negative binomial regression        Number of obs   =
250
Nonzero obs     =
108
Zero obs        =
142

Inflation model = logit                           LR chi2(2)      =
82.23
Log likelihood  = -401.5478                       Prob > chi2     =
0.0000

------------------------------------------------------------------------
------
|      Coef.   Std. Err.      z    P>|z|     [95% Conf.
Interval]
-------------+----------------------------------------------------------
------
count        |
persons |   .9742984   .1034938     9.41   0.000     .7714543
1.177142
livebait |   1.557523   .4124424     3.78   0.000     .7491503
2.365895
_cons |  -2.730064    .476953    -5.72   0.000    -3.664874
-1.795253
-------------+----------------------------------------------------------
------
inflate      |
child |   3.185999   .7468551     4.27   0.000      1.72219
4.649808
camper |  -2.020951    .872054    -2.32   0.020    -3.730146
-.3117567
_cons |  -2.695385   .8929071    -3.02   0.003     -4.44545
-.9453189
-------------+----------------------------------------------------------
------
/lnalpha |   .5110429   .1816816     2.81   0.005     .1549535
.8671323
-------------+----------------------------------------------------------
------
alpha |   1.667029   .3028685                      1.167604
2.380076
------------------------------------------------------------------------
------

. est sto full

Delete child from the inflate part of the model

. zinb count persons livebait,inf(camper) nolog

Zero-inflated negative binomial regression        Number of obs   =
250
Nonzero obs     =
108
Zero obs        =
142

Inflation model = logit                           LR chi2(2)      =
50.23
Log likelihood  = -436.6451                       Prob > chi2     =
0.0000

------------------------------------------------------------------------
------
|      Coef.   Std. Err.      z    P>|z|     [95% Conf.
Interval]
-------------+----------------------------------------------------------
------
count        |
persons |   .7979216   .1182117     6.75   0.000      .566231
1.029612
livebait |   1.636112   .4472886     3.66   0.000     .7594425
2.512782
_cons |  -2.539434   .5485813    -4.63   0.000    -3.614634
-1.464235
-------------+----------------------------------------------------------
------
inflate      |
camper |  -3.947683   20.70017    -0.19   0.849    -44.51926
36.6239
_cons |  -.5245453   .7055834    -0.74   0.457    -1.907463
.8583728
-------------+----------------------------------------------------------
------
/lnalpha |   1.047034   .4478706     2.34   0.019     .1692237
1.924844
-------------+----------------------------------------------------------
------
alpha |   2.849188   1.276067                      1.184385
6.85408
------------------------------------------------------------------------
------

. lrtest full .
log likelihood of null models differ: -442.663 vs. -461.7623
r(498);

. lrtest full .,force stat

Likelihood-ratio test                                  LR chi2(1)  =
70.19
(Assumption: . nested in full)                         Prob > chi2 =
0.0000

------------------------------------------------------------------------
-----
Model |    Obs    ll(null)   ll(model)     df          AIC
BIC
-------------+----------------------------------------------------------
-----
. |    250   -461.7623   -436.6451      6     885.2902
906.419
full |    250    -442.663   -401.5478      7     817.0955
841.7457
------------------------------------------------------------------------
-----
Note:  N=Obs used in calculating BIC; see [R] BIC note

. zinb count ,inf(_cons)

Fitting constant-only model:

Iteration 0:   log likelihood = -519.33992
Iteration 1:   log likelihood = -473.30482
Iteration 2:   log likelihood = -466.55445
Iteration 3:   log likelihood = -465.53667
Iteration 4:   log likelihood = -464.82369
Iteration 5:   log likelihood = -464.60737
Iteration 6:   log likelihood = -464.48975
Iteration 7:   log likelihood = -464.44921
Iteration 8:   log likelihood = -464.44138
Iteration 9:   log likelihood = -464.43977
Iteration 10:  log likelihood = -464.43942
Iteration 11:  log likelihood = -464.43934
Iteration 12:  log likelihood = -464.43932

Fitting full model:

Iteration 0:   log likelihood = -464.43932
Iteration 1:   log likelihood = -464.43931

Zero-inflated negative binomial regression        Number of obs   =
250
Nonzero obs     =
108
Zero obs        =
142

Inflation model = logit                           LR chi2(0)      =
0.00
Log likelihood  = -464.4393                       Prob > chi2     =
.

------------------------------------------------------------------------
------
|      Coef.   Std. Err.      z    P>|z|     [95% Conf.
Interval]
-------------+----------------------------------------------------------
------
count        |
_cons |   1.192632   .1515535     7.87   0.000     .8955925
1.489671
-------------+----------------------------------------------------------
------
inflate      |
_cons |  -16.97113   1949.598    -0.01   0.993    -3838.113
3804.17
-------------+----------------------------------------------------------
------
/lnalpha |   1.693616   .1221088    13.87   0.000     1.454288
1.932945
-------------+----------------------------------------------------------
------
alpha |   5.439116   .6641637                      4.281433
6.909832
------------------------------------------------------------------------
------

.. estat ic

------------------------------------------------------------------------
-----
Model |    Obs    ll(null)   ll(model)     df          AIC
BIC
-------------+----------------------------------------------------------
-----
. |    250   -464.4393   -464.4393      3     934.8786
945.443
------------------------------------------------------------------------
-----
Note:  N=Obs used in calculating BIC; see [R] BIC note

May I wish Statalist members a happy Christmas.

Best wishes, Garry
Garry Anderson
School of Veterinary Science
University of Melbourne
250 Princes Highway    Ph  03 9731 2221
WERRIBEE    3030       Fax  03 9731 2388
Email:  [email protected]

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```