empirical methods for microeconomic applications

56
Empirical Methods for Microeconomic Applications William Greene Department of Economics Stern School of Business

Upload: powa

Post on 23-Feb-2016

48 views

Category:

Documents


0 download

DESCRIPTION

Empirical Methods for Microeconomic Applications. William Greene Department of Economics Stern School of Business. Lab 2. Binary Choice. Upload Your Project File. Model Commands. Generic form: - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Empirical Methods for  Microeconomic Applications

Empirical Methods for Microeconomic Applications

William GreeneDepartment of EconomicsStern School of Business

Page 2: Empirical Methods for  Microeconomic Applications

Lab 2. Binary Choice

Page 3: Empirical Methods for  Microeconomic Applications

Upload Your Project File

Page 4: Empirical Methods for  Microeconomic Applications

Model Commands Generic form:

Model name ; Lhs = dependent variable ; Rhs = independent variables $

Almost all models require ;Lhs and ;Rhs. Rhs should generally include ONE to request a

constant term. Models have different other required specifications Many optional specifications.

Page 5: Empirical Methods for  Microeconomic Applications

Probit Model Command

Text Editor

Load healthcare.lpj Command Builder

Page 6: Empirical Methods for  Microeconomic Applications

Command Builder

Go button in command builder

Page 7: Empirical Methods for  Microeconomic Applications
Page 8: Empirical Methods for  Microeconomic Applications
Page 9: Empirical Methods for  Microeconomic Applications
Page 10: Empirical Methods for  Microeconomic Applications

Partial Effects for Interactions2

1 2 3 4

1 3 4

2 4

Prob[ 1| ] [ ] [ ]Partial Effects?

[ ]( 2 )

[ ]( )

Compute without extensive additional computation ofe

y x x z x xzA

P A x zxP A xz

xtra variables, etc.

Page 11: Empirical Methods for  Microeconomic Applications

Partial Effects• Build the interactions into the model

statement PROBIT ; Lhs = Doctor

; Rhs = one,age,educ,age^2,age*educ $

• Built in computation for partial effects PARTIALS ; Effects:

Age & Educ = 8(2)20 ; Plot(ci) $

Page 12: Empirical Methods for  Microeconomic Applications

Average Partial Effects---------------------------------------------------------------------Partial Effects Analysis for Probit Probability Function---------------------------------------------------------------------Partial effects on function with respect to AGEPartial effects are computed by average over sample observationsPartial effects for continuous variable by differentiationPartial effect is computed as derivative = df(.)/dx---------------------------------------------------------------------df/dAGE Partial Standard(Delta method) Effect Error |t| 95% Confidence Interval---------------------------------------------------------------------Partial effect .00441 .00059 7.47 .00325 .00557EDUC = 8.00 .00485 .00101 4.80 .00287 .00683EDUC = 10.00 .00463 .00068 6.80 .00329 .00596EDUC = 12.00 .00439 .00061 7.18 .00319 .00558EDUC = 14.00 .00412 .00091 4.53 .00234 .00591EDUC = 16.00 .00384 .00138 2.78 .00113 .00655EDUC = 18.00 .00354 .00192 1.84 -.00023 .00731EDUC = 20.00 .00322 .00250 1.29 -.00168 .00813

Page 13: Empirical Methods for  Microeconomic Applications

Useful Plot

Page 14: Empirical Methods for  Microeconomic Applications

More Elaborate Partial Effects

• PROBIT ; Lhs = Doctor ; Rhs = one,age,educ,age^2,age*educ, female,female*educ,income $

• PARTIAL ; Effects: income @ female = 0,1 ? Do for each subsample | educ = 12,16,20 ? Set 3 fixed values & age = 20(10)50 ? APE for each setting

Page 15: Empirical Methods for  Microeconomic Applications

Constructed Partial Effects

Page 16: Empirical Methods for  Microeconomic Applications

Predictions List and keep predictions Add ; List ; Prob = PFIT to the probit or logit command (Tip: Do not use ;LIST with large samples!)

Sample ; 1-100 $PROBIT ; Lhs=doctor ; Rhs=… ; List ; Prob=Pfit $DSTAT ; Rhs = Doctor,PFIT $

Page 17: Empirical Methods for  Microeconomic Applications

Testing Restrictions

Page 18: Empirical Methods for  Microeconomic Applications
Page 19: Empirical Methods for  Microeconomic Applications
Page 20: Empirical Methods for  Microeconomic Applications
Page 21: Empirical Methods for  Microeconomic Applications

Testing a Hypothesis – LM Test

