Statistics - New York University

Statistics - New York University

18-1/67 Econometrics I Professor William Greene Stern School of Business Department of Economics Part 18: Maximum Likelihood 18-2/67 Econometrics I Part 18 Maximum Likelihood Part 18: Maximum Likelihood 18-3/67 Maximum Likelihood Estimation This defines a class of estimators based on the particular distribution assumed to have generated the observed random variable. Not estimating a mean least squares is not available Estimating a mean (possibly), but also using information about the distribution

Part 18: Maximum Likelihood Setting Up the MLE The distribution of the observed random variable is written as a function of the parameters to be estimated P(yi|data,) = Probability density | parameters. The likelihood function is constructed from the density Construction: Joint probability density function of the observed sample of data generally the product when the data are a random sample. 18-4/67 Part 18: Maximum Likelihood (Log) Likelihood Function f(yi|,xi) = probability density of observed yi given parameter(s) and possibly data, xi. Observations are independent Joint density = f(y |,x ) = L(|y,X)

i i i f(yi|,xi) is the contribution of observation i to the likelihood. The MLE of maximizes L(|y,X) In practice it is usually easier to maximize logL(|y,X) = i logf(yi|,xi) 18-5/67 Part 18: Maximum Likelihood Average Time Until Failure Estimating the average time until failure, , of light bulbs. yi = observed life until failure. f(yi|) = (1/)exp(-yi/) L() = i f(yi|)= -n exp(-yyi/) logL() = -nlog () - yyi/

Likelihood equation: logL()/ = -n/ + yyi/2 =0 Solution: MLE = yyi /n. Note: E[yi]= Note, logf(yi|)/ = -1/ + yi/2 Since E[yi] = , E[logf()/]=0. Extension: Loglinear Model: i = exp(xi) = E[yi|xi] 18-6/67 Part 18: Maximum Likelihood The MLE The log-likelihood function: logL(|data) The likelihood equation(s): First derivatives of logL equal zero at the MLE. (1/n)yi logf(yi|,xi)/MLE = 0. (Sample statistic.) (The 1/n is irrelevant.) First order conditions for maximization Usually a nonlinear estimator. A moment condition - its counterpart is the fundamental theoretical result E[logL/] = 0. 18-7/67

Part 18: Maximum Likelihood Properties of the MLE Consistent: Not necessarily unbiased, however Asymptotically normally distributed: Proof based on central limit theorems Asymptotically efficient: Among the possible estimators that are consistent and asymptotically normally distributed counterpart to GaussMarkov for linear regression Invariant: The MLE of g() is g(the MLE of ) 18-8/67 Part 18: Maximum Likelihood The Linear (Normal) Model Definition of the likelihood function - joint density of the observed data, written as a function of the parameters we wish to estimate. Definition of the maximum likelihood estimator as that function of the observed data that maximizes the likelihood function, or its logarithm. For the model: yi = xi + i, where i ~ N[0,2], the maximum likelihood estimators of and 2 are b = (XX)-1Xy and s2 = ee/n.

That is, least squares is ML for the slopes, but the variance estimator makes no degrees of freedom correction, so the MLE is biased. 18-9/67 Part 18: Maximum Likelihood Normal Linear Model The log-likelihood function = i log f(yi|) = sum of logs of densities. For the linear regression model with normally distributed disturbances logL = i [ -log 2 - log 2 - (yi xi)2/2 ]. 18-10/67 = -n/2[log2 + log2 + v2/2] v2 = /n Part 18: Maximum Likelihood Likelihood Equations The estimator is defined by the function of the data that equates log-L/ to 0. (Likelihood equation)

The derivative vector of the log-likelihood function is the score function. For the regression model, g = [logL/ , logL/2] = logL/ = i [(1/2)xi(yi - xi) ] = X/2 . logL/2 = i [-1/(22) + (yi - xi)2/(24)] = -n/22 [1 s2/2] For the linear regression model, the first derivative vector of logL is (1/2)X(y - X) (K1) and (1/22) i [(yi - xi)2/2 - 1] (11) Note that we could compute these functions at any and 2. If we compute them at b and ee/n, the functions will be identically zero. 18-11/67 Part 18: Maximum Likelihood Maximizer of the log likelihood? Use the Information Matrix The negative of the second derivatives matrix of the loglikelihood,

-H = 2 log f i i ' For a maximizer, -H is positive definite. -H forms the basis for estimating the variance of the MLE. It is usually a random matrix. H is the information matrix. 18-12/67 Part 18: Maximum Likelihood Hessian for the Linear Model 2 logL 2 logL = - 2 logL 2

1 = 2 1 2 2 logL 2 2 logL 22 1 x x x (y x ) i i i

i i 2 i i 1 2 i (yi xi)xi 24 i (yi xi) Note that the off diagonal elements have expectation zero. 18-13/67 Part 18: Maximum Likelihood Information Matrix This can be computed at any vector and scalar 2. You can take expected values of the parts of the matrix to get 1 0 2 i xi xi -E[H]=

n 0 2 4 (which should look familiar). The off diagonal terms go to zero (one of the assumptions of the linear model). 18-14/67 Part 18: Maximum Likelihood Asymptotic Variance The asymptotic variance is {E[H]}-1 i.e., the inverse of the information matrix. 1 2 xx

i i i {-E[H]} 1= 0 18-15/67 1 0 2 XX = 24 0 n 0 4 2 n

