ECON 626: Applied Microeconomics. Lecture 11: Maximum Likelihood

Similar documents
2. We care about proportion for categorical variable, but average for numerical one.

Lecture 12: Application of Maximum Likelihood Estimation:Truncation, Censoring, and Corner Solutions

ECON4515 Finance theory 1 Diderik Lund, 5 May Perold: The CAPM

Lecture 11/12. Roy Model, MTE, Structural Estimation

Applied Econometrics (MSc.) Lecture 3 Instrumental Variables

Econ 110: Introduction to Economic Theory. 8th Class 2/7/11

Tobit and Selection Models

Recent Advances in the Field of Trade Theory and Policy Analysis Using Micro-Level Data

ECON 594: Lecture #6

Notes on Heterogeneity, Aggregation, and Market Wage Functions: An Empirical Model of Self-Selection in the Labor Market

ECON FINANCIAL ECONOMICS

Motivation Non-linear Rational Expectations The Permanent Income Hypothesis The Log of Gravity Non-linear IV Estimation Summary.

ECON4510 Finance Theory Lecture 2

CENSORED DATA AND CENSORED NORMAL REGRESSION

LECTURE 10: NEYMAN-PEARSON LEMMA AND ASYMPTOTIC TESTING. The last equality is provided so this can look like a more familiar parametric test.

ECO 317 Economics of Uncertainty Fall Term 2009 Slides to accompany 13. Markets and Efficient Risk-Bearing: Examples and Extensions

ECO 310: Empirical Industrial Organization Lecture 2 - Estimation of Demand and Supply

Lecture 22 Survival Analysis: An Introduction

Obtaining Critical Values for Test of Markov. Regime Switching

Max. Likelihood Estimation. Outline. Econometrics II. Ricardo Mora. Notes. Notes

Treatment Effects with Normal Disturbances in sampleselection Package

Notes on Recursive Utility. Consider the setting of consumption in infinite time under uncertainty as in

Econometrics II Censoring & Truncation. May 5, 2011

WELFARE: THE SOCIAL- WELFARE FUNCTION

Choice under Uncertainty

ECON 4160: Econometrics-Modelling and Systems Estimation Lecture 9: Multiple equation models II

Dealing With and Understanding Endogeneity

Microeconomic Theory III Spring 2009

Lecture: Simultaneous Equation Model (Wooldridge s Book Chapter 16)

Microeconomic Theory (501b) Problem Set 10. Auctions and Moral Hazard Suggested Solution: Tibor Heumann

Ordered Response and Multinomial Logit Estimation

AGEC 661 Note Fourteen

Double-Hurdle Models with Dependent Errors and Heteroscedasticity

Gibbs Sampling in Latent Variable Models #1

Advanced Macroeconomics

Lecture 15. Dynamic Stochastic General Equilibrium Model. Randall Romero Aguilar, PhD I Semestre 2017 Last updated: July 3, 2017

E 600 Chapter 4: Optimization

MLE and GMM. Li Zhao, SJTU. Spring, Li Zhao MLE and GMM 1 / 22

Session IV Instrumental Variables

Using regression to study economic relationships is called econometrics. econo = of or pertaining to the economy. metrics = measurement

Econ 2148, spring 2019 Statistical decision theory

Are Probabilities Used in Markets? 1

Dynamic Optimization: An Introduction

ECON4510 Finance Theory Lecture 1

Choice with Menu-Dependent Rankings (Presentation Slides)

Structural Properties of Utility Functions Walrasian Demand

CSC321 Lecture 18: Learning Probabilistic Models

INTRODUCTION TO TRANSPORTATION SYSTEMS

Econ 2140, spring 2018, Part IIa Statistical Decision Theory

Econ 423 Lecture Notes: Additional Topics in Time Series 1

Lecture 2. (1) Aggregation (2) Permanent Income Hypothesis. Erick Sager. September 14, 2015

1. Basic Model of Labor Supply

The New Keynesian Model: Introduction

Estimating Single-Agent Dynamic Models

Fundamentals in Optimal Investments. Lecture I

The Fundamental Welfare Theorems

Suggested solutions to the 6 th seminar, ECON4260

Problem Set 4 - Solution Hints

Econometric Methods and Applications II Chapter 2: Simultaneous equations. Econometric Methods and Applications II, Chapter 2, Slide 1

Generalized linear models

Estimating Single-Agent Dynamic Models

Other-Regarding Preferences: Theory and Evidence

Econometrics in a nutshell: Variation and Identification Linear Regression Model in STATA. Research Methods. Carlos Noton.

Problem set - Selection and Diff-in-Diff

Lecture 14 More on structural estimation

Generalized Linear Models

Midterm Exam 2. October 27, Time: 1 hour, 30 minutes. San Francisco State University ECON 715 Fall Name:

In the Ramsey model we maximized the utility U = u[c(t)]e nt e t dt. Now

Recitation 7: Uncertainty. Xincheng Qiu

Cointegration and Error-Correction

Generalized Linear Models for Count, Skewed, and If and How Much Outcomes

ECON5115. Solution Proposal for Problem Set 4. Vibeke Øi and Stefan Flügel

CCP Estimation. Robert A. Miller. March Dynamic Discrete Choice. Miller (Dynamic Discrete Choice) cemmap 6 March / 27

VALUATION USING HOUSEHOLD PRODUCTION LECTURE PLAN 15: APRIL 14, 2011 Hunt Allcott

Greene, Econometric Analysis (6th ed, 2008)

Aggregate Supply. Econ 208. April 3, Lecture 16. Econ 208 (Lecture 16) Aggregate Supply April 3, / 12

Empirical Application of Simple Regression (Chapter 2)

Generalized Linear Models for Non-Normal Data

Job Training Partnership Act (JTPA)

SYSM 6303: Quantitative Introduction to Risk and Uncertainty in Business Lecture 4: Fitting Data to Distributions

Truncation and Censoring

Probit Estimation in gretl

Advanced Microeconomic Analysis Solutions to Homework #2

Endogenous Growth: AK Model

Maximum Likelihood Estimation

stcrmix and Timing of Events with Stata

x ax 1 2 bx2 a bx =0 x = a b. Hence, a consumer s willingness-to-pay as a function of liters on sale, 1 2 a 2 2b, if l> a. (1)

Mathematical Statistics

Consumer theory Topics in consumer theory. Microeconomics. Joana Pais. Fall Joana Pais

Lecture 2: Firms, Jobs and Policy

UC Berkeley Department of Economics Foundations of Psychology and Economics (219A) Module I: Choice under Uncertainty

G5212: Game Theory. Mark Dean. Spring 2017

Syllabus. By Joan Llull. Microeconometrics. IDEA PhD Program. Fall Chapter 1: Introduction and a Brief Review of Relevant Tools

Financial Econometrics

The full RBC model. Empirical evaluation

Y t = log (employment t )

Dynamic Discrete Choice Structural Models in Empirical IO

Extended regression models using Stata 15

-redprob- A Stata program for the Heckman estimator of the random effects dynamic probit model

Instrumental Variables

Transcription:

ECON 626: Applied Microeconomics Lecture 11: Maximum Likelihood Professors: Pamela Jakiela and Owen Ozier Department of Economics University of Maryland, College Park

Maximum Likelihood: Motivation So far, we ve been thinking about average treatment effects, but the ATE may or may not be the main quantity of interest research-wise Imperfect compliance LATE/TOT estimates Outcomes may be censored (as in a tobit model) OLS estimates of the treatment effect are inconsistent Treatments may impact specific parameters in a structural or theoretical model; may want to know how much parameters change Theory can provide a framework for estimating treatment effects ML approaches can help to translate treatment effects into economics ECON 626: Applied Microeconomics Lecture 11: Maximum Likelihood, Slide 2

Maximum Likelihood: Overview In ML estimation, the data-generating process is the theoretical model First key decision: what is your theoretical model? Examples: utility function, production function, hazard model Second key decision: continuous vs. discrete outcome variable Censoring, extensions lead to intermediate cases Third key decision: structure of the error term Today: additive, normally-distributed error ECON 626: Applied Microeconomics Lecture 11: Maximum Likelihood, Slide 3

OLS in a Maximum Likelihood Framework Consider a linear model: y i = X i β + ε i where ε i X i N (0, 2 ) y i N (X i β, 2 ) The normal error term characterizes the distribution of y: where θ = (β, ) f (y X ; θ) = 1 2π e = 1 ( y X ) φ β = L(θ) [ ( y X ) ] β 2/2 ECON 626: Applied Microeconomics Lecture 11: Maximum Likelihood, Slide 4

OLS in a Maximum Likelihood Framework Knowing f (y X ; θ), we can write down the log-likelihood function for θ: l (θ) = i = i ln [f (y i X i ; θ)] [ ( 1 ln φ yi X i β )] ECON 626: Applied Microeconomics Lecture 11: Maximum Likelihood, Slide 5

ML Estimation in Stata Estimating ˆβ in Stata: capture program drop myols program myols args lnf beta sigma quietly replace lnf =log((1/ sigma )*normalden(($ml_y1- beta )/ sigma )) end ml model lf myols (beta: y = x) /sigma ml maximize where $ML y1 is the dependent variable By default, Stata imposes a linear structure on independent variable ECON 626: Applied Microeconomics Lecture 11: Maximum Likelihood, Slide 6