PROBIT ; LHS = doctor ; RHS = one,age,educ $PROBIT ; LHS = doctor ; RHS = one,age,educ,female,married ; Start = b,0,0 ; MAXIT = 0 $

ˆ ˆ

ˆ

ˆ

0 0 -1 0

0

0

LM = ( ) [Est.Hessian ] ( )

=MLE with restrictions imposed

Hessian is computed at .

Lagrange Multiplier Test

g β g β

β

β

Page 22: Empirical Methods for  Microeconomic Applications

Results of an LM test

Page 23: Empirical Methods for  Microeconomic Applications

Note: LM equaled 485.27.

Wald Test

Page 24: Empirical Methods for  Microeconomic Applications

Wald Test Using Matrix Algebra

Note: LM equaled 485.27.

Page 25: Empirical Methods for  Microeconomic Applications

Likelihood Ratio Test

LR = 2[LogL(unrestricted) -Logl(restricted)]

Note: LM equaled 485.27. Wald equaled 484.55

Page 26: Empirical Methods for  Microeconomic Applications

Using Matrix AlgebraNamelists with the current sample serve 2 major functions:

(1) Define lists of variables for model estimation (2) Define the columns of matrices built from the data.

NAMELIST ; X = a list ; Z = a list … $

Set the sample any way you like. Observations are now the rows of all matrices. When the sample changes, the matrices change.

Lists may be anything, may contain ONE, may overlap (some or all variables) and may contain the same variable(s) more than once

Page 27: Empirical Methods for  Microeconomic Applications

Matrix FunctionsMatrix Product: MATRIX ; XZ = X’Z $Moments and Inverse MATRIX ; XPX = X’X

; InvXPX = <X’X> $Moments with individual specific weights in variable w. Σi wi xixi’ = X’[w]X. [Σi wi xixi’ ]-1 = <X’[w]X>Unweighted Sum of Rows in a Matrix Σi xi = 1’XColumn of Sample Means (1/n) Σi xi = 1/n * X’1 or MEAN(X) (Matrix function. There are over 100 others.)Weighted Sum of rows in matrix Σi wi xi = 1’[w]X

Page 28: Empirical Methods for  Microeconomic Applications

LM Test for Normality in Probit

i i

i i i i

i i i3 i42

i3 i i4 i

Testing for normality in the probit model: RHS variables. y = LHS variable

Prob[y 1| ] ( ), Normal CDF. ( ) density[ ,z ,z ],

z -(1/3)[( ) 1], z (1/4){( )[3

xx βx βx

z xβx βx

2i

ii i i i

i i

1n n n 2i i i i i i i ii=1 i=1 i=1

( ) ]}( ) e y ( ), d

( )[1 ( )]Lagrange Multiplier Statistic. ̂= compute at MLE of

ˆ ˆ ˆˆ ˆˆ ˆ ˆ LM= (ed) d (ed)

βxβxx

βx βxβ

z ' z zThanks to Joachim Wilde, Univ. Halle, Germany for suggesting this.

Page 29: Empirical Methods for  Microeconomic Applications

Normality Test for ProbitNAMELIST ; XI = One,... $CREATE ; yi = the dependent variable $PROBIT ; Lhs = yi ; Rhs = Xi ; Prob = Pfi $CREATE ; bxi = b'Xi ; fi = N01(bxi) $CREATE ; zi3 = -1/2*(bxi^2 - 1) ; zi4 = 1/4*(bxi*(bxi^2+3)) $NAMELIST ; Zi = Xi,zi3,zi4 $CREATE ; di = fi/sqr(pfi*(1-pfi)) ; ei = yi - pfi

; eidi = ei*di ; di2 = di*di $MATRIX ; List ; LM = 1'[eidi]Zi * <ZI'[di2]Zi> * Zi'[eidi]1 $

Page 30: Empirical Methods for  Microeconomic Applications
Page 31: Empirical Methods for  Microeconomic Applications

Endogenous Variable in Probit ModelPROBIT ; Lhs = y1, y2 ; Rh1 = rhs for the probit model,y2 ; Rh2 = exogenous variables for y2 $

SAMPLE ; All $CREATE ; GoodHlth = Hsat > 5 $PROBIT ; Lhs = GoodHlth,Hhninc ; Rh1 = One,Female,Hhninc ; Rh2 = One,Age,Educ $

Page 32: Empirical Methods for  Microeconomic Applications

Binary Choice Models with Panel Data

Page 33: Empirical Methods for  Microeconomic Applications

Global Setting for Panels

SETPANEL ; Group = the name of the ID variable ; PDS = the name of the groupsize variable to create $

Subsequent model commands state ;PANEL with no other specifications requred to set the panel.Some other specifications usually required for thespecific model – e.g., fixed vs. random effects.

