CLICK HERE to download a
zipped file with all the data files,
programs and output listed below.
DATA: We
thank the authors of the papers listed in the table below for
making their data available for empirical illustrations.
STATA: Stata was used
for most of the book and the programs reproduce virtually all of
the book.
Some Stata programs require userwritten addons:
fmm for finite mixture models (chapter 4, 6, 11)
countfit for
predicted probabilities (chapter 3, 5, 7)
mtreatreg for
multiple treatment models (Chapter 10).
rcal, simex, qvf and cme for measurement error
(Chapter 13).
R: R was used for the
nonparametric and semiparametric analysis of chapter 11.
A fairly detailed R program is also given for chapter 3 (basic
Poisson and negative binomial regression).
Short R programs to read in data and estimate by Poisson are given
for the other chapters.
These usually do not give exactly
the same numerical results as the Stata code. e.g.
robust standard errors are calculated differently.
The R programs use packages
foreign to read
in a Stata dataset
sandwich for
robust sandwich standard errors
boot for bootstrap
standard errors
MASS for negative
binomial (NB2) regression
gamlss for
negative binomial (NB1 and NB2) regression
pscl for
predicted probabilities from Poisson and NB2 regression
flexmix for finite
mixtures of Poisson
np for
nonparametric and semiparametric estimation
Chapter 
Topic 
STATA Program& Output 
R Program &Output 
Data Source 
Data 
1 
Introduction 
racd01.do racd01.txt 
See chapters 3 and 6 
racd03data.dta racd06data2rectrips.dta racd06data3fertility.dta 

2 
Model Specification and
Estimation 
No program 

3 
Basic Count Regression 
racd03.do racd03.txt 
racd03.R racd03.Rout 
A.C. Cameron and P.K. Trivedi (1986),
"Econometric Models Based on Count Data: Comparisons and Applications of Some Estimators and Tests," Journal of Applied Econometrics, 1, 2954. 
racd03data.dta 
4 
Generalized Count Regression 
racd04.do racd04.txt 
racd04.R racd04.Rout 
See chapter 9 
racd09data.dta 
5 
Model Evaluation and Testing 
racd05.do racd05.txt 
racd05.R racd05.Rout 
Sanjiv Jaggia and Satish Thosar (1993),
"Multiple Bids as a Consequence of Target Management
Resistance," Review of Quantitative Finance and Accounting,
447457. 
racd05data.dta 
6.1 
Introduction: 4 different counts  racd06p0.do racd06p0.txt 
See chapter 6.3, 6.4, 6.5 for
the data 
See 6.3, 6.4, 6.5  
6.3 
Illustration: Health Services 
racd06p1.do racd06p1.txt 
racd06p1.R racd06p1.Rout 
P. Deb and P.K. Trivedi (1997), "Demand for
Medical Care by the Elderly: A Finite Mixture Approach,"
Journal of Applied Econometrics, 12, 313326. 
racd06data1healthcare.dta 
6.4 
Illustration: Recreational Trips 
racd06p2.do racd06p2.txt 
racd06p2.R racd06p2.Rout 
C. Sellar, J.R. Stoll and J.P. Chavas (1985),
"Validation of Empirical Measures of Welfare Change: A
Comparison of nonmarket Techniques," Land Economics, 61,
156175. 
racd06data2rectrips.dta 
6.5 
Illustration: Fertility 
racd06p3.do racd06p3.txt 
racd06p3.R racd06p3.Rout 
racd06data3fertilityswiss.dta racd06data4fertilitybritish.dta 

6.6 
Illustration: Simulation 
racd06p4.do racd06p4.txt 

No dataset  the data are
generated 

7 
Time Series Data 
racd07.do racd07.txt 
racd07.R racd07.Rout 
J. Kennan, "The Duration of Contract strikes
in U.S. Manufacturing," Journal of Econometrics, 1985, 28,
528. R.C. Jung, R. Liesenfeld and J.F. Richard (2011), "Dynamic Factor Models for Multivariate Count Data: An Application to StockMarket Trading Activity," Journal of Business and Economic Statistics, 29, 7385. 
racd07data1strikes.dta racd07data2stocktrades.dta 
8 
Multivariate Data 
racd08.do racd08.txt 
see racd06p1.R 
See chapter 6.3 
racd06data1healthcare.dta 
9 
Longitudinal Data 
racd09.do racd09.txt 
racd09.R racd09.Rout 
B.H. Hall, Z. Griliches and J.A. Hausman
(1986), "Patents and R&D: Is There a Lag?",
International Economic Review, 27, 265283. 
racd09data.dta 
10 
Nonrandom Samples and
Heterogeneity 
racd10.do racd10.txt 
racd10.R racd10.Rout 
P. Deb and P.K. Trivedi (2006),
"Specification and simulated likelihood estimation of a
nonnormal treatmentoutcome model with selection:
application to health care utilization," Econometrics
Journal, 9, 307331. 
racd10data.dta 
11 
Flexible Methods For Counts 
racd11.do racd11.txt 
racd11.R racd11.Rout 
See chapter 9. 
racd09data.dta 
12 
Bayesian Methods 
racd12.do racd12.txt 
No dataset  the data are generated. 

13 
Measurement Errors  racd13.do racd13.txt 
No dataset  the data are generated. 