Skip to Main Content

Negative Binomial Regression | Mplus Data Analysis Examples

Version info: Code for this page was tested in Mplus version 6.12.

Negative binomial regression is used to model count variables with
overdispersion.

Please note: The purpose of this page is to show how to use various data
analysis commands. It does not cover all aspects of the research process which
researchers are expected to do.  In particular, it does not cover data
cleaning and checking, verification of assumptions, model diagnostics or
potential follow-up analyses.

Examples of negative binomial regression

Example 1.  School administrators study the attendance behavior of high school juniors at two schools.
Predictors of the number of days of absence include the type of program in which
the student is enrolled and a standardized
test in math.

Example 2.  A health-related researcher is studying the number of
hospital visits in past 12 months by senior citizens in a community based on the
characteristics of the individuals and the types of health plans under which
each one is covered.  

Description of the data

We have attendance data on 314 high school juniors from two urban high schools in
the file https://stats.idre.ucla.edu/wp-content/uploads/2016/02/nb_data.dat. The response variable of interest is days absent, daysabs.
The variable math gives the standardized math score for
each student.  The variable prog is a three-level nominal variable
indicating the type of instructional program in which the student is enrolled. 
The variables p1, p2 and p3 are dummy-coded indicator variables
for prog.

Let’s look at the data. It is always a good idea to start with descriptive
statistics.

Analysis methods you might consider

Below is a list of some analysis methods you may have
encountered.  Some of the methods listed are quite reasonable, while others have
either fallen out of favor or have limitations. 

Negative binomial regression analysis

In the Mplus syntax below, we specify that the variables to be used in the
negative binomial regression are daysabs, math, p2, p3,
which will make prog=1 the reference group. We also specify that daysabs is a count variable, and we include (nb)
to indicate that we want a negative binomial regression.  (By default,
Mplus would model this as a Poisson regression.)  By
default, Mplus uses restricted maximum likelihood (MLR), so robust standard
errors would be given in the output.  Here, the standard errors are calculated using
maximum likelihood estimates by including the analysis: estimator = ml; block.

Data: 
File is g:daehttps://stats.idre.ucla.edu/wp-content/uploads/2016/02/nb_data.dat;
Variable:
Names are 
id gender math daysabs prog p1 p2 p3;
Missing are all (-9999); 
usevariables are daysabs math p2 p3;
count is daysabs (nb);
model:
daysabs on math p2 p3;
analysis: estimator = ml;

MODEL FIT INFORMATION

Number of Free Parameters                        5

Loglikelihood

          H0 Value                        -865.629

Information Criteria

          Akaike (AIC)                    1741.258
          Bayesian (BIC)                  1760.005
          Sample-Size Adjusted BIC        1744.146
            (n* = (n + 2) / 24)


MODEL RESULTS

                                                    Two-Tailed
                    Estimate       S.E.  Est./S.E.    P-Value

 DAYSABS    ON
    MATH              -0.006      0.003     -2.390      0.017
    P2                -0.441      0.183     -2.414      0.016
    P3                -1.279      0.202     -6.331      0.000

 Intercepts
    DAYSABS            2.615      0.196     13.319      0.000

 Dispersion
    DAYSABS            0.968      0.100      9.729      0.000

To determine if prog itself is statistically significant, we can
use the model test block to obtain the two degree-of-freedom test of this
variable. Additionally, we can get an estimate of the natural log of the
over-dispersion coefficient, alpha.  If the alpha coefficient is zero then
the model is better estimated using a Poisson regression model.

Data: 
File is g:daehttps://stats.idre.ucla.edu/wp-content/uploads/2016/02/nb_data.dat;
Variable:
Names are 
id gender math daysabs prog p1 p2 p3;
Missing are all (-9999); 
usevariables are daysabs math p2 p3;
count is daysabs (nb);
model:
daysabs on 
math (a1)
p2 (a2)
p3 (a3);
model test:
a2 = 0;
a3 = 0;
analysis: estimator = ml;
MODEL FIT INFORMATION
<**SOME OUTPUT OMITTED**>

Wald Test of Parameter Constraints

          Value                             49.214
          Degrees of Freedom                     2
          P-Value                           0.0000

In the syntax above, some of the variables in the model are given labels. 
These labels must be in parentheses and must be the last item listed on the
line, so the model is broken up over several lines.  We have given the
label a2 to the indicator variable p2, and the label a3 to
the indicator variable p3.  Once we have assigned labels to the
variables, we can use those labels in the model test block. 
Setting both a2 and a3 to 0 allows us to get the two
degree-of-freedom test of the variable prog.  We can see that the
variable prog, as a whole, is statistically significant.

To obtain the results as incident rate ratios, we need to use the model
constraint
block.  Again, we use labels to refer to the variables
in the model.  In the model constraint block, we use the new
statement to label the new parameters, which will be the exponentiated
parameters from the model. 

Data: 
File is g:daehttps://stats.idre.ucla.edu/wp-content/uploads/2016/02/nb_data.dat;
Variable:
Names are 
id gender math daysabs prog p1 p2 p3;
Missing are all (-9999); 
usevariables are daysabs math p2 p3;
count is daysabs (nb);
model:
daysabs on 
math (a1)
p2 (a2)
p3 (a3);
model constraint:
new( math_exp p2_exp p3_exp);
math_exp = exp(a1);
p2_exp = exp(a2);
p3_exp = exp(a3);
analysis: estimator = ml;

MODEL FIT INFORMATION

Number of Free Parameters                        5

Loglikelihood

          H0 Value                        -865.629

Information Criteria

          Akaike (AIC)                    1741.258
          Bayesian (BIC)                  1760.005
          Sample-Size Adjusted BIC        1744.146
            (n* = (n + 2) / 24)
            
            
MODEL RESULTS

                                                    Two-Tailed
                    Estimate       S.E.  Est./S.E.    P-Value

 DAYSABS    ON
    MATH              -0.006      0.003     -2.390      0.017
    P2                -0.441      0.183     -2.414      0.016
    P3                -1.279      0.202     -6.331      0.000

 Intercepts
    DAYSABS            2.615      0.196     13.319      0.000

 Dispersion
    DAYSABS            0.968      0.100      9.729      0.000

 New/Additional Parameters
    MATH_EXP           0.994      0.002    398.851      0.000
    P2_EXP             0.644      0.117      5.477      0.000
    P3_EXP             0.278      0.056      4.951      0.000

Things to consider

See also

References