library("countreg")
data("GSOEP")
if(exists("nbp.u") & exists("nbp.o")) {
# We fit an NB1, an NB2 and an NBP model as in Greene (2007) ...
model.u <- docvis ~ age + I(age^2) + hsat + handdum + handper + married + educ +
hhninc + hhkids + self + civil + bluec + working + public + addon + year
fm.nb1.u <- nbp.u(model.u, data = subset(GSOEP, female == "no"), p.fix = 1)
fm.nb2.u <- nbp.u(model.u, data = subset(GSOEP, female == "no"), p.fix = 2)
fm.nbp.u <- nbp.u(model.u, data = subset(GSOEP, female == "no"))
# ... and show that the former two are inferior to the last one by standard likelihood ratio tests
library("lmtest")
lrtest(fm.nb1.u, fm.nbp.u)
lrtest(fm.nb2.u, fm.nbp.u)
# model with observed heterogeneity
model.o <- docvis ~ age + I(age^2) + hsat + handdum + handper + married + educ +
hhninc + hhkids + self + civil + bluec + working + public + addon + year | hhninc + educ
## fm.nbp.o <- nbp.o(model.o, data = subset(GSOEP, female == "no"))
# visualization of the fit
# plot(fm.nbp.o)
# things to replicate from Greene (2011):
# Ex. 11.16, Tab 11.13, pp 451-452: nonlinear regression
# Tab. 14.2, pp 580--581: logistic and Poisson
# Tab. 14.10, pp 611-613: geometric regression
# Ex. 17.7: binary Chow test (maybe not?)
# Tab 18.14, p 850: Poisson, various negbins
# Tab 18.17, p 860 (panel models, some of)
# Tab 18.19, p 866: hurdle models
# things to replicate from Greene (2008):
# Tab 2: Poisson, various negbins, presumably same as book
}Health Services (GSOEP)
Description
Unbalanced panel concerning the usage of health services in Germany for the years 1984-1988, 1991 and 1994 consisting of 27,326 observations on 22 variables taken from the German Socioeconomic Panel (GSOEP). The number of visits to a doctor and the number of inpatient hospital visits are given along with several personal socioeconomic characteristics.
Usage
data("GSOEP")
Format
A data frame with 27,326 observations on 22 variables.
- id
- identification number indicating 1 to 7 observations for each of the 7,293 cases.
- female
-
factor indicating whether a person is female (
yesorno). - year
- factor giving the calendar year of the observation.
- age
- age in years.
- hsat
- personal health satisfaction judged on a scale from 0 (low) to 10 (high). See Details.
- handdum
-
dummy variable indicating whether a person is handicapped (
=1) or not (=0). See Details. - handper
- degree of handicap expressed in percent from 0 to 100. See Details.
- hhninc
- monthly household net income in 1’000 German marks.
- hhkids
-
factor indicating whether a household has kids below the age of 16 (
yesorno). - educ
- years of schooling. See Details.
- married
-
factor indicating whether a person is married (
yesorno). - school
-
factor giving the highest schooling degree.
hauptfor Hauptschule,realfor Realschule,fachfor Fachschule andabiturfor Gymnasium. - univ
-
factor indicating whether a person has a university diploma (
yesorno). - working
-
factor indicating whether a person is employed (
yesorno). - bluec
-
factor indicating whether a person is a blue collar worker (
yesorno). - whitec
-
factor indicating whether a person is a white collar worker (
yesorno). - self
-
factor indicating whether a person is self employed (
yesorno). - civil
-
factor indicating whether a person is a civil servant (
yesorno). - docvis
- number of doctor visits within the last three months.
- hospvis
- number of hospital visits within the last calendar year.
- public
-
factor indicating whether a person is insured in public health insurance (
yesorno). - addon
-
factor indicating whether a person is insured in add-on insurance (
yesorno).
Details
The data were first used by Riphahn, Wambach and Million (2003).
As noted by Greene (2007, 2008), there are 40 observations on hsat taking on values between 6 and 7 although the variable is supposed to be an integer. For three other variables similar problems occur: By construction, handdum should be a dummy variable but there are 18 observations taking on values between 0 and 1. Also, for handper 3,290 observations are not integer-valued. Finally, the precision of 148 values of educ is very suspicious.
As of 2013, a comment and a reply on data issues are available from the JAE archive. No attempts are made to fix these issues here. Data is used ‘as is’ in order to replicate Greene (2007, 2008, 2011).
Source
Journal of Applied Econometrics Data Archive.
http://qed.econ.queensu.ca/jae/2003-v18.4/riphahn-wambach-million/
References
Greene WH (2007). “Functional Form and Heterogeneity in Models for Count Data”. Foundations and Trends in Econometrics, 1(2), 113–218.
Greene WH (2008). “Functional Forms for the Negative Binomial Model for Count Data”. Economics Letters, 99, 585–590.
Greene WH (2011). Econometric Analysis, 7th edition. Upper Saddle River, NJ: Prentice Hall.
Riphahn RT, Wambach A, Million A (2003). “Incentive Effects in the Demand for Health Care: A Bivariate Panel Count Data Estimation”. Journal of Applied Econometrics, 18(4), 387–405.