 Download Download Presentation Topics in Microeconometrics University of Queensland Brisbane, QLD July 7-9, 2010

Topics in Microeconometrics University of Queensland Brisbane, QLD July 7-9, 2010

Télécharger la présentation Topics in Microeconometrics University of Queensland Brisbane, QLD July 7-9, 2010

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

1. William Greene Department of Economics Stern School of Business Topics in MicroeconometricsUniversity of QueenslandBrisbane, QLDJuly 7-9, 2010

2. Lab 2-1Binary andOrdered Choice Models

3. Data Set Data for this session are healthcare.lpj This is an unbalanced panel. The group counter is already in the data set. Use ;PDS=_Groupti for panel models

5. Binary Dependent Variables DOCTOR = visited the doctor at least once HOSPITAL = went to the hospital at least once. PUBLIC = has public health insurance (1=YES) ADDON = additional health insurance.(1=Yes) ADDON is extremely unbalanced.

6. Probit Model Estimation Probit ; Lhs = doctor ; Rhs = one,age,educ,hhninc, female,public,addon \$ Features added as additional specifications; Marginal effects

7. Command Builder Dialog

8. Model Command

9. Fit Basic Models

10. Partial Effects

11. 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 \$

12. Predictions

13. Testing a Hypothesis – Wald TestH0: Insurance does not matter SAMPLE ; All \$ PROBIT; Lhs=doctor ; Rhs=one,age,educ,hhninc, female,public,addon\$ MATRIX ; b1 = b(6:7) ; v1 = Varb(6:7,6:7) \$ MATRIX ; List ; Waldstat = b1'<V1>b1 \$ CALC ; List ; CStar = CTb(.95,3) \$

14. Wald Test

15. Likelihood Ratio Test SAMPLE ; All \$ PROBIT; Lhs=doctor ; Rhs=one,age,educ,hhninc, female,public,addon\$ CALC ; LU = LogL \$ PROBIT; Lhs=doctor ; Rhs=one,age,educ,hhninc, female\$ CALC ; LR = LogL \$ CALC ; List ; LRStat = 2*(LU - LR) \$ Result is 40.430275.Wald was 40.21889

16. Using the Binary Choice Simulator Fit the model with MODEL ; Lhs = … ; Rhs = … Simulate the model with BINARY CHOICE ; <same LHS and RHS > ; Start = B (coefficients) ; Model = the kind of model (Probit or Logit) ; Scenario: variable <operation> = value / (may repeat) ; Plot: Variable ( range of variation is optional) ; Limit = P* (is optional, 0.5 is the default) \$ E.g.: Probit ; Lhs = doctor ; Rhs = One,age,educ,hhninc \$ BinaryChoice ; Lhs = doctor ; Rhs = One,age,educ,hhninc ; Model = Probit ; Start = B ; Scenario: age + = 5 ; Plot: hhninc \$

17. Estimated Model for DOCTOR --------+--------------------------------------------------------- | Standard Prob. Mean DOCTOR| Coefficient Error z z>|Z| of X --------+--------------------------------------------------------- |Index function for probability Constant| .02159 .05307 .41 .6842 AGE| .01532*** .00071 21.70 .0000 43.5257 EDUC| -.02793*** .00348 -8.02 .0000 11.3206 HHNINC| -.10204** .04544 -2.25 .0247 .35208 --------+--------------------------------------------------------- +---------------------------------------------------------+ |Predictions for Binary Choice Model. Predicted value is | |1 when probability is greater than .500000, 0 otherwise.| |Note, column or row total percentages may not sum to | |100% because of rounding. Percentages are of full sample.| +------+---------------------------------+----------------+ |Actual| Predicted Value | | |Value | 0 1 | Total Actual | +------+----------------+----------------+----------------+ | 0 | 384 ( 1.4%)| 9751 ( 35.7%)| 10135 ( 37.1%)| | 1 | 432 ( 1.6%)| 16759 ( 61.3%)| 17191 ( 62.9%)| +------+----------------+----------------+----------------+ |Total | 816 ( 3.0%)| 26510 ( 97.0%)| 27326 (100.0%)| +------+----------------+----------------+----------------+

18. Affect if Everyone Were 5 Years Older

19. Effect of Income on Probability

20. A Bivariate Probit Model Two equation model General 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 \$

21. Imposing Fixed Value and Equality Constraints Used throughout LIMDEP in all models, model parameters appear as a long list: β1β2β3β4α1α2α3α4σ and so on. M parameters in total. Use ; RST = list of symbols for the model parameters, in the right order This may be used for nonlinear models. Not in REGRESS. Use ;CLS:… for linear models Use the same name for equal parameters Use specific numbers to fix the values

22. 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 DOCTOR Constant| -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 HOSPITAL Constant| -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 correlation RHO(1,2)| .40000 ......(Fixed Parameter)...... --------+-------------------------------------------------------------

23. Cluster Correction PROBIT ; Lhs = doctor ; Rhs = one,age,female,educ,married,working ; Cluster = ID \$ Normal exit: 4 iterations. Status=0. F= 17448.10 +---------------------------------------------------------------------+ | Covariance matrix for the model is adjusted for data clustering. | | Sample of 27326 observations contained 7293 clusters defined by | | variable ID which identifies by a value a cluster ID. | +---------------------------------------------------------------------+ Variable| Coefficient Standard Error b/St.Er. P[|Z|>z] Mean of X --------+------------------------------------------------------------- |Index function for probability Constant| -.17336** .08118 -2.135 .0327 AGE| .01393*** .00102 13.691 .0000 43.5257 FEMALE| .32097*** .02378 13.497 .0000 .47877 EDUC| -.01602*** .00492 -3.259 .0011 11.3206 MARRIED| -.00153 .02553 -.060 .9521 .75862 WORKING| -.09257*** .02423 -3.820 .0001 .67705 --------+-------------------------------------------------------------

24. Using Matrix Algebra Namelists 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

25. Matrix Functions Matrix Product: MATRIX ; XZ = X’Z \$ Moments and Inverse MATRIX ; XPX = X’X ; InvXPX = <X’X> \$ Moments with individual specific weights in variable w. Σiwi xixi’ = X’[w]X. [Σiwi xixi’ ]-1 = <X’[w]X> Unweighted Sum of Rows in a Matrix Σi xi = 1’X Column 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 Σiwi xi = 1’[w]X

26. Normality Test for Probit Thanks to Joachim Wilde, Univ. Halle, Germany for suggesting this.

27. Normality Test for Probit NAMELIST ; 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 \$

28. Endogenous Variable in Probit Model PROBIT ; 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 \$

29. Dependent Variables: Ordered HSAT = ordered reported health satisfaction, coded 0,1,…,10. Use with ORDERED or ORDERED ; Logit Request marginal effects with ; Marginal as usual.

30. Ordered Choice Models Ordered ; Lhs = dependent variable ; Rhs = One, … independent variables \$ Remember to include the constant term For ordered logit instead of ordered probit, use Ordered ; Logit ; Lhs = dependent variable ; Rhs = One, … independent variables \$ To get marginal effects, use ; Margin as usual.

31. Health Satisfaction Model Ordered ; Lhs = hsat ; Rhs = one,age,educ,hhninc, hhkids,married ; Marginal effects \$

32. Estimated Model

33. Data Summary

34. Partial Effects: Continuous Variable

35. Partial Effects: Binary Variable