Presentation is loading. Please wait.

Presentation is loading. Please wait.

Qualitative and Limited Dependent Variable Models

Similar presentations


Presentation on theme: "Qualitative and Limited Dependent Variable Models"— Presentation transcript:

1 Qualitative and Limited Dependent Variable Models
ECON 4551 Econometrics II Memorial University of Newfoundland Qualitative and Limited Dependent Variable Models Chapter 16 Adapted from Vera Tabakova’s notes

2 Chapter 16: 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 16.7 Limited Dependent Variables Principles of Econometrics, 3rd Edition

3 16.6 Models for Count Data 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

4 16.6 Models for Count Data If Y is a Poisson random variable, then its probability function is This choice defines the Poisson regression model for count data. (16.27) “rate” Also equal To the variance (16.28) Principles of Econometrics, 3rd Edition

5 16.6.1 Maximum Likelihood Estimation
If we observe 3 individuals: one faces no event, the other two two events each: Principles of Econometrics, 3rd Edition

6 16.6.2 Interpretation in the Poisson Regression Model
Which is the expected number of occurrences observed Which is the predicted probability of a certain number y of events For someone with characteristics X0 Principles of Econometrics, 3rd Edition

7 16.6.2 Interpretation in the Poisson Regression Model
(16.29) You may prefer to express this marginal effect as a %: Principles of Econometrics, 3rd Edition

8 16.6.2 Interpretation in the Poisson Regression Model
If there is a dummy Involved, be careful, remember Which would be identical to the effect of a dummy In the log-linear model we saw under OLS Principles of Econometrics, 3rd Edition

9 Example on Olympic Medals
# Poisson Regression open "c:\Program Files\gretl\data\poe\olympics.gdt" smpl year = 88 --restrict genr lpop = log(pop) genr lgdp = log(gdp) poisson medaltot const lpop lgdp genr mft = exp($coeff(const)+$coeff(lpop)*median(lpop) \ +$coeff(lgdp)*median(lgdp))*$coeff(lgdp) Which would give you the marginal effect of GDP for the median country genr predicted medals = exp($coeff(const)+$coeff(lpop)*median(lpop) \ +$coeff(lgdp)*median(lgdp)) 0.863 medals for those with median GDP and pop Principles of Econometrics, 3rd Edition Slide16-9 9

