Download
william greene department of economics stern school of business n.
Skip this Video
Loading SlideShow in 5 Seconds..
Topics in Microeconometrics University of Queensland Brisbane, QLD July 7-9, 2010 PowerPoint Presentation
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

162 Vues Download Presentation
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 3-1Panel Data in Nonlinear Models

  3. Unbalanced Panel Data Set Load healthcare.lpj Create group size variable Examine Distribution of Group Sizes Sample ; all$ Regress ; Lhs=one ; Rhs=one ; Panel ; Str=id$ Create ; _obs=Ndx(id,1)$ (Obs. Number in group) Reject ;_obs < _groupti $ (Keep last obs. in group) Histogram ; rhs=_obs$

  4. Group Sizes

  5. 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 --------+-------------------------------------------------------------

  6. Fixed Effects Models ? Fixed Effects Probit. Sample ; All $ Namelist ; X = age,hhninc,educ,married $ Probit ; Lhs = doctor ; Rhs = X ; FEM ; Marginal ; Pds = _groupti$ Probit ; Lhs = doctor ; Rhs = X,one ; Marginal $

  7. A Fixed Effects Probit Model Probit ;lhs=doctor ; rhs=age,hhninc,educ,married ; fem ; pds=_groupti ; Parameters $ +---------------------------------------------+ | Probit Regression Start Values for DOCTOR | | Maximum Likelihood Estimates | | Dependent variable DOCTOR | | Weighting variable None | | Number of observations 27326 | | Iterations completed 10 | | Log likelihood function -17700.96 | | Number of parameters 5 | | Akaike IC=35411.927 Bayes IC=35453.005 | | Finite sample corrected AIC =35411.929 | +---------------------------------------------+ +---------+--------------+----------------+--------+---------+----------+ |Variable | Coefficient | Standard Error |b/St.Er.|P[|Z|>z] | Mean of X| +---------+--------------+----------------+--------+---------+----------+ AGE .01538640 .00071823 21.423 .0000 43.5256898 HHNINC -.09775927 .04626475 -2.113 .0346 .35208362 EDUC -.02811308 .00350079 -8.031 .0000 11.3206310 MARRIED -.00930667 .01887548 -.493 .6220 .75861817 Constant .02642358 .05397131 .490 .6244 These are the pooled data estimates used to obtain starting values for the iterations to get the full fixed effects model.

  8. Fixed Effects Model Nonlinear Estimation of Model Parameters Method=Newton; Maximum iterations=100 Convergence criteria: max|dB| .1000D-08, dF/F= .1000D-08, g<H>g= .1000D-08 Normal exit from iterations. Exit status=0. +---------------------------------------------+ | FIXED EFFECTS Probit Model | | Maximum Likelihood Estimates | | Dependent variable DOCTOR | | Number of observations 27326 | | Iterations completed 11 | | Log likelihood function -9454.061 | | Number of parameters 4928 | | Akaike IC=28764.123 Bayes IC=69250.570 | | Finite sample corrected AIC =30933.173 | | Unbalanced panel has 7293 individuals. | | Bypassed 2369 groups with inestimable a(i). | | PROBIT (normal) probability model | +---------------------------------------------+ +---------+--------------+----------------+--------+---------+----------+ |Variable | Coefficient | Standard Error |b/St.Er.|P[|Z|>z] | Mean of X| +---------+--------------+----------------+--------+---------+----------+ Index function for probability AGE .06334017 .00425865 14.873 .0000 42.8271810 HHNINC -.02495794 .10712886 -.233 .8158 .35402169 EDUC -.07547019 .04062770 -1.858 .0632 11.3602526 MARRIED -.04864731 .06193652 -.785 .4322 .76348771

  9. Computed Fixed Effects Parameters

  10. Logit Fixed Effects Models Conditional and Unconditional FE ? Logit, conditional vs. unconditional Logit ; Lhs = doctor ; Rhs = X ; Pds = _groupti $ (Conditional) Logit ; Lhs = doctor ; Rhs = X ; Pds = _groupti ; Fixed $

  11. With T ≈ 5, IP Seems Tolerable

  12. Hausman Test for Fixed Effects ? Logit: Hausman test for fixed effects ? Logit ; Lhs = doctor ; Rhs = X ; Pds = _groupti $ Matrix ; Bf = B ; Vf = Varb $ Logit ; Lhs = doctor ; Rhs = X,One $ Calc ; K = Col(X) $ Matrix ; Bp = b(1:K) ; Vp = Varb(1:K,1:K) $ Matrix ; Db = Bf - Bp ; DV = Vf - Vp ; List ; Hausman = Db'<DV>Db $ Calc ; List ; Ctb(.95,k) $

  13. Random Effects vs Random Constant ? Random effects ? Quadrature Based (Butler and Moffitt) Estimator Probit ; Lhs = doctor ; Rhs = X,One ; Random ; Pds = _groupti $ Calc ; List ; RhoQ = rho $ ? Simulation Based Estimator Probit ; Lhs = doctor ; Rhs = X,one ; RPM ; Pds = _groupti ; Fcn = One(N) ; Halton ; Pts = 25 $ Calc ; ks = col(x)+2 $ Calc ; List ; RhoRP = b(ks)^2/(1+b(ks)^2) ; RhoQ $

  14. 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

  15. 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

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

  17. 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 $

  18. 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 $

  19. Random Parameters Model ? Random parameters specification ? Logit ; Lhs = doctor ; Rhs = One,age,educ,hhninc,married ; Pds = _groupti ; RPM ; Halton ; Pts = 25 ; Cor ; Fcn = One(n),hhninc(n),educ(n) ; Marginal ; Parameters ; maxit=20 $ Sample ; 1 - 7293 $ Create ; binc = 0 $ Matrix ; bi = beta_i(1:7293,2:2) $ Create ; binc= bi $ Kernel ; Rhs = binc $

  20. Random Parameters with Heterogeneity ? Random parameters with heterogeneity ? Examine effect of heterogeneity. Sample ; All $ Logit ; Lhs = doctor ; Rhs = One,educ,hhninc,married ; Pds = _groupti ; RPM = female,age ; Halton ; Pts = 15 ; Cor ; Fcn = One(n),educ(n),hhninc(n) ; Marginal ; Parameters $ Create; Bimum = beta_i(firm,2) $ Regress ; Lhs = Bimum ; Rhs = one,InvGood,RawMtl $

  21. Latent Class Models ? Latent class models Namelist ; X = one,educ,hhninc Sample ; All $ Logit ; Lhs = doctor ; Rhs = X ; LCM ; Pds=_groupti ; Pts = 3 $ Logit ; Lhs = doctor ; Rhs = X ; LCM = female,age ; Pds=_groupti ; Pts = 3 $ Logit ; Lhs = doctor ; Rhs = X ; LCM ; Pds=_groupti ; Pts = 4 $ Logit ; Lhs = doctor ; Rhs = X ; LCM ; Pds=_groupti ; Pts = 5 $

  22. Fixed and Random Effects Poisson or NegBin ;PDS=setting Fixed Effects • Default is a conditional esitmator • ;FEM uses the unconditional estimator • The two are algebraically identical but use different algorithms Random Effects • Use ; RANDOM • Can be fit as a random parameters model with just a random constant

  23. Random Parameters Poisson • ; LHS = dependent variable • ; RHS = independent variable(s) • ; PDS = setting (may be ;PDS=1) • ; RPM ; PTS = number of Points • ; Halton (for smarter integration method) • ; Correlated if desired to fit correlated parameters model • ; FCN = variable(n) , variable(n), … to indicate which parameters are random

  24. Latent Class Poisson (or NEGBIN) • ; LHS = dependent variable • ; RHS = independent variable(s) • ; LCM for a latent class model ; LCM = variables if probabilities are heterogeneous • ; PDS = setting (may be ;PDS=1) • ; PTS = number of latent classes