There are several ways to estimate this matrix Inverse of negative of expected second derivatives Inverse of negative of actual second derivatives Inverse of sum of squares of first derivatives Robust matrix for some special cases Part 18: Maximum Likelihood Computing the Asymptotic Variance We want to estimate {-E[H]}-1 Three ways: (1) Just compute the negative of the actual second derivatives matrix and invert it. (2) Insert the maximum likelihood estimates into the known expected values of the second derivatives matrix. Sometimes (1) and (2) give the same answer (for example, in the linear regression model). (3) Since E[H] is the variance of the first derivatives, estimate this with the sample variance (i.e., mean square) of the first derivatives, then invert the result. This will almost always be different from (1) and (2). Since they are estimating the same thing, in large samples, all three will give the same answer. Current practice in econometrics often

favors (3). Stata rarely uses (3). Others do. 18-16/67 Part 18: Maximum Likelihood Model for a Binary Dependent Variable Binary outcome. 18-17/67 Event occurs or doesnt (e.g., the person adopts green technology, the person enters the labor force, etc.) Model the probability of the event. P(x)=Prob(y=1|x) Probability responds to independent variables Requirements for a probability

0 < Probability < 1 P(x) should be monotonic in x its a CDF Part 18: Maximum Likelihood 18-18/67 Behavioral Utility Based Approach Observed outcomes partially reveal underlying preferences There exists an underlying preference scale defined over alternatives, U*(choices) Revelation of preferences between two choices labeled 0 and 1 reveals the ranking of the underlying utility U*(choice 1) > U*(choice 0) Choose 1

U*(choice 1) < U*(choice 0) Choose 0 Net utility = U = U*(choice 1) - U*(choice 0). U > 0 => choice 1 Part 18: Maximum Likelihood 18-19/67 Binary Outcome: Visit Doctor In the 1984 year of the GSOEP, 2265 of 3874 individuals visited the doctor at least once. Part 18: Maximum Likelihood 18-20/67 A Random Utility Model for the Binary Choice Yes or No decision | Visit or not visit the doctor Model: Net utility of visit at least once

Net utility depends on observables and unobservables Udoctor = Net utility = U*visit U*not visit Random Utility Udoctor = + 1Age + 2Income + 3Sex + Choose to visit at least once if net utility is positive Observed Data: X = Age, Income, Sex y = 1 if choose visit, Udoctor > 0, 0 if not. Part 18: Maximum Likelihood 18-21/67 Modeling the Binary Choice Between the Two Alternatives Net Utility U = U* U* doctor

visit not visit Udoctor = + 1 Age + 2 Income + 3 Sex + Chooses to visit: Udoctor > 0 + 1 Age + 2 Income + 3 Sex + > 0 Choosing to visit is a random outcome because of > -( + 1 Age + 2 Income + 3 Sex) Part 18: Maximum Likelihood Probability Model for Choice Between Two Alternatives People with the same (Age,Income,Sex) will make different choices because is random. We can model the probability that the random event visits the doctorwill occur. Probability is governed by , the random part of the utility function. Event DOCTOR=1 occurs if > -( + 1Age + 2Income + 3Sex) We model the probability of this event.

18-22/67 Part 18: Maximum Likelihood 18-23/67 An Application 27,326 Observations in GSOEP Sample 1 to 7 years, panel 7,293 households observed We use the 1994 year; 3,337 household observations Part 18: Maximum Likelihood An Econometric Model Choose to visit iff U > 0 Udoctor = + Age + Income + Sex + 1

2 3 doctor Udoctor > 0 > -( + 1 Age + 2 Income + 3 Sex) < + 1 Age + 2 Income + 3 Sex) Probability model: For any person observed by the analyst, Prob(doctor=1) = Prob( < + 1 Age + 2 Income + 3 Sex) 18-24/67 Note the relationship between the unobserved and the observed outcome DOCTOR. Part 18: Maximum Likelihood 18-25/67 Index = +1Age + 2 Income + 3 Sex

Probability = a function of the Index. P(Doctor = 1) = f(Index) Internally consistent probabilities: (1) (Coherence) 0 < Probability < 1 (2) (Monotonicity) Probability increases with Index. Part 18: Maximum Likelihood 18-26/67 A Fully Parametric Model Index Function: U = xx + Observation Mechanism: y = 1[U > 0] Distribution: ~ f(); Normal, Logistic, Maximum Likelihood Estimation: Max() logL = yi log Prob(Yi = yi|xi)

Part 18: Maximum Likelihood 18-27/67 A Parametric Logit Model We examine the model components. Part 18: Maximum Likelihood Parametric Model Estimation How to estimate , 1, 2, 3? The technique of maximum likelihood L y 0 Prob[ y 0 | x] y 1 Prob[ y 1| x] Prob[doctor=1] = Prob[ > -( + 1 Age + 2 Income + 3 Sex)] Prob[doctor=0] = 1 Prob[doctor=1]

18-28/67 Requires a model for the probability Part 18: Maximum Likelihood 18-29/67 Completing the Model: F() The distribution Normal: PROBIT, natural for behavior Logistic: LOGIT, allows thicker tails Gompertz: EXTREME VALUE, asymmetric Others

