### ch16LimitedDepVARS4JUSTCOUNT

```ECON 6002
Econometrics
Memorial University of Newfoundland
Qualitative and Limited Dependent Variable
Models

16.1 Models with Binary Dependent Variables

16.2 The Logit Model for Binary Choice

16.3 Multinomial Logit

16.4 Conditional Logit

16.5 Ordered Choice Models

16.6 Models for Count Data and extensions

16.7 Limited Dependent Variables
Principles of Econometrics, 3rd Edition
Slide 16-2
When the dependent variable in a regression model is a count of the number
of occurrences of an event, the outcome variable is y = 0, 1, 2, 3, … These
numbers are actual counts, and thus different from the ordinal numbers of
the previous section. Examples include:

The number of trips to a physician a person makes during a year.

The number of fishing trips taken by a person during the previous year.

The number of children in a household.

The number of automobile accidents at a particular intersection during a
month.

The number of televisions in a household.

The number of alcoholic drinks a college student takes in a week.
Principles of Econometrics, 3rd Edition
Slide16-3
If Y is a Poisson random variable, then its probability function is
e  y
f  y   P Y  y  
,
y!
y!  y   y 1   y  2 
1
y  0,1, 2,
“rate”
E Y     exp 1 2 x 
(16.27)
Also equal
To the variance
(16.28)
This choice defines the Poisson regression model for count data.
Principles of Econometrics, 3rd Edition
Slide16-4
If we observe 3 individuals: one faces no event, the other two two events each:
L  1 , 2   P Y  0   P Y  2   P Y  2 
ln L  1 , 2   ln P Y  0   ln P Y  2   ln P Y  2 
 e  y 
ln  P Y  y    ln 
   y ln     ln  y !

 y! 
  exp  1  2 x   y  1  2 x   ln  y !
ln L  1 , 2     exp  1   2 xi   yi  1   2 xi   ln  yi !
N
i 1
Principles of Econometrics, 3rd Edition
Slide16-5

E  y0    0  exp 1  2 x0
Pr Y  y  


exp 0 0y
y!
,

y  0,1,2,
So now you can calculate the predicted probability
of a certain number y of events
Principles of Econometrics, 3rd Edition
Slide16-6
E  yi 
  i 2
xi
(16.29)
You may prefer to express this marginal effect as a %:
%E  y 
E  yi  E  yi 
 100
 1002 %
xi
xi
Principles of Econometrics, 3rd Edition
Slide16-7
E  yi    i  exp  1  2 xi  Di 
E  yi | Di  0   exp  1  2 xi 
If there is a dummy
Involved, be careful,
remember
E  yi | Di  1  exp  1  2 xi   
 exp  1  2 xi     exp  1  2 xi  


100 
%

100
e
 1 %


exp  1  2 xi 


Which would be identical
to the effect of a dummy
In the log-linear model
we saw under OLS
Principles of Econometrics, 3rd Edition
Slide16-8
Extensions: overdispersion
Under a plain Poisson the mean of the count is assumed to be equal to
the average (equidispersion)
This will often not hold
Real life data are often overdispersed
For example:
• a few women will have many affairs and many women will have few
• a few travelers will make many trips to a park and many will make few
• etc.
Principles of Econometrics, 3rd Edition
Slide16-9
Extensions: overdispersion
. poisson
visits Travelcost
educat income
Iteration 0:
log likelihood = -1321.4696
1:persontrip
log likelihood
= -1321.4665
Travelcost
Iteration 2:
log likelihood = -1321.4665
Iteration
. poisson
educat income, nolog
Poisson
Poisson regression
regression
Number of obs
LR chi2(3)
Prob > chi2
Pseudo R2
Log likelihood = -1321.4665
Log likelihood = -2541.5165
visits
Travelcost
persontrip
educat
income
Travelcost
_cons
educat
income
_cons
Coef.
Std. Err.
z
-.3299655
.0529402
Coef.
Std.-6.23
Err.
-.0307667
.026493
-1.16
-.0019933
.0007191
-2.77
-.9570718
.0435943
.8765791
.1125493
7.79
-.0206209
-.0014578
2.144476
Principles of Econometrics, 3rd Edition
.0163568
.0004404
.0688666
P>|z|
Number
of
=
919 obs
=
56.61
LR chi2(3)
=
Prob
>0.0000
chi2
=
0.0210
Pseudo R2
=
=
=
=
[95% Conf. Interval]
0.000 z -.4337264
P>|z| -.2262045
[95% Conf.
0.246
-.0826921
.0211587
0.006
-.0034027
-.0005839
-21.95 .6559865
0.000 1.097172
-1.042515
0.000
-1.26
-3.31
31.14
919
671.71
0.0000
0.1167
0.207
0.001
0.000
-.0526797
-.002321
2.0095
Interval]
-.8716285
.0114379
-.0005946
2.279452
Slide16-10
Extensions: negative binomial
Under a plain Poisson the mean of the count is assumed to be equal to
the average (equidispersion)
The Poisson will inflate your t-ratios in this case, making you think that your
model works better than it actually does 
Or use a Negative Binomial model instead (nbreg) or even a Generalised
Negative Binomial (gnbreg) , which will allow you to model the
overdispersion parameter as a function of covariates of our choice
You can also test for overdispersion, to test whether the problem is significant
Principles of Econometrics, 3rd Edition
Slide16-11
Extensions: negative binomial
sum visits
Variable |
Obs
Mean Std. Dev.
Min
Max
-------------+-------------------------------------------------------visits |
966 1.416149 1.718147
1
26
Principles of Econometrics, 3rd Edition
Slide16-12
Extensions: negative binomial
. nbreg persontrip Travelcost
educat income, nolog
Negative binomial regression
Number of obs
LR chi2(3)
Prob > chi2
Pseudo R2
Dispersion
= mean
Log likelihood = -2038.1155
persontrip
Coef.
Std. Err.
Travelcost
educat
income
_cons
-.7135986
-.0218888
-.0014357
1.994577
.0489137
.0248201
.0006578
.1037
/lnalpha
-1.190022
alpha
.3042145
-14.59
-0.88
-2.18
19.23
P>|z|
0.000
0.378
0.029
0.000
919
236.04
0.0000
0.0547
[95% Conf. Interval]
-.8094676
-.0705353
-.0027249
1.791329
-.6177295
.0267578
-.0001465
2.197826
.0724583
-1.332038
-1.048006
.0220429
.2639388
.3506361
Likelihood-ratio test of alpha=0:
Principles of Econometrics, 3rd Edition
z
=
=
=
=
chibar2(01) = 1006.80 Prob>=chibar2 = 0.000
Slide16-13
Extensions: excess zeros
Often the numbers of zeros in the sample cannot be accommodated
properly by a Poisson or Negative Binomial model
They would underpredict them too
There is said to be an “excess zeros” problem
You can then use hurdle models or zero inflated or zero augmented
models to accommodate the extra zeros
Principles of Econometrics, 3rd Edition
Slide16-14
Extensions: excess zeros
0
.2
Proportion
nbvargr
Is a very useful
command
.4
They would underpredict
them too
.6
Often the numbers of zeros in the sample cannot be accommodated
properly by a Poisson or Negative Binomial model
0
2
4
6
8
10
k
mean = 3.296; overdispersion = 5.439
observed proportion
poisson prob
Principles of Econometrics, 3rd Edition
neg binom prob
Slide16-15
Extensions: excess zeros
You can then use hurdle models or zero inflated or zero augmented
models to accommodate the extra zeros
They will also allow you to have a different process driving the value of the
strictly positive count and whether the value is zero or strictly positive
EXAMPLES:
•Number of extramarital affairs versus gender
•Number of children before marriage versus religiosity
In the continuous case, we have similar models (e.g. Cragg’s Model) and an
example is that of size of Insurance Claims from fires versus the age of the
building
Principles of Econometrics, 3rd Edition
Slide16-16
Extensions: excess zeros
You can then use hurdle models or zero inflated or zero augmented
models to accommodate the extra zeros
Hurdle Models
A hurdle model is a modified count model in which there are two processes, one
generating the zeros and one generating the positive values. The two models are
not constrained to be the same. In the hurdle model a binomial probability model
governs the binary outcome of whether a count variable has a zero or a positive
value. If the value is positive, the "hurdle is crossed," and the conditional
distribution of the positive values is governed by a zero-truncated count model.
Example: smokers versus non-smokers, if you are a smoker you will smoke!
Principles of Econometrics, 3rd Edition
Slide16-17
Extensions: excess zeros
Hurdle Models
allow for two different sets of variables, just two different sets of coefficients
Example: smokers versus non-smokers, if you are a smoker you will smoke!
Principles of Econometrics, 3rd Edition
Slide16-18
Extensions: excess zeros
You can then use hurdle models or zero inflated or zero augmented
models to accommodate the extra zeros
Zero-inflated models (initially suggested by D. Lambert) attempt to account for
excess zeros in a subtly different way.
In this model there are two kinds of zeros, "true zeros" and excess zeros.
Zero-inflated models estimate also two equations, one for the count model and
one for the excess zero's.
The key difference is that the count model allows zeros now. It is not a truncated
count model, but allows for “corner solutions”
Example: meat eaters (who sometimes just did not eat meat that week) versus
vegetarians who never ever do
Principles of Econometrics, 3rd Edition
Slide16-19
Extensions: excess zeros
webuse fish
We want to model how many fish are being caught by fishermen at a state park.
Visitors are asked how long they stayed, how many people were in the group,
were there children in the group and how many fish were caught.
Some visitors do not fish at all, but there is no data on whether a person fished or
not.
Some visitors who did fish did not catch any fish (and admitted it ) so there are
excess zeros in the data because of the people that did not fish.
Principles of Econometrics, 3rd Edition
Slide16-20
Extensions: excess zeros
150
. histogram count, discrete freq
0
50
Frequency
100
Lots of zeros!
0
50
100
150
count
Principles of Econometrics, 3rd Edition
Slide16-21
Extensions: excess zeros
. zip naffairs
age male relig , inflate(
age
male
relig ) vuong nolog
Zero-inflated Poisson regression
Number of obs
Nonzero obs
Zero obs
=
=
=
601
150
451
Inflation model = logit
Log likelihood = -810.055
LR chi2(3)
Prob > chi2
=
=
29.67
0.0000
naffairs
Coef.
Std. Err.
z
P>|z|
[95% Conf. Interval]
naffairs
age
male
relig
_cons
.015609
-.1598035
-.0971114
1.581638
.0038029
.0686006
.0292688
.1577305
4.10
-2.33
-3.32
10.03
0.000
0.020
0.001
0.000
.0081555
-.2942583
-.1544772
1.272492
.0230625
-.0253487
-.0397456
1.890784
age
male
relig
_cons
-.019041
-.1791471
.2884574
.9322364
.0104841
.1948003
.0841492
.3901503
-1.82
-0.92
3.43
2.39
0.069
0.358
0.001
0.017
-.0395895
-.5609488
.1235281
.1675558
.0015075
.2026546
.4533867
1.696917
inflate
Vuong test of zip vs. standard Poisson:
Principles of Econometrics, 3rd Edition
z =
Vuong test
11.66
Pr>z = 0.0000
Slide16-22
Extensions: excess zeros
. zinb naffairs
age male relig , inflate(
age
male
relig ) vuong nolog
Zero-inflated negative binomial regression
Number of obs
Nonzero obs
Zero obs
=
=
=
601
150
451
Inflation model = logit
Log likelihood = -726.405
LR chi2(3)
Prob > chi2
=
=
8.92
0.0304
naffairs
Coef.
Std. Err.
z
P>|z|
[95% Conf. Interval]
naffairs
age
male
relig
_cons
.0258188
-.2214886
-.1472717
1.273196
.0107692
.1660362
.0749567
.3874106
2.40
-1.33
-1.96
3.29
0.017
0.182
0.049
0.001
.0047115
-.5469135
-.2941842
.5138849
.046926
.1039364
-.0003593
2.032506
age
male
relig
_cons
-.014892
-.2309299
.274744
.6673066
.0113465
.2091759
.0904315
.433002
-1.31
-1.10
3.04
1.54
0.189
0.270
0.002
0.123
-.0371308
-.6409071
.0975014
-.1813618
.0073468
.1790474
.4519865
1.515975
/lnalpha
-.2743069
.2532933
-1.08
0.279
-.7707527
.2221388
alpha
.7600988
.1925279
.4626647
1.248745
inflate
Vuong test of zinb vs. standard negative binomial: z =
Principles of Econometrics, 3rd Edition
Vuong test
2.82
Pr>z = 0.0024
Slide16-23
Extensions: truncation
• Count
data can be truncated too (usually at zero)
• So ztp and ztnb can accommodate that
• Example: you interview visitors at the recreational site, so they all
made at least that one trip
•In the continuous case we would have to use the truncreg
command
Principles of Econometrics, 3rd Edition
Slide16-24
Extensions: truncation
This model works much better and showcases the bias in the previous estimates:
•
. ztp
persontrip Travelcost
educat income, nolog
Zero-truncated Poisson regression
Number of obs
LR chi2(3)
Prob > chi2
Pseudo R2
Log likelihood = -2412.6552
persontrip
Coef.
Travelcost
educat
income
_cons
-1.380461
-.0170332
-.0013521
2.278878
Std. Err.
.0571736
.0175026
.000473
.0728394
z
-24.15
-0.97
-2.86
31.29
P>|z|
0.000
0.330
0.004
0.000
=
=
=
=
919
885.68
0.0000
0.1551
[95% Conf. Interval]
-1.492519
-.0513376
-.0022791
2.136116
-1.268403
.0172712
-.0004251
2.421641
Smaller now estimated Consumer Surplus
Principles of Econometrics, 3rd Edition
Slide16-25
Extensions: truncation
This model works much better and showcases the bias in the previous estimates:
• Now accounting for overdispersion
. ztnb
persontrip Travelcost
educat income, nolog
Zero-truncated negative binomial regression
Number of obs
LR chi2(3)
Prob > chi2
Pseudo R2
Dispersion
= mean
Log likelihood = -1866.326
persontrip
Coef.
Travelcost
educat
income
_cons
-1.079011
-.0216377
-.0016369
2.015503
.068793
.0322941
.0008563
.1344308
/lnalpha
-.6368613
alpha
.52895
Std. Err.
-15.68
-0.67
-1.91
14.99
P>|z|
0.000
0.503
0.056
0.000
919
263.89
0.0000
0.0660
[95% Conf. Interval]
-1.213843
-.084933
-.0033152
1.752024
-.9441795
.0416576
.0000413
2.278983
.101849
-.8364818
-.4372409
.053873
.433232
.6458158
Likelihood-ratio test of alpha=0:
Principles of Econometrics, 3rd Edition
z
=
=
=
=
chibar2(01) = 1092.66 Prob>=chibar2 = 0.000
Slide16-26
Extensions: truncation and endogenous stratification
Example: you interview visitors at the recreational site, so they all
made at least that one trip
• You interview patients at the doctors’ office about how often they
visit the doctor
• You ask people in George St. how often the go to George St…
•
•Then you are oversampling “frequent visitors” and biasing your
estimates, perhaps substantially
Principles of Econometrics, 3rd Edition
Slide16-27
Extensions: truncation and endogenous stratification
•Then you are oversampling “frequent visitors” and biasing your
estimates, perhaps substantially
•It turns out to be supereasy to deal with a Truncated and
Endogenously Stratified Poisson Model (as shown by Shaw, 1988):
Simply run a plain Poisson on “Count-1” and that will work (In
STATA: poisson on the corrected count)
It is more complex if there is overdispersion though 
Principles of Econometrics, 3rd Edition
Slide16-28
Extensions: truncation and endogenous stratification
•Supereasy to deal with a Truncated and Endogenously Stratified
Poisson Model
. poisson
persontripminusone Travelcost
educat income, nolog
Poisson regression
Number of obs
LR chi2(3)
Prob > chi2
Pseudo R2
Log likelihood = -2474.3262
persontrip~e
Coef.
Travelcost
educat
income
_cons
-1.657986
-.0202144
-.0016285
2.191885
Std. Err.
.0620722
.0191574
.0005184
.0792934
z
-26.71
-1.06
-3.14
27.64
P>|z|
0.000
0.291
0.002
0.000
=
=
=
=
919
1071.95
0.0000
0.1780
[95% Conf. Interval]
-1.779646
-.0577622
-.0026446
2.036473
-1.536327
.0173333
-.0006124
2.347298
Much smaller now estimated Consumer Surplus
Principles of Econometrics, 3rd Edition
Slide16-29
Extensions: truncation and endogenous stratification
•Endogenously Stratified Negative Binomial Model (as shown by
Shaw, 1988; Englin and Shonkwiler, 1995):
. nbstrat
persontrip Travelcost
educat income, nolog
Negative Binomial with Endogenous Stratification
Log likelihood = -1837.3183
Travelcost
educat
income
_cons
-1.152915
-.0229483
-.0017368
1.189429
.0695958
.0318753
.0008447
.1561017
-16.57
-0.72
-2.06
7.62
0.000
0.472
0.040
0.000
-1.289321
-.0854228
-.0033923
.8834757
-1.01651
.0395261
-.0000813
1.495383
/lnalpha
.092944
.1482435
0.63
0.531
-.197608
.3834959
alpha
1.0974
.1626825
.8206915
1.467406
4.007
0.000
P>|z|
919
283.49
0.0000
Coef.
=
=
z
=
=
=
persontrip
AIC Statistic
Deviance
Std. Err.
Number of obs
Wald chi2(3)
Prob > chi2
[95% Conf. Interval]
BIC Statistic =
Dispersion
=
-6243.307
0.000
Even after accounting for overdispersion, CS estimate is relatively low
Principles of Econometrics, 3rd Edition
Slide16-30
Extensions: truncation and endogenous stratification
•How do we calculate the pseudo-R2 for this model???
. nbstrat
persontrip Travelcost
educat income, nolog
Negative Binomial with Endogenous Stratification
Log likelihood = -1837.3183
Travelcost
educat
income
_cons
-1.152915
-.0229483
-.0017368
1.189429
.0695958
.0318753
.0008447
.1561017
-16.57
-0.72
-2.06
7.62
0.000
0.472
0.040
0.000
-1.289321
-.0854228
-.0033923
.8834757
-1.01651
.0395261
-.0000813
1.495383
/lnalpha
.092944
.1482435
0.63
0.531
-.197608
.3834959
alpha
1.0974
.1626825
.8206915
1.467406
Principles of Econometrics, 3rd Edition
4.007
0.000
P>|z|
919
283.49
0.0000
Coef.
=
=
z
=
=
=
persontrip
AIC Statistic
Deviance
Std. Err.
Number of obs
Wald chi2(3)
Prob > chi2
[95% Conf. Interval]
BIC Statistic =
Dispersion
=
-6243.307
0.000
Slide16-31
Extensions: truncation and endogenous stratification
•GNBSTRAT will also allow you to model the overdispersion
parameter in this case, just as gnbreg did for the plain case
maximum likelihood Poisson regression models
And in general take a good look at:
Hilbe, J. (2011). Negative Binomial Regression, 2nd ed.
Cambridge, UK: Cambridge University Press.
Principles of Econometrics, 3rd Edition
Slide16-32
Extensions: endogeneity
• Sample selection models and endogenous switching (ssm and
espoisson)
•(See also movestay would work for a continuous dependent variable in a similar setting)
•Endogenous treatment models
•Mtreatnb allows for a multinomial treatment
•(from Stata Help: mtreatnb fits a treatment-effects model that considers the effects of an endogenously chosen
multinomial treatment on another endogenous count outcome, conditional on two sets of independent variables. The
treatment variable is modeled via a multinomial logit and the outcome via a negative binomial regression. The
model is fitted using maximum simulated likelihood. The simulator uses Halton sequences.)
Principles of Econometrics, 3rd Edition
Slide16-33
Extensions: multivariate models
• bivariate poisson, and my personal favourite, at least for the name:
the SUPREME model
•King, G. A seemingly unrelated Poisson regression model
Sociological Methods and Research, 1989, 17, 235–255
•bivariate NB (seemingly unrelated negative binomial)
•Hausman et al. (1984) and a bit more flexible in: Winkelmann, R.
Seemingly unrelated negative binomial regression Oxford Bulletin of Economics
and Statistics, 2000, 62, 553-560
Principles of Econometrics, 3rd Edition
Slide16-34
Extensions: mixed-effects Poisson
• xtmepoisson (from STATA help) fits mixed-effects models for
count responses.
•Mixed models contain both fixed effects and random effects. The
fixed effects are analogous to standard regression coefficients and
are estimated directly.
•The random effects are not directly estimated (although they may
be obtained postestimation) but are summarized according to their
estimated variances and covariances.
•Random effects may take the form of either random intercepts or
random coefficients, and the grouping structure of the data may
consist of multiple levels of nested groups
Principles of Econometrics, 3rd Edition
Slide16-35
Extensions: mixed-effects Poisson
• xtmepoisson (from STATA help) fits mixed-effects models for
count responses.
•The distribution of the random effects is assumed to be Gaussian.
The conditional distribution of the response given the random
effects is assumed to be Poisson
•Because the log likelihood for this model has no closed form, it is
Principles of Econometrics, 3rd Edition
Slide16-36
Extensions: finite mixture models
•
•AKA Latent Class Models
•Fmm
•See examples in the works by Deb and Trivedi for medical care
(see Cameron & Trivedi MMA and MUS)
•And, again Hilbe (2011)
Principles of Econometrics, 3rd Edition
Slide16-37
Extensions: panels and pseudo panels
• Xtpoisson, xtnb
•Xtgee in general
Principles of Econometrics, 3rd Edition
Slide16-38
NOTE: what is the exposure
• Count models often need to deal with the fact that the counts may be measured over
different observation periods, which might be of different length (in terms of time or some
other relevant dimension)
For example, the number of accidents are recorded for 50 different intersections. However,
the number of vehicles that pass through the intersections can vary greatly. Five accidents
for 30,000 vehicles is very different from five accidents for 1,500 vehicles.
Count models account for these differences by including the log of the exposure variable
in model with coefficient constrained to be one.
The use of exposure is often superior to analyzing rates as response variables as such,
because it makes use of the correct probability distributions
Principles of Econometrics, 3rd Edition
Slide16-39















binary choice models
censored data
conditional logit
count data models
feasible generalized least squares
Heckit
identification problem
independence of irrelevant
alternatives (IIA)
index models
individual and alternative specific
variables
individual specific variables
latent variables
likelihood function
limited dependent variables
linear probability model
Principles of Econometrics, 3rd Edition

















logistic random variable
logit
log-likelihood function
marginal effect
maximum likelihood estimation
multinomial choice models
multinomial logit
odds ratio
ordered choice models
ordered probit
ordinal variables
Poisson random variable
Poisson regression model
probit
selection bias
tobit model
truncated data
Slide 16-40
Hoffmann, 2004 for all topics
 Long, S. and J. Freese for all topics, most of all for
postestimation and reporting tricks
 Cameron and Trivedi’s book for count data
 Winkelmann’s 2008 book on count data is free as an ebook
from the QEII
 Hilbe (2011) for NB related models and count data models in
general
 Cameron&Trivedi’s MUS and MMA
 Greene’s Econometric Analysis
 Agresti, A. (2001) Categorical Data Analysis (2nd ed). New
York: Wiley

```