10 Extensions: overdispersion
Under a plain Poisson the mean of the count is assumed to be equal to the variance (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-10 10

11 Extensions: overdispersion
open C:\Users\rmartinezesp\aaa\bbbECONOMETRICS\Rober\4551\GROSMORNE.dta Principles of Econometrics, 3rd Edition Slide16-11 11

12 Extensions: overdispersion
open C:\Users\rmartinezesp\aaa\bbbECONOMETRICS\Rober\4551\GROSMORNE.dta Principles of Econometrics, 3rd Edition Slide16-12 12

13 Extensions: overdispersion
open C:\Users\rmartinezesp\aaa\bbbECONOMETRICS\Rober\4551\GROSMORNE.dta Principles of Econometrics, 3rd Edition Slide16-13 13

14 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-14 14

15 Extensions: negative binomial
Principles of Econometrics, 3rd Edition Slide16-15 15

16 Extensions: negative binomial
Principles of Econometrics, 3rd Edition Slide16-16 16

17 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-17 17

18 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 nbvargr Is a very useful command Principles of Econometrics, 3rd Edition Slide16-18 18

19 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-19 19

20 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-20 20

21 Extensions: excess zeros
Hurdle Models In Stata Joseph Hilbe’s downloadable ado HPLOGIT will work, although it does not 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-21 21

22 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-22 22

23 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-23 23

24 Extensions: excess zeros
. histogram count, discrete freq Lots of zeros! Principles of Econometrics, 3rd Edition Slide16-24 24

25 Extensions: excess zeros (sample restricted to count<29)
. histogram count, discrete freq Lots of zeros! Principles of Econometrics, 3rd Edition Slide16-25 25

26 Extensions: excess zeros number of affairs (Fair 1978)
. histogram count, discrete freq We sill showcase zero-inflated models using STATA now… LIMDEP has an extra option to run this from Poisson or Negative Binomial dialogs You would need to program it in GRETL using its maximum likelihood routines (there is a ZIP example on the pdf user’s guide) LIMDEP has an extra option to run this from Poisson or Negative Binomial dialogs You would need to program it in GRETL using its maximum likelihood routines (there is a ZIP example on the pdf user’s guide) Lots of zeros! Principles of Econometrics, 3rd Edition Slide16-26 26

27 Extensions: excess zeros (greene22_2.gdt)
genr ANYAFFAIRS = ( Y>0) Vuong test Principles of Econometrics, 3rd Edition Slide16-27 27

28 Extensions: excess zeros
Vuong test Principles of Econometrics, 3rd Edition Slide16-28 28

29 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-29 29

30 Extensions: truncation
This model works much better and showcases the bias in the previous estimates: Smaller now estimated Consumer Surplus Principles of Econometrics, 3rd Edition Slide16-30 30

31 Extensions: truncation
This model works much better and showcases the bias in the previous estimates: Now accounting for overdispersion Principles of Econometrics, 3rd Edition Slide16-31 31

32 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-32 32

33 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-33 33

34 Extensions: truncation and endogenous stratification
Supereasy to deal with a Truncated and Endogenously Stratified Poisson Model Much smaller now estimated Consumer Surplus Principles of Econometrics, 3rd Edition Slide16-34 34

35 Extensions: truncation and endogenous stratification
Endogenously Stratified Negative Binomial Model (as shown by Shaw, 1988; Englin and Shonkwiler, 1995): Even after accounting for overdispersion, CS estimate is relatively low Principles of Econometrics, 3rd Edition Slide16-35 35

36 Extensions: truncation and endogenous stratification
How do we calculate the pseudo-R2 for this model??? Principles of Econometrics, 3rd Edition Slide16-36 36

37 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 Principles of Econometrics, 3rd Edition Slide16-37 37

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-38 38

39 16.7 Limited Dependent Variables
Censored Data Figure 16.3 Histogram of Wife’s Hours of Work in 1975 Principles of Econometrics, 3rd Edition

40 Censored Data Having censored data means that a substantial fraction of the observations on the dependent variable take a limit value. The regression function is no longer given by (16.30). The least squares estimators of the regression parameters obtained by running a regression of y on x are biased and inconsistent—least squares estimation fails. (16.30) Principles of Econometrics, 3rd Edition

41 Censored Data Having censored data means that a substantial fraction of the observations on the dependent variable take a limit value. The regression function is no longer given by (16.30). The least squares estimators of the regression parameters obtained by running a regression of y on x are biased and inconsistent—least squares estimation fails. (16.30) Principles of Econometrics, 3rd Edition

42 Censoring versus Truncation
With truncation, we only observe the value of the regressors when the dependent variable takes a certain value (usually a positive one instead of zero) With censoring we observe in principle the value of the regressors for everyone, but not the value of the dependent variable for those whose dependent variable takes a value beyond the limit

43 16.7.2 A Monte Carlo Experiment
We give the parameters the specific values and Assume (16.31) Principles of Econometrics, 3rd Edition

44 16.7.2 A Monte Carlo Experiment
Create N = 200 random values of xi that are spread evenly (or uniformly) over the interval [0, 20]. These we will keep fixed in further simulations. Obtain N = 200 random values ei from a normal distribution with mean 0 and variance 16. Create N = 200 values of the latent variable. Obtain N = 200 values of the observed yi using Principles of Econometrics, 3rd Edition

45 16.7.2 A Monte Carlo Experiment
Figure 16.4 Uncensored Sample Data and Regression Function

46 16.7.2 A Monte Carlo Experiment
Figure 16.5 Censored Sample Data, and Latent Regression Function and Least Squares Fitted Line Principles of Econometrics, 3rd Edition

47 16.7.2 A Monte Carlo Experiment
OLS for all the 200 observations predicts: (16.32a) OLS for only the 100 positive observations (y >0) predicts: (16.32b) Our Monte Carlo experiment resamples 200 times and on average predicts on average: (16.33) Principles of Econometrics, 3rd Edition

48 16.7.2 A Monte Carlo Experiment
OLS for all the 200 observations predicts: (16.32a) OLS for only the 100 positive observations (y >0) predicts: (16.32b) Our Monte Carlo experiment resamples 200 times and on average predicts on average: (16.33) Principles of Econometrics, 3rd Edition

49 16.7.3 Maximum Likelihood Estimation
The maximum likelihood procedure is called Tobit in honor of James Tobin, winner of the 1981 Nobel Prize in Economics, who first studied this model. The probit probability that yi = 0 is: Principles of Econometrics, 3rd Edition

50 16.7.3 Maximum Likelihood Estimation
The maximum likelihood estimator is consistent and asymptotically normal, with a known covariance matrix. Using the artificial data the fitted values are: (16.34) Principles of Econometrics, 3rd Edition

51 16.7.3 Maximum Likelihood Estimation
Principles of Econometrics, 3rd Edition

52 16.7.3 Maximum Likelihood Estimation
You can run this experiment yourselves in GRETL open "c:\Program Files\gretl\data\poe\tobit.gdt" smpl 1 200 genr xs = 20*uniform() loop progressive genr y = *xs + 4*normal() genr yi = y > 0 #which is a handy command to generate dummies! genr yc = y*yi ols yc const xs --quiet genr b1s = $coeff(const) genr b2s = $coeff(xs) store coeffs.gdt b1s b2s endloop Principles of Econometrics, 3rd Edition

53 16.7.3 You can repeat the experiment using only the positive values:
open "c:\Program Files\gretl\data\poe\tobit.gdt" genr xs = 20*uniform() genr idx = 1 matrix A = zeros(1000,3) loop quiet smpl --full genr y = *xs + 4*normal() smpl y > 0 --restrict ols y const xs --quiet genr b1s = $coeff(const) genr b2s = $coeff(xs) matrix A[idx,1]=idx matrix A[idx,2]=b1s matrix A[idx,3]=b2s genr idx = idx + 1 endloop # The matrix A contains all 1000 sets of coefficients # bb finds the column mean of A matrix bb = meanc(A) bb Principles of Econometrics, 3rd Edition

54 16.7.3 You can repeat the experiment using only the positive values:
# The matrix A contains all 1000 sets of coefficients # bb finds the column mean of A matrix bb = meanc(A) bb Note that the first cell refers to the average of the “case” number (500.5, since there are 1000 cases numbered 1 to 1000) Principles of Econometrics, 3rd Edition

55 16.7.4 Tobit Model Interpretation
Because the cdf values are positive, the sign of the coefficient does tell the direction of the marginal effect, just not its magnitude. If β2 > 0, as x increases the cdf function approaches 1, and the slope of the regression function approaches that of the latent variable model. (16.35) Principles of Econometrics, 3rd Edition

56 16.7.4 Tobit Model Interpretation
Figure 16.6 Censored Sample Data, and Regression Functions for Observed and Positive y values Principles of Econometrics, 3rd Edition

57 An Example (16.36) Principles of Econometrics, 3rd Edition

58 An Example Principles of Econometrics, 3rd Edition

59 Tobit example in GRETL #Tobit open "c:\Program Files\gretl\data\poe\mroz.gdt" tobit hours const educ exper age kidsl6 genr H_hat = $coeff(const)+$coeff(educ)*mean(educ) +$coeff(exper)*mean(exper) \ +$coeff(age)*mean(age)+$coeff(kidsl6)*1 genr z = cnorm(H_hat/$sigma) genr pred = z*$coeff(educ) smpl hours > 0 --restrict ols hours const educ exper age kidsl6 smpl --full Principles of Econometrics, 3rd Edition

60 Sample Selection Problem: our sample is not a random sample. The data we observe are “selected” by a systematic process for which we do not account. Solution: a technique called Heckit, named after its developer (not original author), Nobel Prize winning econometrician James Heckman. Principles of Econometrics, 3rd Edition

61 16.7.6a The Econometric Model
The econometric model describing the situation is composed of two equations. The first, is the selection equation that determines whether the variable of interest is observed. (16.37) (16.38) Principles of Econometrics, 3rd Edition

62 16.7.6a The Econometric Model
The second equation is the linear model of interest. It is (16.39) (16.40) (16.41) Principles of Econometrics, 3rd Edition

63 16.7.6a The Econometric Model
The estimated “Inverse Mills Ratio” is The estimating equation is (16.42) Principles of Econometrics, 3rd Edition

64 16.7.6b Heckit Example: Wages of Married Women
OLS yields (16.43) Probit on dummy indicating “being in the labour force” yields: From here predict the inverse Mill’s ratio: Principles of Econometrics, 3rd Edition

65 16.7.6b Heckit Example: Wages of Married Women
The maximum likelihood estimated wage equation is The standard errors based on the full information maximum likelihood procedure are smaller than those yielded by the two-step estimation method. (16.44) Principles of Econometrics, 3rd Edition

66 Heckit example in GRETL
#Heckit open "c:\Program Files\gretl\data\poe\mroz.gdt“ genr kids = (kidsl6+kids618>0) logs wage list X = const educ exper list W = const mtr age kids educ probit lfp W genr ind = $coeff(const) + $coeff(age)*age + $coeff(educ)*educ + $coeff(kids)*kids + $coeff(mtr)*mtr #Predict the inverse Mill’s ratio: genr lambda = dnorm(ind)/cnorm(ind) ols l_wage X lambda heckit l_wage X ; lfp W --two-step Principles of Econometrics, 3rd Edition

67 Keywords binary choice models logistic random variable censored data
logit conditional logit log-likelihood function count data models marginal effect feasible generalized least squares maximum likelihood estimation Heckit multinomial choice models identification problem multinomial logit independence of irrelevant alternatives (IIA) odds ratio ordered choice models index models ordered probit individual and alternative specific variables ordinal variables Poisson random variable individual specific variables Poisson regression model latent variables probit likelihood function selection bias limited dependent variables tobit model linear probability model truncated data Principles of Econometrics, 3rd Edition

68 Further models Survival analysis (time-to-event data analysis)
Multivariate probit (biprobit, triprobit, mvprobit)

69 References Hoffmann, 2004 for all topics
Long, S. and J. Freese for all topics Cameron and Trivedi’s book for count data Agresti, A. (2001) Categorical Data Analysis (2nd ed). New York: Wiley.


Download ppt "Qualitative and Limited Dependent Variable Models"

Similar presentations


Ads by Google