Page 34: Empirical Methods for  Microeconomic Applications
Page 35: Empirical Methods for  Microeconomic Applications

Panel Data

Page 36: Empirical Methods for  Microeconomic Applications
Page 37: Empirical Methods for  Microeconomic Applications

Unbalanced Panel Data Set

Examine Distribution of Group Sizes

Sample ; all$Setpanel ; Group = id ; Pds = ti $

Create ; t = ndx(id,1) $Histogram ; if[t=1] ; rhs = ti $

Page 38: Empirical Methods for  Microeconomic Applications

Group Sizes

Page 39: Empirical Methods for  Microeconomic Applications

Cluster CorrectionPROBIT ; Lhs = doctor ; Rhs = one,age,female,educ,married,working ; Cluster = ID $

Page 40: Empirical Methods for  Microeconomic Applications

Fixed Effects Models

? Fixed Effects Probit. ? Looks like an incidental parameters problem.Namelist ; X = age,educ,married $Probit ; Lhs = doctor; Rhs = X,one ; FEM ; Marginal ; Panel $Probit ; Lhs = doctor ; Rhs = X,one ; Marginal $

Page 41: Empirical Methods for  Microeconomic Applications
Page 42: Empirical Methods for  Microeconomic Applications

Computed Fixed Effects Parameters

Page 43: Empirical Methods for  Microeconomic Applications

Logit Fixed Effects Models Conditional and Unconditional FE

? Logit, conditional vs. unconditionalLogit ; Lhs = doctor ; Rhs = X ; Panel $ (Conditional)Logit ; Lhs = doctor ; Rhs = X ; Panel ; Fixed $

Page 44: Empirical Methods for  Microeconomic Applications
Page 45: Empirical Methods for  Microeconomic Applications

A Hausman Test for Fixed Effects

Page 46: Empirical Methods for  Microeconomic Applications
Page 47: Empirical Methods for  Microeconomic Applications

Random Effects and Random Constant

Page 48: Empirical Methods for  Microeconomic Applications
Page 49: Empirical Methods for  Microeconomic Applications
Page 50: Empirical Methods for  Microeconomic Applications
Page 51: Empirical Methods for  Microeconomic Applications

Bivariate Probit ModelTwo equation modelGeneral usage of

• LHS = the set of dependent variables• RH1 = one set of independent variables• RH2 = a second set of variables

Economical use of namelists is useful here

Namelist ; x1=one,age,female,educ,married,working $Namelist ; x2=one,age,female,hhninc,hhkids $BivariateProbit ;lhs=doctor,hospital

;rh1=x1 ;rh2=x2;marginal effects $

Page 52: Empirical Methods for  Microeconomic Applications
Page 53: Empirical Methods for  Microeconomic Applications
Page 54: Empirical Methods for  Microeconomic Applications

BivariateProbit ; lhs=doctor,hospital ; rh1=one,age,female,educ,married,working ; rh2=one,age,female,hhninc,hhkids ; rst = beta1,beta2,beta3,be,bm,bw, beta1,beta2,beta3,bi,bk, 0.4 $

--------+-------------------------------------------------------------Variable| Coefficient Standard Error b/St.Er. P[|Z|>z] Mean of X--------+------------------------------------------------------------- |Index equation for DOCTORConstant| -1.69181*** .08938 -18.928 .0000 AGE| .01244*** .00167 7.440 .0000 44.3352 FEMALE| .38543*** .03157 12.209 .0000 .42277 EDUC| .08144*** .00457 17.834 .0000 10.9409 MARRIED| .42021*** .03987 10.541 .0000 .84539 WORKING| .03310 .03910 .847 .3972 .73941 |Index equation for HOSPITALConstant| -1.69181*** .08938 -18.928 .0000 AGE| .01244*** .00167 7.440 .0000 44.3352 FEMALE| .38543*** .03157 12.209 .0000 .42277 HHNINC| -.98617*** .08917 -11.060 .0000 .34930 HHKIDS| -.09406** .04600 -2.045 .0409 .45482 |Disturbance correlationRHO(1,2)| .40000 ......(Fixed Parameter)......--------+-------------------------------------------------------------

Page 55: Empirical Methods for  Microeconomic Applications

Endogenous Variable in Probit Model“Instrumental Variable Probit”FIML Estimator

PROBIT ; Lhs = y1, y2 ; Rh1 = rhs for the probit model,y2 ; Rh2 = exogenous variables for y2 $

Page 56: Empirical Methods for  Microeconomic Applications

PROBIT ; Lhs = healthy,income ; Rh1 = one,age,educ,female,income ; Rh2 = one,age,educ,married $