Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: grouping, negative binomial regression, and margins


From   Steve Samuels <[email protected]>
To   [email protected]
Subject   Re: st: grouping, negative binomial regression, and margins
Date   Sat, 10 Aug 2013 21:18:01 -0400

All the count models, including negative binomia, have a dependent variable with no theoretical upper limit (i.e. they predict proportions of observations with counts of 7,8,.....   If six is the maximum possible count, not just the maximum observed, then you have a multinomial model.

Steve
 
On Aug 10, 2013, at 6:04 PM, Ahmed Al Attar wrote:

Hi,

I am working on a project where I have a bivariate model. All of my data are counts and I have verified using countfit that the best model to use is the Negative binomial regression. 

My Dependent Variable is called NUMTA (with values one of 0,1,2,3,4,5,6)
My Independent Variable is called NUMDS (with values either 0, 1 or 2)
The study takes place over 10 different regions, each with counts of NUMTA and NUMDS which brings us to a total of 870 observations.

The commands that I have entered into stata are:

sort region

by region: nbreg NUMTA i.NUMDS, nolog

The output is a negative binomial regression by region as you can see below. This is for 1 of my 10 regions:

Negative binomial regression                      Number of obs   =         87
                                                 LR chi2(1)      =       0.50
Dispersion     = mean                             Prob > chi2     =     0.4810
Log likelihood = -34.128129                       Pseudo R2       =     0.0072

------------------------------------------------------------------------------
      numta |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
    1.numds |  -12.98646   1298.721    -0.01   0.992    -2558.434    2532.461
      _cons |  -2.044954   .3103769    -6.59   0.000    -2.653282   -1.436627
-------------+----------------------------------------------------------------
   /lnalpha |  -.7772627   3.388113                     -7.417842    5.863317
-------------+----------------------------------------------------------------
      alpha |   .4596625   1.557389                      .0006004    351.8895
------------------------------------------------------------------------------
Likelihood-ratio test of alpha=0:  chibar2(01) =    0.11 Prob>=chibar2 = 0.367

However, when I follow this up with the command:

margins NUMDS

then I get the following output:

Adjusted predictions                              Number of obs   =         87
Model VCE    : OIM

Expression   : Predicted number of events, predict()

------------------------------------------------------------------------------
            |            Delta-method
            |     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
      numds |
         0  |   .0657895   .0310757     2.12   0.034     .0048822    .1266967
         1  |   .1111111   .1214722     0.91   0.360    -.1269701    .3491923
         2  |   .4999992   .6852692     0.73   0.466    -.8431037    1.843102
------------------------------------------------------------------------------

The above output says 87 observations, when I know it should show predictions for 870 observations instead. Which leads me to believe that it has done the margins command for only 1 of my 10 regions.

Is there a way to do the margins command using (by region:) in order to get 10 different margins outputs? When I try to run the command by region: margins NUMDS state says I cannot run it. If not, is there any other course of action you would advise?

Thank you very much for your support,

Ahmed Al-Attar
RCTC-Organization
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index