Notes 13
Notes 13
Pr ui xi 1 xi .
~ 154 ~
o Sums of random variables with the Bernoulli distribution do converge to normal,
so the coefficient estimates will still be asymptotically normal.
o However, the immediate problem with this is that the linear function
0 1 x1i k x ki will not lie in the range [0, 1] that is required for
probabilities for all values of x.
o This problem is mirrored by the fact that the predicted values of y for some
observations is likely to be outside [0, 1], which does not make sense as a
prediction of Pr[yi = 1| x].
Show diagram of straight-line prediction of probability and possibility of
predictions outside of [0, 1].
o Finally, there is heteroskedasticity in the model as the variance of the Bernoulli
~ 155 ~
rewritten less compactly (but more intuitively) as
Pr yi 1| x i , G x i ,
Pr yi 0| x i , 1 G x i .
The likelihood function, assuming that all observations in the sample are
N
1 yi
IID, is L y , x G x i i 1 G x i
y
.
i 1
This function can be evaluated for any choice of . By searching over the
parameter space for the value of that maximizes this value, we can
calculate the logit or probit coefficient estimator as the that leads to the
highest value of the likelihood function.
Maximum likelihood estimators are known to be consistent,
asymptotically normal, and asymptotically efficient under broadly
applicable conditions.
Calculating the standard errors of the coefficient estimators is
complicated, but is handled by Stata. The asymptotic covariance matrix
of any MLE is the inverse of the “information matrix”:
1
2 ln L ;Y , X
1
cov ˆ I E
. The information matrix
involves the expected values of the matrix of second partial derivatives of
the log-likelihood function with respect to the parameters. It can be
approximated for the sample numerically to get an estimated covariance
matrix for the parameter vector.
Hypothesis tests in this, as in any ML model, are easiest as likelihood
ratio tests: 2 ln Lu ln Lr ~ q . Stata test command also works and does
2
ˆ j c
a Wald test: t ~ t N K where the t distribution is asymptotic.
se ˆj
Goodness of fit:
Fraction predicted correctly:
o If you take the prediction of yi to be 1 if G x i ˆ 0.5 and
zero otherwise, then you get a prediction of zero or one
for each yi. The fraction predicted correctly is just what it
sounds like.
Pseudo-R2:
~ 156 ~
o In the spirit of the usual R2, this is
1
ln L ˆ ; x , y , Z y , 0, 0, , 0 .
ln L Z ; x , y
o [Note: This formula is very strange and looks upside
down, but it’s not. The reason it looks weird is because
we are taking the ratio of logs (we usually subtract them).
Because (with a discrete dependent variable) the
likelihood function is a product of probabilities, it is
always less than one. This means that the logs are
negative, with the denominator being more negative than
the numerator. This, an improvement in fit increases the
likelihood in the numerator by decreasing its absolute
value, making the ratio smaller and the R2 value closer to
one.]
o This ratio is the likelihood function with the best
parameter estimate divided by the likelihood function if
we just predict each y by the sample proportion of y
values that are one.
o Interpretation of in probit and logit regressions:
E yi | x i
In the usual OLS model, j , which is what we are interested
x j
in knowing.
z
In probit or logit model, j is not in useful units because z has no
x j
direct interpretation.
Use graph to demonstrate as horizontal movement
What we’re interested in knowing (for a continuous regressor x) is
Pr y 1 d Pr y 1 z
G z j g z j , where g is the
x j dz x j
probability density function associated with the cumulative distribution
function G.
Graphical interpretation: measures horizontal movement due to
unit change in x; G (z) measures effect of unit horizontal
movement on probability of y = 1.
They have the same sign, so tests of = 0 are equivalent to tests
Pr y 1
of 0.
x j
~ 157 ~
ez
For logit, g z z 1 z G z 1 G z .
1 e z
2
x i e xi x i e xi 1 x i e xi
xi Pr yi 1| x i
e xi "odds ratio"
1 xi Pr yi 0| x i
o j is the effect of xj on the “log odds ratio”
1
1 z2
For probit, g z z e 2
.
2
Because they are density functions, g(z) 0 for all z, so the
Pr y 1
“partial effects” have the same sign as j.
x j
For dummy regressors, we are interested in
Pr y 1| x j 1 Pr y 1|x j 0 .
In Stata: probit reports the coefficients and dprobit (which is still
supported but no longer official) reports the partial effects. The
regression is identical for each.
o Note that the partial effects depend on z and thus on x.
You can specify the values at which to evaluate the partial
effects in dprobit with the default being at the means.
o Partial effects of dummy variables are reported (by
default) as difference in probabilities above, with other
variables at means.
In Stata: logit reports coefficients and logistic reports the “odds-
ˆ
ratio” e j . (This is really the proportional effect of the variable on
the odds ratio, not the odds ratio itself.)
xi j
o If xji increases by one, e x increases to e i
e xi e j , so
ˆ j
e measures the estimated proportion by which a one-
unit change in xji changes the odds ratio.
o Interpretation can be tricky:
All e values are positive.
A zero effect means that = 0 and e = 1.
~ 158 ~
A variable that reduces the odds ratio has a < 1.
A variable that increases the odds ratio has a
> 1.
Example: If ej = 2 and the initial probability p of
y = 1 for this observation is .2, (so the initial odds-
ratio p/(1 – p) is (.2) / (.8) = 0.25), then a one-unit
increase in xj multiplies the odds ratio by ej = 2,
making it 0.5, which means that the probability of
y = 1 has increased from 0.2 to 0.333 = 0.5/(1 +
0.5).
If we do the same example for an observation
with an initial p = 0.5, then the initial odds ratio is
1, the unit increase in xj multiplies it by 2, making
the new odds ratio 2, and thus the probability has
increased from 0.5 to 2/(1 + 2) = 0.667.
Post-estimation commands after probit and logit are very useful
to get predictions (predict gives probability y = 1 by default, not
xb, and margins can be used to get predictions at specific values
of x)
o See probit/logistic postestimation help file for details
o Important for project
o Reliability of probit and logit estimators
Omitted-variable bias
This is more of a problem in probit and logit models because a
coefficient of an included variable can be inconsistent even when
it is uncorrelated with the omitted variable
Heteroskedasticity
Again, more of a problem in probit and logit because the standard
MLE based on an assumption of homoskedasticity is
inconsistent.
You can use the White robust estimator for the covariance
(“robust standard errors”), but you are calculating a valid
standard error for a coefficient that does not converge to the true
parameter value, so it is of less utility than in OLS,
How to deal with these issues?
Be careful about omitted variables
Try to specify the model in a scaled way that makes variance as
constant as possible
~ 159 ~
Discrete-choice dependent variables
What if there are more than two choices?
o Instead of the dependent variable being whether someone attends Reed or not, it
could be whether someone attends Reed (y = 3), attends another private college
(2), attends a public college (1), or doesn’t attend college at all (y = 0).
o This would be four choices rather than two.
o This is an “unordered-choice model:” There is no obvious order to these choices.
If we define y as above and say that changes in characteristics of the individual
(not of the choices) x (say, higher SAT) that make y more likely to move from 0
to 1, we can’t also be confident that these changes in x are more likely to make y
move from 1 to 2 or from 2 to 3.
Multinomial (polytomous) logit model (Greene 6/e, section 23.11)
xi j
e
o Pr yi j | x i M
, where there are M distinct choices. This model has
e
m 1
x i m
M(k + 1) parameters, but only (M – 1)(k + 1) of them are unique because the
sum of the probabilities must be one. (If an increase in family income raises the
probabilities that you will choose y = 2, 3, and 4, it must lower the probability of
choosing y = 1 by an equivalent amount. Thus, i, 1 can be determined from i, 2,
i, 3, and i, 4. Where the second subscript refers to the choice and the first to the
independent variable.) We usually normalize by setting the vector 1 = 0, which
makes the numerator of the probability fraction 1 for choice 1.
Pr yi j | x i
In the multinomial logit model, ln x i j . The coefficients thus
Pr y 1| x
o
i i
can be interpreted as the effect of x on the log odds ratio.
o Independence of irrelevant alternatives assumption is implicit in multinomial
logit model
It shouldn’t matter for the coefficients of the attending-Reed equation
whether one adds attending Lewis & Clark as a special case of attending
a private college (making 5 alternatives) or not
This assumption may not be reasonable in some cases, making the model
inappropriate.
o Multinomial logit models can be estimated by maximum likelihood methods. In
Stata, use mlogit.
Related models:
o Conditional logit model: The x variables relate to properties of the choices
instead of or in addition to the individual. (Not clogit in Stata; that’s something
else.)
~ 160 ~
o Nested logit model: Decisions are nested. For example, decision whether to
attend college, then if attending whether to attend Reed, another private college,
or a public. In Stata, use nlogit.
o Multinomial probit: Same thing with normal rather than logistic function. Very
time-consuming to estimate, so it’s not used often.
yi 3 if 2 yi* 3 ,
M if M 1 yi* .
o If the error term is normal, then we can use ordered probit to estimate the
vector and the thresholds corresponding to the different levels of the variables.
o Ordered logit is used when the error term follows the logistic distribution.
o Ordered probit/logit involves estimating the vector and the threshold values 1
through M – 1 by maximum likelihood.
o If we normalize the model to give the error term unit variance (divide y and x by
the standard deviation of error), then we have
Pr yi 1| x i 1 x i
Pr yi 2| x i 2 x i 1 x i
Pr yi 3| x i 3 x i 2 x i
Pr yi M | x i 1 M 1 x i .
n
M
o The likelihood function is L , ; y, x I yi m Pr yi m | x i , ,
i 1 m 1
where I(yi = m) is an indicator function that is one if the condition is true and the
probability is given by the formulas above. The likelihood function is maximized
by searching over alternative values of and to find those that maximize.
~ 161 ~
o Show Greene (6/e) Figure 23.4 from p. 833.
~ 162 ~
Count dependent variables
Count dependent variables can only take on non-negative integer values.
o Normal distribution is not a plausible choice.
o Poisson distribution is often used for count models:
e i im
Pr yi m| xi .
m!
Poisson distribution has mean and variance both equal to i, so
E yi | x i i
In Poisson regression we model i e X i .
n
The log-likelihood function is ln L e i yi x i ln yi ! and we
x
i 1
~ 163 ~
o The most common alternative is the negative binomial regression model, which
is implemented as nbreg in Stata.
y , if yi 0,
* *
variable with a normal distribution and yi i as the observed
0, otherwise
outcome.
This variable has a censored distribution with finite probability of a zero
outcome but otherwise normally distributed over the positive values.
~ 164 ~
The conditional density of y is
1 yi x i
f yi | x i for y > 0, and
Pr yi 0| x i 1 x i / .
This density is the basis for the tobit estimator of the vector .
Tobit maximizes (over , ) the log-likelihood function:
x i 1 yi x i
ln L , ; y, x ln 1 ln
i : yi 0
i : yi 0
The limit value (zero here, but it could be some value c) must be
specified.
Can also have distributions that are censored above, or both above and
below (perhaps the share of merlot in total wine consumption), where
some people choose zero and some choose one).
o Interpreting tobit coefficients
There are two expected values of interest in the tobit model:
“Conditional (on yi > 0) expectations”
E yi |xi | yi 0 E yi | yi 0, x i
o Draw graph showing censorship at 0 and density function
yi
over yi > 0 = f yi | yi 0 .
1 yi
o Remarkable and useful property of standard normal
c
distribution: E z | z c .
1 c
o yi > 0 iff ui > –xi and ui is (by assumption) distributed
normally with mean 0 and variance 2. Thus ui/ is
u u c
standard normal and E i i c .
1 c
o Conditional on x, E(x) = x, so
E yi | yi 0, x i x i E ui |ui x i x i
u u x
x i E i i i x i
x
i
xi ,
xi
where we use the properties that (–z) = (z) and 1 – (–z)
= (z).
~ 165 ~
c
o We define the inverse Mills ratio as c .
c
x
o Then E yi | yi 0, x i x i i is the “conditional
expectation” of y given that y is positive.
“Unconditional (on y > 0) expectation” (which is still
conditional on x) E yi | x i :
E yi | x i 0 Pr yi 0| x i E yi | yi 0, x i Pr yi 0| x i
E yi | yi 0, x i Pr yi 0| x i
x u x
o x i i Pr i i
x
i
x
xi i
x
i
x x
i x i i .
Interpretation of j?
E yi | xi
In the usual OLS model, j .
x j
Here,
E yi | yi 0, x i x i / x i /
j
x j xi / xj
x i /
j j .
xi /
c c c c c
o By quotient rule, .
c
c
2
c c
c
2
c c c .
~ 166 ~
o Therefore,
E yi | yi 0, x i x x x
j i i i .
x j
The expression in braces is between 0 and 1, so
the effect of xj on the conditional expectation of y
is of the same sign as j but smaller magnitude.
Testing j = 0 is a valid test for the partial effect
being zero.
Given that E yi | x i E yi | yi 0, x i Pr yi 0| x i ,
E yi | x i E yi | yi 0, x i
Pr yi 0| x i
x j x j
Pr yi 0| x i
E yi | yi 0, x i .
x j
x
i
Pr yi 0| x i j x
o i .
x j j
E yi | yi 0, x i x x x
o j i i i .
x j
o So (with all , , and functions evaluated at xi/)
E yi | x i xi j
j x i
x j
xi xi
j
x
j i .
o Doing tobit estimation in Stata
tobit depvar indvars , ll(0) does tobit with zero lower censorship
ul( ) option specifies possible upper point of censorship
After estimation, can use the predict command to generate some useful
series:
predict , pr(0, .) gives the predicted probability that each observation
x
is not censored, Pr yi 0| x i i .
predict , e(0, .) gives the predicted value of each observation
conditional on not being censored, E yi | yi 0, x i
~ 167 ~
predict , ystar(0, .) gives the unconditional predicted value of each
observation E yi | x i .
margins is used after tobit to get partial effects
The options correspond to those of predict:
o Margins dydx(*) , pr(0, ) gives effect of unit change in all
Pr y 0
variables (*) on probability that y > 0:
x
o Margins dydx(*) , e(0, ) gives effect of unit change in all
variables on expected value condition on not being
E y | y 0, x
censored
x
o Margins dydx(*) , ystar(0, ) gives effect of unit change in
all variables on unconditional expected value
E y * E max y,0
x x
Censored regression (top-coding problems, unexpired duration models, etc.)
o We have data on the x variables for all observations, but have no observations on
y for those at one end (or both ends) of the distribution.
If y > c, then we observe c.
o Let yi xi ui , where ui is homoskedastic normal. We don’t observe y but
instead observe wi min yi , c i , where ci is a known constant that can vary with
i.
o Note difference from tobit model: In tobit a finite fraction of people chose the
limit value. Here they chose something continuous outside the limit but we
simply do not observe it.
This means that we don’t have to model the censorship as part of the
choice, rather only account for it in the estimation based on our flawed
data.
o For uncensored observations, we have the usual distribution of y:
1 yi x i
f w i | x i f yi | x i .
o For censored observations,
Pr wi c i | x i Pr yi c i | x i
Pr ei c i x i | x i
c xi
1 i .
o So likelihood function is same as the tobit model, as is estimation.
~ 168 ~
o However, in the censored regression case we don’t need to worry about people
choosing the limit value, we only worry about observing it. Thus, j is the effect of
xj on y, period. We don’t need to hassle with the marginal effects calculations as
in the tobit model. Consequently, we can use the Stata tobit command and just
neglect the margins command afterward.
Truncated regression models
o Truncated regression differs from censored regression in that neither y nor x is
observed for observations beyond the limit point. Thus, we cannot use these data
points at all, making the tobit estimator impossible to calculate.
This is a sample problem again, but truncation of the sample (all
variables) is more severe than censorship of a single variable because we
have less (no) information about the missing observations.
In the censored model, we can use the x values of the censored
observations to determine what kinds of observations will be in the
censored range. In the truncated model, we don’t have that information.
o Truncated regression model
yi 0 x i i ,
ui | x ~ N (0, 2 ).
IID assumption is violated:
We observe (xi, yi) only if yi ci, where the truncation threshold
can vary with i and can depend on xi.
The conditional density function of yi given that it is in the sample (> ci)
y xi
i
f yi | x i , ,
2
e ,
is g yi | x i , c i
e
yi c i .
1 F c i | x i , , e2 c xi
i
e
The function in the denominator is the probability that observation i is
not censored, given xi and ci. We divide by this to redistribute the
truncated amount of probability over the remaining density function.
The log-likelihood function is just the log of this density summed over all
the observations in the sample.
OLS in this case would give slope estimates that are biased toward zero.
Incidental truncation and sample selection
o Sample selection does not bias OLS estimators unless the selection criterion is
related to u. So selection based exclusively on x or on something outside the
model that is uncorrelated with u does not present a problem.
o “Incidental truncation” occurs when we observe y for only a subset of the
population that depends not on y but on another variable, but the other variable
is correlated with u.
~ 169 ~
The primary (only?) example in the literature is y = ln(wage offer), which
is observed only for people who work.
But people who have unusually low wage offers (given their other
characteristics) are less likely to work and therefore more likely to be
truncated, so the variable determining truncation (work status) is
correlated with the error term of the wage equation.
yi x i ui
o 1, if z i vi 0,
si
0, otherwise.
si is a sample indicator that is one for observations for which we observe y
and zero otherwise.
We assume that E ui | x i , z i 0 and xi is a strict subset of zi.
We also assume that v is a standard normal that is independent of z, but
that it may be correlated with u.
E yi |z i , vi x i E ui |z i , vi x i E ui |vi .
Let E ui |vi vi with being a parameter of their joint normal
distribution (related to the correlation).
This means that
E yi |zi , vi x i vi ,
E yi |zi , si x i E vi |zi , si .
Since our sample is the set of observations for which s = 1, we need the
expected value of y conditional on s = 1, and by logic similar to that used
in the tobit model, E vi | zi , si 1 z i , where is the inverse Mills
ratio /.
Thus, E yi | z i , si 1 x i z i .
o We can’t observe the term unless we know . The Heckit estimator is a two-
step estimation procedure for estimating first , then .
The selection variable s follows a probit model:
Pr si 1 Pr zi vi Pr vi zi
Pr vi v i z i .
Thus, we estimate the sample-selection equation as a probit of s on z,
using all of the observations (because we don’t need to observe y for this
equation and we observe z for all observations).
We then compute the estimated inverse Mills ratio for each observation
zi ˆ
as ˆ i zi ˆ .
zi ˆ
~ 170 ~
We can then estimate by running OLS on yi x i ˆ i ui using only
the observations for which y is observed. The inclusion of the estimated
inverse Mills ratio on the right-hand side corrects the bias due to sample
selection and makes the estimates consistent and approximately
normal.
Testing = 0 with a standard t test is a valid test for whether there was
sample selection.
o Note that the regular OLS standard errors are incorrect because they assume that
is exactly known. There will be error in estimating by ̂ , so this error needs
to be taken into account in calculating the reliability of ̂ .
Stata command heckman computes heckit estimator either by full
maximum likelihood or by the two-step estimation method. This will
correct the standard errors.
o In order to apply this model reliably, there must be at least one variable that
determines sample selection that does not affect y.
In the wage equation, it is usually assumed that family variables such as
number of children would not affect the wage offer but would affect a
person’s choice of whether or not to accept it and work.
~ 171 ~