Does it matter? Yes, large difference in estimates Not much, quantities of interest are more stable. Part 18: Maximum Likelihood 18-30/67 Estimated Binary Choice Models for Three Distributions Log-L(0) = log likelihood for a model that has only a constant term. Ignore the t ratios for now. Part 18: Maximum Likelihood Effect on Predicted Probability of an Increase in Age + 1 (Age+1) + 2 (Income) + 3 Sex (1 is positive) 18-31/67 Part 18: Maximum Likelihood

18-32/67 Partial Effects in Probability Models Prob[Outcome] = some F(+1Income) Partial effect = F(+1Income) / x (derivative) Partial effects are derivatives Result varies with model Logit: F(+1Income) /x = Prob * (1-Prob)

Probit: F(+1Income)/x = Normal density Extreme Value: F(+1Income)/x = Prob * (-log Prob) Scaling usually erases model differences Part 18: Maximum Likelihood Partial effect for the logit model exp(+Age+Income+Sex1Age+Age+Income+Sex2Income+Age+Income+Sex3Sex)

Prob(doctor =1) = 1+exp(+Age+Income+Sex1Age+Age+Income+Sex2Income+Age+Income+Sex3Sex) = ( +Age+Income+Sex1Age+Age+Income+Sex2Income+Age+Income+Sex3Sex) = (x) The derivative with respect to one of the variables is (x) (x) 1 (x) Age+Income+Sexk xk (1) A multiple of the coeffi cient, not t he coeffi cient itself (2) A function of all of the coeffi cient s and variables (3) Evaluated using the data and model parts after the model is estimated. Similar computations apply for other models such as probit. 18-33/67 Part 18: Maximum Likelihood 18-34/67 Estimated Partial Effects for Three Models (Standard errors to be considered later)

Part 18: Maximum Likelihood Partial Effect for a Dummy Variable Computed Using Means of Other Variables 18-35/67 Prob[yi = 1|xi,di] = F(xi+di) where d is a dummy variable such as Sex in our doctor model. For the probit model, Prob[yi = 1|xi,di] = (x+d), = the normal CDF. Partial effect of d Prob[yi = 1|xi, di=1] - Prob[yi = 1|xi, di=0] x x ( d

) = i Part 18: Maximum Likelihood 18-36/67 Partial Effect Dummy Variable Part 18: Maximum Likelihood 18-37/67 Computing Partial Effects

Compute at the data means (PEA) Simple Inference is well defined. Not realistic for some variables, such as Sex Average the individual effects (APE) More appropriate Asymptotic standard errors are slightly more complicated. Part 18: Maximum Likelihood Partial Effects Probability = Pi F( ' xi ) Pi F( ' xi ) Partial Effect =

f ( ' xi ) = di xi xi Partial Effect at the Means = f ( ' x ) f ' n1 in1xi Average Partial Effect = 1 n in1di 1 n