Tobit Estimation Suppose we only observe yi if yi > 0 { 0 if yi > 0 C i = 1 if yi 0 So, we observe: (X i, y i (1 C i ), C i ) for each observations i ECON 626: Applied Microeconomics Lecture 11: Maximum Likelihood, Slide 7

Tobit Estimation Suppose we only observe yi if yi > 0 { 0 if yi > 0 C i = 1 if yi 0 So, we observe: (X i, y i With censoring of y i (1 C i ), C i ) for each observations i at 0, the likelihood function takes the form: L i (θ) = [f (yi X i ; θ)] 1 C i [Pr (yi 0 X i ; θ)] C i ECON 626: Applied Microeconomics Lecture 11: Maximum Likelihood, Slide 7

Tobit Estimation Since ε i = yi X i β, we know that: Pr (y i 0 X i ; θ) = Pr (ε i < X i β) = Φ ( X i β ) ( ) X = 1 Φ i β ECON 626: Applied Microeconomics Lecture 11: Maximum Likelihood, Slide 8

Tobit Estimation Since ε i = yi X i β, we know that: We can re-write the likelihood as: [ ( 1 y X L i (θ) = φ β Pr (y i 0 X i ; θ) = Pr (ε i < X i β) = Φ ( X i β ) ( ) X = 1 Φ i β )] 1 Ci [ ( X 1 Φ i β )] Ci ECON 626: Applied Microeconomics Lecture 11: Maximum Likelihood, Slide 8

Tobit ML Estimation in Stata Modifying the Stata likelihood function to adjust for censoring: capture program drop mytobit program mytobit args lnf beta sigma quietly replace lnf =log((1/ sigma )*normalden(($ml_y1- beta )/ sigma )) quietly replace lnf = log(1-normal( beta / sigma )) if $ML_y1==0 end ml model lf myols (beta: ystar = x) /sigma ml maximize ECON 626: Applied Microeconomics Lecture 11: Maximum Likelihood, Slide 9

Tobit ML Estimation in Matlab ECON 626: Applied Microeconomics Lecture 11: Maximum Likelihood, Slide 10

Tobit ML Estimation in Matlab Shell program calls the likelihood function using fminunc command:... clear all, read in data, declare globals, define variables beta=[0.01]; beta_cons=[0.01]; sigma=[0.5]; param=[beta_x;beta_cons;sigma]; MAXITERS=[]; % Maximum number of iterations. PARAMTOL=[]; % Convergence criterion based on the change in parameters. LLTOL=[]; % Convergence criterion based on change in the log-likelihood. disp( Starting estimation ); tic; %Starts the timer options=optimset( LargeScale, off, Display, iter, GradObj, off,... MaxFunEvals,10000, MaxIter,MAXITERS, TolX,PARAMTOL, TolFun,LLTOL, Deriv [paramhat,fval,exitflag,output,grad,hessian]=fminunc(@ll_tobit,param,options); ihess=inv(hessian); stderr=sqrt(diag(ihess)); ECON 626: Applied Microeconomics Lecture 11: Maximum Likelihood, Slide 10

Tobit ML Estimation in Matlab Likelihood function calculates the log likelihood: function [ll]=ll_tobit(param) global ystar x obs cens beta=param(1:2,1); sigma=param(3,1); A = vars*beta; dens=(normpdf((ystar-a)/sigma))/sigma; dist=1-normcdf(a/sigma); like=(1-cens).*dens+cens.*dist; like=max(like,0.00000001); ll=-sum(log(like),1); ECON 626: Applied Microeconomics Lecture 11: Maximum Likelihood, Slide 11

Why Use Maximum Likelihood? Many economic applications start from a non-linear model of an individual decision rule some other underlying structural process Impacts on preferences (e.g. risk, time) Duration of unemployment spells CES production, utility functions Maximum likelihood in Stata vs. Matlab: Stata is fast and (relatively) easy, if it converges No restrictions on the functional form of the likelihood in Matlab Broader range of optimization options in Matlab ECON 626: Applied Microeconomics Lecture 11: Maximum Likelihood, Slide 12

Maximum Likelihood Estimation Let y i be the observed decision in choice situation i for i = 1,..., I y i = g (x i ; θ) + ε i where x i denotes the exogenous parameters of the situation (e.g. price), θ denotes the preference/structural parameters, and ε i N (0, s ) Space of outcomes/choices is continuous (i.e. not discrete) g (x; θ) + ε j is the structural model (e.g. demand function) Often derived by solving for utility-maximizing choice ECON 626: Applied Microeconomics Lecture 11: Maximum Likelihood, Slide 13

Maximum Likelihood Estimation Let y i be the observed decision in choice situation i for i = 1,..., I y i = g (x i ; θ) + ε i where x i denotes the exogenous parameters of the situation (e.g. price), θ denotes the preference/structural parameters, and ε i N (0, s ) Space of outcomes/choices is continuous (i.e. not discrete) g (x; θ) + ε j is the structural model (e.g. demand function) Often derived by solving for utility-maximizing choice Because ε i N (0, s ), we know that y i g (x i ; θ) }{{} ε i N (0, 2 ) y i N (g (x i ; θ), 2 ) ECON 626: Applied Microeconomics Lecture 11: Maximum Likelihood, Slide 13

Maximum Likelihood Estimation: CRRA Example Assume utility over income takes the constant relative risk aversion (CRRA) form given risk aversion parameter ρ > 0: u(x) = x 1 ρ 1 ρ ECON 626: Applied Microeconomics Lecture 11: Maximum Likelihood, Slide 14

Maximum Likelihood Estimation: CRRA Example Assume utility over income takes the constant relative risk aversion (CRRA) form given risk aversion parameter ρ > 0: u(x) = x 1 ρ 1 ρ Agent chooses an amount, z [0, b], to invest in a risky security that yields payoff of 0 with probability 1 2 and payoff of λz with probability 1 2 1 max z [0,b] [(b z) 1 ρ + (b + λz) 1 ρ] 2(1 ρ) The optimal interior allocation to the risky security is given by ( λ z 1/ρ ) 1 (b, λ) = b λ 1/ρ + λ ECON 626: Applied Microeconomics Lecture 11: Maximum Likelihood, Slide 14

Maximum Likelihood Estimation: CRRA Example People implement their choices with error: z i = z (b, λ) + ε i where ε i b, λ N (0, s ) The normal error term characterizes the distribution of y: where θ = (ρ, ) [( f (z i b, λ; θ) = 1 y z 2π i e (b,λ) = 1 ( ) y z φ i (b, λ) ) 2 /2] ECON 626: Applied Microeconomics Lecture 11: Maximum Likelihood, Slide 15

Maximum Likelihood Estimation: CRRA Example We only observe z i if z i < b C i = { 0 if z i < b 1 if z i b ECON 626: Applied Microeconomics Lecture 11: Maximum Likelihood, Slide 16

Maximum Likelihood Estimation: CRRA Example We only observe z i if z i < b C i = { 0 if z i < b 1 if z i b With censoring, the likelihood function takes the form: L i (θ) = [f (z i b, λ; θ)] 1 C i [Pr (z i b; θ)] C i ECON 626: Applied Microeconomics Lecture 11: Maximum Likelihood, Slide 16

Maximum Likelihood Estimation: CRRA Example We only observe z i if z i < b C i = { 0 if z i < b 1 if z i b With censoring, the likelihood function takes the form: L i (θ) = [f (z i b, λ; θ)] 1 C i [Pr (z i b; θ)] C i Log likelihood takes the form: l i (θ) = (1 C i ) ln [f (z i b, λ; θ)] + C i ln [Pr (z i b θ)] ECON 626: Applied Microeconomics Lecture 11: Maximum Likelihood, Slide 16

Maximum Likelihood Estimation: CRRA Example Because we know that ε i b, λ N (0, s ), we can calculate: Pr (z i b θ) = Pr (zi (b, λ) + ε i b θ) = 1 Pr (ε i b zi (b, λ) θ) ( ) b z = 1 Φ i (b, λ) ECON 626: Applied Microeconomics Lecture 11: Maximum Likelihood, Slide 17

Maximum Likelihood Estimation: CRRA Example Because we know that ε i b, λ N (0, s ), we can calculate: Pr (z i b θ) = Pr (z i (b, λ) + ε i b θ) = 1 Pr (ε i b z i (b, λ) θ) ( ) b z = 1 Φ i (b, λ) We can re-write the log likelihood as: [ ( )] [ ( )] 1 y z l i (θ) = (1 C i ) ln φ i (b, λ) b z +C i ln 1 Φ i (b, λ) ECON 626: Applied Microeconomics Lecture 11: Maximum Likelihood, Slide 17

Maximum Likelihood Estimation: CRRA Example Stata program for ML estimation in a non-linear framework: capture program drop mymodel program mymodel args lnf rho sigma tempvar ratio res quietly gen double ratio = $ML_y2*(($ML_y3^(1/ rho ) - 1)/($ML_y3^(1/ rho ) + quietly gen double res = $ML_y1 - ratio quietly replace lnf = ln((1/ sigma )*normalden(( res )/ sigma )) quietly replace lnf = ln(1-normal(($ml_y2- ratio )/ sigma )) if $ML_y4==1 end ml model lf mymodel (rho: investment budget return censor = ) (sigma: ) ml maximize ECON 626: Applied Microeconomics Lecture 11: Maximum Likelihood, Slide 18