in1f ( ' xi ) Both are estimates of =E[d] under certain assE[di ] under certain assumptions. 18-38/67 Part 18: Maximum Likelihood The two approaches usually give similar answers, though sometimes the results differ substantially. Average Partial Partial Effects Effects at Data Means Age 0.00512 0.00527 Income -0.09609 -0.09871 Female 0.13792 0.13958 18-39/67 Part 18: Maximum Likelihood 18-40/67

APE vs. Partial Effects at the Mean Delta Method for Average Partial Effect N 1 Estimator of Var i 1 PartialEffect i G Var G N Part 18: Maximum Likelihood 18-41/67 Part 18: Maximum Likelihood 18-42/67 Part 18: Maximum Likelihood 18-43/67 Part 18: Maximum Likelihood How Well Does the Model Fit the Data?

There is no R squared for a probability model. 18-44/67 Least squares for linear models is computed to maximize R 2 There are no residuals or sums of squares in a binary choice model The model is not computed to optimize the fit of the model to the data How can we measure the fit of the model to the data? Fit measures computed from the log likelihood Pseudo R squared = 1 logL/logL0 Also called the likelihood ratio index

Direct assessment of the effectiveness of the model at predicting the outcome Part 18: Maximum Likelihood Pseudo R2 = Likelihood Ratio Index Pseudo R 2 = 1 - log L for the model log L for a model with only a constant term The prediction of the model is F = F xi = Estimated Prob(yi 1| xi ) Using only the constant term, F() LogL 0 = n (1 i 1

yi ) log[1 F()] yi log F() = n0 log[1 F()] n1 log F() < 0 The log likelihood for the model is larger, but also < 0. log L LRI = 1 . Since logL > logL 0 0 LRI < 1. log L0 18-45/67 Part 18: Maximum Likelihood The Likelihood Ratio Index 18-46/67 Bounded by 0 and a number < 1 Rises when the model is expanded Specific values between 0 and 1 have no meaning

Can be strikingly low even in a great model Should not be used to compare models Use logL Use information criteria to compare nonnested models Can be negative if the model is not a discrete choice model. For linear regression, logL=-n/2(1+log2+log(exe/n)]; Positive if exe/n < 0.058497 Part 18: Maximum Likelihood 18-47/67 Fit Measures Based on LogL ---------------------------------------------------------------------Binary Logit Model for Binary Choice Dependent variable DOCTOR Log likelihood function -2085.92452 Full model LogL Restricted log likelihood -2169.26982 Constant term only LogL0 Chi squared [

5 d.f.] 166.69058 Significance level .00000 McFadden Pseudo R-squared .0384209 1 LogL/logL0 Estimation based on N = 3377, K = 6 Information Criteria: Normalization=1/N Normalized Unnormalized AIC 1.23892 4183.84905 -2LogL + 2K Fin.Smpl.AIC 1.23893 4183.87398 -2LogL + 2K + 2K(K+1)/(N-K-1) Bayes IC 1.24981 4220.59751 -2LogL + KlnN Hannan Quinn

1.24282 4196.98802 -2LogL + 2Kln(lnN) --------+------------------------------------------------------------Variable| Coefficient Standard Error b/St.Er. P[|Z|>z] Mean of X --------+------------------------------------------------------------|Characteristics in numerator of Prob[Y = 1] Constant| 1.86428*** .67793 2.750 .0060 AGE| -.10209*** .03056 -3.341 .0008 42.6266 AGESQ| .00154*** .00034 4.556 .0000 1951.22 INCOME| .51206

.74600 .686 .4925 .44476 AGE_INC| -.01843 .01691 -1.090 .2756 19.0288 FEMALE| .65366*** .07588 8.615 .0000 .46343 --------+------------------------------------------------------------- Part 18: Maximum Likelihood 18-48/67 Fit Measures Based on Predictions Computation

Use the model to compute predicted probabilities P = F(a + b Age + b Income + b Female+) 1 2 3 Use a rule to compute predicted y = 0 or 1 Predict y=1 if P is large enough Generally use 0.5 for large (more likely than not) y 1 if P > P* Fit measure compares predictions to actuals Count successes and failures Part 18: Maximum Likelihood Computing test statistics requires the log likelihood and/or standard errors based on the Hessian of LogL 18-49/67

Logit: g i = yi - i H i = i (1-i ) E[Hi ] = i = i (1-i ) (qi 2 yi 1, zi qi xi . i = exp(zi )/[1+exp(zi )]) 2 zi i i i2 Hi = , E[H i ] = i = i i i (1 i ) i ( zi ), i ( zi ). Note, g i is a "generalized residual." q Probit: g i = i i i Estimators: Based on H i , E[H i ] and g i2 all functions evaluated at zi N Est.Asy.Var[ ] = i 1 H i xi xi

1 N Expected Hessian: Est.Asy.Var[ ] = i 1 i xi xi 1 N Est.Asy.Var[ ] = i 1 g i2 xi xi 1 Actual Hessian: BHHH: Part 18: Maximum Likelihood 18-50/67

Robust Covariance Matrix (Robust to the model specification? Latent heterogeneity? Correlation across observations? Not always clear) "Robust" Covariance Matrix: V = A B A A = negative inverse of second derivatives matrix 1 2 log L N log Prob i = estimated E i 1

B = matrix sum of outer products of first derivatives 2 1 log L log L = estimated E N log Probi log Probi i 1 N

1 For a logit model, A = i 1 Pi (1 Pi ) xi xi N N 2 B = i 1 ( yi Pi ) xi xi i 1 ei2 xi xi (Resembles the White estimator in the linear model case.)

Part 18: Maximum Likelihood 1 18-51/67 Robust Covariance Matrix for Logit Model Doesnxt change much. The model is well specified. --------+-------------------------------------------------------------------| Standard Prob. 95% Confidence DOCTOR| Coefficient Error z |z|>Z* Interval --------+-------------------------------------------------------------------Conventional Standard Errors Constant| 1.86428*** .67793 2.75 .0060 .53557 3.19299 AGE|

-.10209*** .03056 -3.34 .0008 -.16199 -.04219 AGE^2.0| .00154*** .00034 4.56 .0000 .00088 .00220 INCOME| .51206 .74600 .69 .4925 -.95008 1.97420 |Interaction AGE*INCOME _ntrct02| -.01843 .01691 -1.09 .2756 -.05157 .01470 FEMALE| .65366***

.07588 8.61 .0000 .50494 .80237 --------+-------------------------------------------------------------------Robust Standard Errors Constant| 1.86428*** .68518 2.72 .0065 .52135 3.20721 AGE| -.10209*** .03118 -3.27 .0011 -.16321 -.04098 AGE^2.0| .00154*** .00035 4.44 .0000 .00086 .00222 INCOME| .51206 .75171

.68 .4958 -.96127 1.98539 |Interaction AGE*INCOME _ntrct02| -.01843 .01705 -1.08 .2796 -.05185 .01498 FEMALE| .65366*** .07594 8.61 .0000 .50483 .80249 Part 18: Maximum Likelihood 18-52/67 The Effect of Clustering

Yit must be correlated with Yis across periods Pooled estimator ignores correlation Broadly, yit = E[yit|xit] + wit, E[y |x ] = Prob(y = 1|x ) it it it it w is correlated across periods it Assuming the marginal probability is the same, the pooled estimator is consistent. (We just saw that it might not be.) Ignoring the correlation across periods generally leads to underestimating standard errors. Part 18: Maximum Likelihood 18-53/67 Clusterx Corrected Covariance Matrix C the number if clusters nc number of observations in cluster c

H 1 = negative inverse of second derivatives matrix gic = derivative of log density for observation Part 18: Maximum Likelihood Cluster Correction: Doctor ---------------------------------------------------------------------Binomial Probit Model Dependent variable DOCTOR Log likelihood function -17457.21899 --------+------------------------------------------------------------Variable| Coefficient Standard Error b/St.Er. P[|Z|>z] Mean of X --------+------------------------------------------------------------| Conventional Standard Errors Constant| -.25597*** .05481 -4.670 .0000 AGE| .01469*** .00071 20.686 .0000 43.5257

EDUC| -.01523*** .00355 -4.289 .0000 11.3206 HHNINC| -.10914** .04569 -2.389 .0169 .35208 FEMALE| .35209*** .01598 22.027 .0000 .47877 --------+------------------------------------------------------------| Corrected Standard Errors Constant| -.25597*** .07744 -3.305 .0009 AGE| .01469***

.00098 15.065 .0000 43.5257 EDUC| -.01523*** .00504 -3.023 .0025 11.3206 HHNINC| -.10914* .05645 -1.933 .0532 .35208 FEMALE| .35209*** .02290 15.372 .0000 .47877 --------+------------------------------------------------------------- 18-54/67

Part 18: Maximum Likelihood Hypothesis Tests We consider nested models and parametric tests Test statistics based on the usual 3 strategies 18-55/67 Wald statistics: Use the unrestricted model Likelihood ratio statistics: Based on comparing the two models Lagrange multiplier: Based on the restricted model. Test statistics require the log likelihood and/or the first and second derivatives of logL Part 18: Maximum Likelihood

Base Model for Hypothesis Tests ---------------------------------------------------------------------Binary Logit Model for Binary Choice Dependent variable DOCTOR Log likelihood function -2085.92452 H0: Age is not a significant Restricted log likelihood -2169.26982 Chi squared [ 5 d.f.] 166.69058 determinant of Significance level .00000 Prob(Doctor = 1) McFadden Pseudo R-squared .0384209 Estimation based on N = 3377, K = 6 H0 : 2 = 3 = 5 = 0 Information Criteria: Normalization=1/N Normalized Unnormalized AIC

1.23892 4183.84905 --------+------------------------------------------------------------Variable| Coefficient Standard Error b/St.Er. P[|Z|>z] Mean of X --------+------------------------------------------------------------|Characteristics in numerator of Prob[Y = 1] Constant| 1.86428*** .67793 2.750 .0060 AGE| -.10209*** .03056 -3.341 .0008 42.6266 AGESQ| .00154*** .00034 4.556 .0000 1951.22 INCOME| .51206 .74600

.686 .4925 .44476 AGE_INC| -.01843 .01691 -1.090 .2756 19.0288 FEMALE| .65366*** .07588 8.615 .0000 .46343 --------+------------------------------------------------------------- 18-56/67 Part 18: Maximum Likelihood Likelihood Ratio Test Null hypothesis restricts the parameter vector Alternative relaxes the restriction Test statistic: Chi-squared = 2 (LogL|Unrestricted model LogL|Restrictions) > 0

Degrees of freedom = number of restrictions 18-57/67 Part 18: Maximum Likelihood LR Test of H0: 2 = 3 = 5 = 0 UNRESTRICTED MODEL Binary Logit Model for Binary Choice Dependent variable DOCTOR Log likelihood function -2085.92452 Restricted log likelihood -2169.26982 Chi squared [ 5 d.f.] 166.69058 Significance level .00000 McFadden Pseudo R-squared .0384209 Estimation based on N = 3377, K = 6 Information Criteria: Normalization=1/N

Normalized Unnormalized AIC 1.23892 4183.84905 18-58/67 RESTRICTED MODEL Binary Logit Model for Binary Choice Dependent variable DOCTOR Log likelihood function -2124.06568 Restricted log likelihood -2169.26982 Chi squared [ 2 d.f.] 90.40827 Significance level .00000 McFadden Pseudo R-squared .0208384 Estimation based on N = 3377, K = 3

Information Criteria: Normalization=1/N Normalized Unnormalized AIC 1.25974 4254.13136 Chi squared[3] = 2[-2085.92452 - (-2124.06568)] = 77.46456 Part 18: Maximum Likelihood 18-59/67 Wald Test of H0: 2 = 3 = 5 = 0 Unrestricted parameter vector is estimated Discrepancy: q= Rb m is computed (or r(b,m) if nonlinear) Variance of discrepancy is estimated: Var[q] = R V R Wald Statistic is q[Var(q)]-1q = qx[RVRx]-1q Part 18: Maximum Likelihood 18-60/67 Wald Test

Chi squared[3] = 69.0541 Part 18: Maximum Likelihood Lagrange Multiplier Test of H0: 2 = 3 = 5 = 0 18-61/67 Restricted model is estimated Derivatives of unrestricted model and variances of derivatives are computed at restricted estimates Wald test of whether derivatives are zero tests the restrictions Usually hard to compute difficult to program the derivatives and their variances. Part 18: Maximum Likelihood 18-62/67

LM Test for a Logit Model Compute b0 (subject to restictions) (e.g., with zeros in appropriate positions. Compute Pi(b0) for each observation. Compute ei(b0) = [yi Pi(b0)] Compute gi(b0) = xiei using full xi vector LM = [yigi(b0)][yigi(b0)gi(b0)]-1[yigi(b0)] Part 18: Maximum Likelihood (There is a built in function for this computation.)

18-63/67 Part 18: Maximum Likelihood 18-64/67 Restricted Model Part 18: Maximum Likelihood 18-65/67 Part 18: Maximum Likelihood 18-66/67 Part 18: Maximum Likelihood I have a question. The question is as follows. We have a probit model. We used LM tests to test for the hetercodeaticiy in this model and found that there is heterocedasticity in this model... How do we proceed now? What do we do to get rid of heterescedasticiy? Testing for heteroscedasticity in a probit model and then getting rid of heteroscedasticit in this model is not a common procedure.

In fact I do not remember seen an applied (or theoretical also) works which tests for heteroscedasticiy and then uses a method to get rid of it??? See Econometric Analysis, 7th ed. pages 714-714 18-67/67 Part 18: Maximum Likelihood 18-68/67 Appendix Part 18: Maximum Likelihood Properties of the Maximum Likelihood Estimator We will sketch formal proofs of these results: The log-likelihood function, again The likelihood equation and the information matrix. A linear Taylor series approximation to the first order conditions: g(ML) = 0 g() + H() (ML - ) (under regularity, higher order terms will vanish in large samples.) Our usual approach. Large sample behavior of the left and right hand sides is the same. A Proof of consistency. (Property 1)

The limiting variance of n(ML - ). We are using the central limit theorem here. Leads to asymptotic normality (Property 2). We will derive the asymptotic variance of the MLE. Estimating the variance of the maximum likelihood estimator. Efficiency (we have not developed the tools to prove this.) The Cramer-Rao lower bound for efficient estimation (an asymptotic version of Gauss-Markov). Invariance. (A VERY handy result.) Coupled with the Slutsky theorem and the delta method, the invariance property makes estimation of nonlinear functions of parameters very easy. 18-69/67 Part 18: Maximum Likelihood Regularity Conditions Deriving the theory for the MLE relies on certain regularity conditions for the density. What they are

18-70/67 1. logf(.) has three continuous derivatives wrt parameters 2. Conditions needed to obtain expectations of derivatives are met. (E.g., range of the variable is not a function of the parameters.) 3. Third derivative has finite expectation. What they mean Moment conditions and convergence. We need to obtain expectations of derivatives. We need to be able to truncate Taylor series. We will use central limit theorems Part 18: Maximum Likelihood 18-71/67 The MLE

The results center on the first order conditions for the MLE log L = g MLE = 0 MLE Begin with a Taylor series approximation to the first derivatives: g MLE = 0 g + H MLE [+ terms o(1/n) that vanish] The derivative at the MLE, MLE , is exactly zero. It is close to zero at the true , to the extent that is a good estimator of . MLE Rearrange this equation and make use of the Slutsky theorem

MLE 1 H g In terms of the original log likelihood MLE 1 n n i 1 H i i 1 g i log f i () 2 log f i () where gi and H i

Part 18: Maximum Likelihood 18-72/67 MLE Consistency of the MLE H g 1 n i i 1

n i 1 i Divide both sums by the sample size. 1 1 n 1 n 1 MLE = i 1 H i i 1 g i o n n n The approximation is now exact because of the higher order term. As n , the third term vanishes. The matrices in brackets are sample

means that converge to their expectations. 1 1 1 n H E H i , a positive definite matrix. n i 1 i 1 n

g n i 1 i E g i 0, one of the regularity conditions. Therefore, collecting terms, MLE 0 or plim MLE = Part 18: Maximum Likelihood 18-73/67 Asymptotic Variance

Part 18: Maximum Likelihood 18-74/67 Asymptotic Variance Part 18: Maximum Likelihood 18-75/67 Part 18: Maximum Likelihood 18-76/67 Part 18: Maximum Likelihood 18-77/67 Asymptotic Distribution Part 18: Maximum Likelihood 18-78/67 Efficiency: Variance Bound

Part 18: Maximum Likelihood Invariance The maximum likelihood estimator of a function of , say h() is h(MLE). This is not always true of other kinds of estimators. To get the variance of this function, we would use the delta method. E.g., the MLE of =(/) is b/(ee/n) 18-79/67 Part 18: Maximum Likelihood 18-80/67 Part 18: Maximum Likelihood 18-81/67 The Linear Probability Model Prob(y = 1| x) = x E[y | x ] = 0 * Prob(y = 1| x) + 1Prob(y = 1| x) = Prob(y = 1| x ) y = x + Part 18: Maximum Likelihood

18-82/67 The Dependent Variable equals zero for 99.1% of the observations. In the sample of 163,474 observations, the LHS variable equals 1 about 1,500 times. Part 18: Maximum Likelihood 2SLS for a binary dependent variable. 18-83/67 Part 18: Maximum Likelihood 18-84/67 Modeling a Binary Outcome Did firm i produce a product or process innovation in year t ? yit : 1=Yes/0=No

Observed N=1270 firms for T=5 years, 1984-1988 Observed covariates: xit = Industry, competitive pressures, size, productivity, etc. How to model? Binary outcome Correlation across time Heterogeneity across firms Part 18: Maximum Likelihood 18-85/67 Application Part 18: Maximum Likelihood

18-86/67 Probit and LPM Part 18: Maximum Likelihood OLS approximates the partial effects, directly, without bothering with coefficients. 18-87/67 MLE Average Partial Effects OLS Coefficients Part 18: Maximum Likelihood 18-88/67 Odds Ratios This calculation is not meaningful if the model is not a binary logit model 1 Prob(y=0| x,z) =

, 1+exp(x + z) exp(x + z) Prob(y=1| x,z) = 1+exp(x + z) Prob(y=1| x,z) exp(x + z) OR( x,z) Prob(y=0| x,z) 1 exp(x + z) exp(x)exp( z) OR( x,z+1) exp(x)exp( z+ ) exp( ) OR( x,z) exp(x)exp( z) Part 18: Maximum Likelihood Odds Ratio Exp() = multiplicative change in the odds ratio when z changes by 1 unit. dOR(x,z)/dx = OR(x,z)*, not exp() The odds ratio is not a partial effect it is not a derivative. It is only meaningful when the odds ratio is itself

of interest and the change of the variable by a whole unit is meaningful. Odds ratios might be interesting for dummy variables 18-89/67 Part 18: Maximum Likelihood 18-90/67 Cautions About reported Odds Ratios Part 18: Maximum Likelihood Model for a Binary Dependent Variable Binary outcome.

18-91/67 Event occurs or doesnt (e.g., the democrat wins, the person enters the labor force, Model the probability of the event. P(x)=Prob(y=1|x) Probability responds to independent variables Requirements 0 < Probability < 1 P(x) should be monotonic in x its a CDF Part 18: Maximum Likelihood Two Standard Models Based on the normal distribution:

Based on the logistic distribution 18-92/67 Prob[y=1|x] = (xx) = CDF of normal distribution The probit model Prob[y=1|x] = exp(xx)/[1+ exp(xx)] The logit model Log likelihood P(y|x) = (1-F)(1-y) Fy where F = the cdf LogL = yi (1-yi)log(1-Fi) + yilogFi = yi F[(2yi-1)xx] since F(-t)=1-F(t) for both. Part 18: Maximum Likelihood 18-93/67 Coefficients in the Binary Choice Models

E[y|x] = 0*(1-Fi) + 1*Fi = P(y=1|x) = F(xx) The coefficients are not the slopes, as usual in a nonlinear model E[y|x]/x= f(xx) These will look similar for probit and logit Part 18: Maximum Likelihood Application: Female Labor Supply 1975 Survey Data: Mroz (Econometrica) 753 Observations Descriptive Statistics Variable Mean Std.Dev. Minimum Maximum Cases Missing ============================================================================== All observations in current sample --------+--------------------------------------------------------------------LFP | .568393 .495630 .000000 1.00000 753

0 WHRS | 740.576 871.314 .000000 4950.00 753 0 KL6 | .237716 .523959 .000000 3.00000 753 0 K618 | 1.35325 1.31987 .000000 8.00000 753 0 WA | 42.5378 8.07257 30.0000

60.0000 753 0 WE | 12.2869 2.28025 5.00000 17.0000 753 0 WW | 2.37457 3.24183 .000000 25.0000 753 0 RPWG | 1.84973 2.41989 .000000 9.98000 753 0 HHRS | 2267.27

595.567 175.000 5010.00 753 0 HA | 45.1208 8.05879 30.0000 60.0000 753 0 HE | 12.4914 3.02080 3.00000 17.0000 753 0 HW | 7.48218 4.23056 .412100 40.5090 753 0

FAMINC | 23080.6 12190.2 1500.00 96000.0 753 0 KIDS | .695883 .460338 .000000 1.00000 753 0 18-94/67 Part 18: Maximum Likelihood Estimated Choice Models for Labor Force ---------------------------------------------------------------------Participation Binomial Probit Model 18-95/67 Dependent variable LFP

Log likelihood function -488.26476 (Probit) Log likelihood function -488.17640 (Logit) --------+------------------------------------------------------------Variable| Coefficient Standard Error b/St.Er. P[|Z|>z] Mean of X --------+------------------------------------------------------------|Index function for probability Constant| .77143 .52381 1.473 .1408 WA| -.02008 .01305 -1.538 .1241 42.5378 WE| .13881*** .02710 5.122 .0000 12.2869 HHRS|

-.00019** .801461D-04 -2.359 .0183 2267.27 HA| -.00526 .01285 -.410 .6821 45.1208 HE| -.06136*** .02058 -2.982 .0029 12.4914 FAMINC| .00997** .00435 2.289 .0221 23.0806 KIDS| -.34017*** .12556

-2.709 .0067 .69588 --------+------------------------------------------------------------Binary Logit Model for Binary Choice --------+------------------------------------------------------------|Characteristics in numerator of Prob[Y = 1] Constant| 1.24556 .84987 1.466 .1428 WA| -.03289 .02134 -1.542 .1232 42.5378 WE| .22584*** .04504 5.014 .0000 12.2869 HHRS| -.00030** .00013 -2.326

.0200 2267.27 HA| -.00856 .02098 -.408 .6834 45.1208 HE| -.10096*** .03381 -2.986 .0028 12.4914 FAMINC| .01727** .00752 2.298 .0215 23.0806 KIDS| -.54990*** .20416 -2.693 .0071 .69588

--------+------------------------------------------------------------- Part 18: Maximum Likelihood 18-96/67 Partial Effects ---------------------------------------------------------------------Partial derivatives of probabilities with respect to the vector of characteristics. They are computed at the means of the Xs. Observations used are All Obs. --------+------------------------------------------------------------Variable| Coefficient Standard Error b/St.Er. P[|Z|>z] Elasticity --------+------------------------------------------------------------|PROBIT: Index function for probability WA| -.00788 .00512 -1.538 .1240 -.58479 WE| .05445*** .01062 5.127 .0000 1.16790

HHRS|-.74164D-04** .314375D-04 -2.359 .0183 -.29353 HA| -.00206 .00504 -.410 .6821 -.16263 HE| -.02407*** .00807 -2.983 .0029 -.52488 FAMINC| .00391** .00171 2.289 .0221 .15753 |Marginal effect for dummy variable is P|1 - P|0. KIDS| -.13093***

.04708 -2.781 .0054 -.15905 Variable| Coefficient Standard Error b/St.Er. P[|Z|>z] Elasticity --------+------------------------------------------------------------|LOGIT: Marginal effect for variable in probability WA| -.00804 .00521 -1.542 .1231 -.59546 WE| .05521*** .01099 5.023 .0000 1.18097 HHRS|-.74419D-04** .319831D-04 -2.327 .0200 -.29375 HA| -.00209

.00513 -.408 .6834 -.16434 HE| -.02468*** .00826 -2.988 .0028 -.53673 FAMINC| .00422** .00184 2.301 .0214 .16966 |Marginal effect for dummy variable is P|1 - P|0. KIDS| -.13120*** .04709 -2.786 .0053 -.15894 --------+------------------------------------------------------------- Part 18: Maximum Likelihood

Testing Hypotheses A Trinity of Tests The likelihood ratio test: Based on the proposition (Greenes) that restrictions always make life worse Is the reduction in the criterion (log-likelihood) large? Leads to the LR test. The Wald test: The usual. The Lagrange multiplier test: Underlying basis: Reexamine the first order conditions. Form a test of whether the gradient is significantly nonzero at the restricted estimator. 18-97/67 Part 18: Maximum Likelihood 18-98/67 Testing Hypotheses Wald tests, using the familiar distance measure Likelihood ratio tests: LogLU = log likelihood without restrictions LogLR = log likelihood with restrictions LogLU > logLR for any nested restrictions

2(LogLU logLR) chi-squared [J] Part 18: Maximum Likelihood 18-99/67 Estimating the Tobit Model Log likelihood for the tobit model for estimation of and : 1 yi xi n xi logL= i=1 (1-di ) log d log i

di 1 if yi 0, 0 if yi = 0. Derivatives are very complicated, Hessian is nightmarish. Consider the Olsen transformation*: =1/ , =-/ . (One to one; =1 / , =E[d] under certain ass - / n logL= i=1 log (1-di ) log xi di log yi xi (1-d ) log x d (log (1 / 2) log2 (1 / 2) y x 2) log i i i i i i=1 xi logL n i1 (1-di ) de i i xi xi

logL n 1 i1 di eiyi n *Note on the Uniqueness of the MLE in the Tobit Model," Econometrica, 1978. Part 18: Maximum Likelihood

Recently Viewed Presentations

  • Games_List - Troop 19

    Games_List - Troop 19

    Patrols must start over if either chariot falls apart or rider touches ground Resource requirements: Lots of space for lashing Equipment per patrol: six, 6-foot lashing poles, nine, 6-foot lengths of lashing rope # Players: two or more patrols Note:...
  • Disability definitions

    Disability definitions

    Definitions from disability programmes in other countries Social Security Advisory Board Washington DC 14 April 2004 Marilyn Howard What this presentation covers The context Purposes of definitions Social security definitions of disability Administration and assessment The British experience Some possible...
  • Basic Education Curriculum Framework - KCPE-KCSE

    Basic Education Curriculum Framework - KCPE-KCSE

    The basic education curriculum framework vision and mission are supported by three important pillars:- ... the primary focus of which is on supporting students through scaffolding the learning experiences. ... Bruner's cognitive development theory, which emphasises the importance of organizing...
  • Languaged lives: a new perspective on TESOL teacher identity

    Languaged lives: a new perspective on TESOL teacher identity

    In these languages I attained levels from very basic beginner to intermediate - but lack of use as we know leads to attrition. However applying the lenses of 'plurilingualism' and 'languaged lives' means that these partial learnings take on a...
  • Chapter 5 Paleoclimate Archives

    Chapter 5 Paleoclimate Archives

    Heinrich Events/ Younger Dryas. Cold events lasting ~ 1000 years. Large chunks of ice break off continental ice sheet. Carry "ice rafted debris" - high proportions of continental rocks. Related to DO events, or at least constrain timing.
  • The Fundamentals of Political Science Research

    The Fundamentals of Political Science Research

    This is statistical inference. Statistical inference is the process of making probabilistic statements about a population characteristic based on our knowledge of the sample characteristic.. In other words, there are things we know about with certainty—like the mean of some...
  • Build your own discovery

    Build your own discovery

    It is important to our clients that all Kensington Palace staff look at them directly, speak to them as individuals (not just as another group) and are welcoming. In my experience this is the case and is very much appreciated.'...
  • Mark Carver State Program Director Agenda 1. S

    Mark Carver State Program Director Agenda 1. S

    Forms/Public Relations. Steve Hart Retreat. Vicen. Alverez Silver Rose. Bill McCrossen Disaster Relief. ... Marian Icon Prayer Program. Domestic Church Kiosk & Catholic Info Series. Rosary Program. Holy Hour Sacramental Gifts . Spiritual Day of Reflection.