Part 8: IV and GMM Estimation [ 1/48] Econometric Analysis of Panel Data William Greene Department of Economics Stern School of Business Part 8: IV and GMM Estimation [ 2/48] Dear Professor Greene, I have to apply multiplicative heteroscedastic models, that I studied in your book, to the analysis of trade data. Since I have not found any Matlab implementations, I am starting to write the method from scratch. I was wondering if you are aware of reliable implementations in Matlab or any other language, which I can use as a reference. Part 8: IV and GMM Estimation [ 3/48] a “multi-level” modelling feature along the following lines? My data has a “two level” hierarchical structure: I'd like to perform an ordered probit analysis such that we allow for random effects pertaining to individuals and the organisations they work for. density ordered probit = f ( y oit | x oit , oit , oi , o ) (Integrate oit out directly - leads to norm al probability) P rob(y oit j | x oit , oi , o ) G j ( y oit | x oit , oi , o ) G ( y oi t , x oit w oi h0 ) L ogL O o 1 N i 1 log T t 1 G ( y oit , x oit w oi h 0 ) Part 8: IV and GMM Estimation [ 4/48] L ogL O o 1 log N i 1 T t 1 G ( y oit , x oit w oi h 0 ) N eed to integrate out w oi and h o . L ogL O o 1 O o 1 N i 1 log oi N i 1 log L ogL ( , , ) o oi G ( y oit , x oit w oi h 0 ) ( w oi ) dw oi t 1 T G ( y oit , x oit w oi h 0 ) ( w oi ) dw oi ( h o ) dh o t 1 T Part 8: IV and GMM Estimation [ 5/48] L ogL ( , , ) O o 1 N i 1 log o oi G ( y oit , x oit w oi h 0 ) ( w oi ) dw oi ( ho ) dho t 1 T H ow to do the integration? M onte C arlo sim ulation L ogL ( , , ) O O o 1 o 1 N i 1 N i 1 log log o 1 R 1 M R r 1 M m 1 1 M G ( y oit , x oit w oim h 0 ) ( h o ) dh o t 1 T M m 1 G ( y oit , x oit w oim h 0 r ) t 1 T Part 8: IV and GMM Estimation [ 6/48] L ogL ( , , ) O O o 1 o 1 N i 1 N i 1 log 1 R log 1 1 R M 1 M R r 1 R r 1 M m 1 M m 1 G ( y oit , x oit w oim h 0 r ) t 1 T T G ( y oit , x oit w oim h 0 r ) t 1 (C om bine tw o sim ulations in one loop ove r tw o variables s im ulated at the sam e tim e. h o , rm stays still w hile w oi , rm varies.) O o 1 N i 1 log 1 RM RM rm 1 T t 1 G (h 1 , w1 ), (h 1 , w 2 ), (h 1 , w 3 ), etc . y oit , x oit w oi , rm h0 , rm Part 8: IV and GMM Estimation [ 7/48] ----------------------------------------------------------------------------Random Coefficients OrdProbs Model Dependent variable HSAT Log likelihood function -1856.64320 Estimation based on N = 947, K = 14 Inf.Cr.AIC = 3741.3 AIC/N = 3.951 Unbalanced panel has 250 individuals Ordered probit (normal) model LHS variable = values 0,1,...,10 Simulation based on 200 Halton draws --------+-------------------------------------------------------------------| Standard Prob. 95% Confidence HSAT| Coefficient Error z |z|>Z* Interval --------+-------------------------------------------------------------------|Nonrandom parameters Constant| 3.94945*** .24610 16.05 .0000 3.46711 4.43179 AGE| -.04201*** .00330 -12.72 .0000 -.04848 -.03553 EDUC| .05835*** .01346 4.33 .0000 .03196 .08473 |Scale parameters for dists. of random parameters Constant| 1.06631*** .03868 27.57 .0000 .99050 1.14213 |Standard Deviations of Random Effects R.E.(01)| .05759* .03372 1.71 .0877 -.00851 .12369 |Threshold parameters for probabilities Mu(01)| .13522** .05335 2.53 .0113 .03065 .23979 ... Mu(09)| 4.66195*** .11893 39.20 .0000 4.42884 4.89506 --------+-------------------------------------------------------------------- Part 8: IV and GMM Estimation [ 8/48] Agenda Single equation instrumental variable estimation Exogeneity Instrumental Variable (IV) Estimation Two Stage Least Squares (2SLS) Generalized Method of Moments (GMM) Panel data Fixed effects Hausman and Taylor’s formulation Application Arellano/Bond/Bover framework Part 8: IV and GMM Estimation [ 9/48] Structure and Regression E a rn in g s (s tru c tu ra l) e q u a tio n y it x it β E it it , i,t" = siblin g t in fa m ily i E it ' tru e ' e du ca tio n m e a su ra ble o n ly w ith e rro r S it m e a su re d 'sch o o lin g' = E it w it , w = m e a su re m e n t e rro r R e d u c e d fo rm y it x it β (S it w it ) it = x it β S it + ( it w it ) E s tim a tio n p ro b le m fo r le a st squ a re s (O LS o r G LS ) 2 C o v[S it , ( it w it )] w 0 C o n siste n cy re lie s o n th is co va ria n c e e qu a lin g 0 . H o w to e stim a te β a n d (co n siste n tly)? Part 8: IV and GMM Estimation [ 10/48] Exogeneity S tru ctu re y = Xβ + ε E [ ε | X ] = g (X ) 0 R e g re ssio n y = X β + g (X ) + [ ε - g (X ) ] = E [y | X ] + u , E [ u | X ]= 0 P ro je ctio n ε = Xθ + w "R e g re ssio n o f y o n X " y = X (β + θ ) + w T h e p ro b le m : X is n o t e x o g e n o u s . E x o g e n e ity: E [ it | x it ] 0 (cu rre n t p e rio d ) S trict E x o g e n e ity: E [ it | x i1 , x i2 , ..., x iT ] 0 (a ll p e rio d s) (W e a ssu m e n o co rre la tio n a cro ss in d ivid u a ls.) Part 8: IV and GMM Estimation [ 11/48] An Experimental Treatment Effect H ealth O utcom e = f(unobserved individu al characteristics, a observed individual characteristics, x treatment (interventions), T random ness, ) C ardiovascular D isease (C V D ) = + x + T (H orm one R eplacem ent T herapy) + a + P roblem : H R T is associated w ith greater risk of cardiovascular disease. E xperim ental evidence suggests > 0. O b servational evidence suggests < 0. W hy? T = T (a). A lready healthy w om en w ith higher education and higher incom e initiated the treatm ent to prevent heart disease. H R T users had low er C V D in spite of the bad effects of the treatm ent T . T is endogenous in this m odel. (A pparently.) Part 8: IV and GMM Estimation [ 12/48] Instrumental Variables Instrumental variable associated with changes in x, not with ε dy/dx = β dx/dx + dε /dx = β + dε /dx. Second term is not 0. dy/dz = β dx/dz + dε /dz. The second term is 0. β =cov(y,z)/cov(x,z) This is the “IV estimator” Example: Corporate earnings in year t Earnings(t) = β R&D(t) + ε(t) R&D(t) responds directly to Earnings(t) thus ε(t) A likely valid instrumental variable would be R&D(t-1) which probably does not respond to current year shocks to earnings. Part 8: IV and GMM Estimation [ 13/48] Least Squares y = Xβ + ε E[ y | X ] X β E[ ε | X ] X β b ( X X ) 1 X y ( X X ) 1 X ( X β ε ) 1 = β ( X X / N) ( X ε / N) p lim b = β p lim ( X X / N) = β + Qγ β 1 p lim ( X ε / N) Part 8: IV and GMM Estimation [ 14/48] The IV Estimator T h e v a ria b le s X [ x 1 , x 2 , ...x K -1 , x K ], Z [ x 1 , x 2 , ...x K -1 , z ] T h e M o d e l A ssu m p tio n E [ it | z it ] 0 E [ z it it | z it ] E[ z it ( y it x it β ) | z it ] 0 n (U sin g "n " to d e n ote i= 1 T i ) E [(1 /n ) i,t z it it | z it ] E[( 1 /n ) i,t z it ( y it x it β ) | z it ] 0 E [(1 /n ) Z 'y ] = E [(1 /n ) Z 'X β ] T h e E stim a to r : M im ic th is con d ition (if p ossib le ) ˆ so (1 /n ) Z 'y = (1 /n ) Z 'X β ˆ F in d β Part 8: IV and GMM Estimation [ 15/48] A Moment Based Estimator T h e E stim a to r ˆ so (1 /n ) Z 'y = (1 /n ) Z 'X β ˆ F in d β In stru m e n ta l V a ria b le E stim a to r ˆ = ( Z 'X ) -1 Z 'y β (N ot eq u ivalen t to rep lacin g x K w ith z.) Part 8: IV and GMM Estimation [ 16/48] Cornwell and Rupert Data Cornwell and Rupert Returns to Schooling Data, 595 Individuals, 7 Years Variables in the file are EXP WKS OCC IND SOUTH SMSA MS FEM UNION ED LWAGE = = = = = = = = = = = work experience, EXPSQ = EXP2 weeks worked occupation, 1 if blue collar, 1 if manufacturing industry 1 if resides in south 1 if resides in a city (SMSA) 1 if married 1 if female 1 if wage set by unioin contract years of education log of wage = dependent variable in regressions These data were analyzed in Cornwell, C. and Rupert, P., "Efficient Estimation with Panel Data: An Empirical Comparison of Instrumental Variable Estimators," Journal of Applied Econometrics, 3, 1988, pp. 149-155. See Baltagi, page 122 for further analysis. The data were downloaded from the website for Baltagi's text. Part 8: IV and GMM Estimation [ 17/48] Wage Equation with Endogenous Weeks logWage=β1+ β2 Exp + β3 ExpSq + β4OCC + β5 South + β6 SMSA + β7 WKS + ε Weeks worked is believed to be endogenous in this equation. We use the Marital Status dummy variable MS as an exogenous variable. Wooldridge Condition (5.3) Cov[MS, ε] = 0 is assumed. Auxiliary regression: For MS to be a ‘valid’ instrumental variable, In the regression of WKS on [1,EXP,EXPSQ,OCC,South,SMSA,MS, ] MS significantly “explains” WKS. A projection interpretation: In the projection XitK =θ1 x1it + θ2 x2it + … + θK-1 xK-1,it + θK zit , θK ≠ 0. (One normally doesn’t “check” the variables in this fashion. Part 8: IV and GMM Estimation [ 18/48] Auxiliary Projection +----------------------------------------------------+ | Ordinary least squares regression | | LHS=WKS Mean = 46.81152 | +----------------------------------------------------+ +---------+--------------+----------------+--------+---------+----------+ |Variable | Coefficient | Standard Error |b/St.Er.|P[|Z|>z] | Mean of X| +---------+--------------+----------------+--------+---------+----------+ Constant 45.4842872 .36908158 123.236 .0000 EXP .05354484 .03139904 1.705 .0881 19.8537815 EXPSQ -.00169664 .00069138 -2.454 .0141 514.405042 OCC .01294854 .16266435 .080 .9366 .51116447 SOUTH .38537223 .17645815 2.184 .0290 .29027611 SMSA .36777247 .17284574 2.128 .0334 .65378151 MS .95530115 .20846241 4.583 .0000 .81440576 Part 8: IV and GMM Estimation [ 19/48] Application: IV for WKS in Rupert +----------------------------------------------------+ | Ordinary least squares regression | | Residuals Sum of squares = 678.5643 | | Fit R-squared = .2349075 | | Adjusted R-squared = .2338035 | +----------------------------------------------------+ +---------+--------------+----------------+--------+---------+ |Variable | Coefficient | Standard Error |b/St.Er.|P[|Z|>z] | +---------+--------------+----------------+--------+---------+ Constant 6.07199231 .06252087 97.119 .0000 EXP .04177020 .00247262 16.893 .0000 EXPSQ -.00073626 .546183D-04 -13.480 .0000 OCC -.27443035 .01285266 -21.352 .0000 SOUTH -.14260124 .01394215 -10.228 .0000 SMSA .13383636 .01358872 9.849 .0000 WKS .00529710 .00122315 4.331 .0000 Part 8: IV and GMM Estimation [ 20/48] Application: IV for wks in Rupert +----------------------------------------------------+ | LHS=LWAGE Mean = 6.676346 | | Standard deviation = .4615122 | | Residuals Sum of squares = 13853.55 | | Standard error of e = 1.825317 | | Fit R-squared = -14.64641 | | Adjusted R-squared = -14.66899 | | Not using OLS or no constant. Rsqd & F may be < 0. | +----------------------------------------------------+ +---------+--------------+----------------+--------+---------+ |Variable | Coefficient | Standard Error |b/St.Er.|P[|Z|>z] | +---------+--------------+----------------+--------+---------+ Constant -9.97734299 3.59921463 -2.772 .0056 EXP .01833440 .01233989 1.486 .1373 EXPSQ -.799491D-04 .00028711 -.278 .7807 OCC -.28885529 .05816301 -4.966 .0000 SOUTH -.26279891 .06848831 -3.837 .0001 SMSA .03616514 .06516665 .555 .5789 WKS .35314170 .07796292 4.530 .0000 OLS-----------------------------------------------------WKS .00529710 .00122315 4.331 .0000 Part 8: IV and GMM Estimation [ 21/48] Generalizing the IV Estimator-1 D efin e a p a rtition ed reg ression for n ob serv a tion s y = X 1β 1 + X 2 β 2 + ε K1 K 2 v a ria b les su ch th a t p lim ( X 1 ε /N ) = 0 a n d p lim ( X 2 ε /N ) 0 . T h ere ex ists a set of M K 2 v a ria b les W su ch th a t p lim (1 /n ) W 'X 1 Q W 1 0 p lim (1 /n ) W 'X 2 Q W 2 0 p lim (1 /n ) W 'ε Q W ε = 0 , W is ex og en ou s p lim (1 /n ) X 1 ε Q 1ε 0 , X 1 is ex og en ou s p lim (1 /n ) X 2 ε Q 2ε 0 , X 2 is n ot ex og en ou s Part 8: IV and GMM Estimation [ 22/48] Generalizing the IV Estimator - 2 D e fin e th e se t o f in stru m e n ta l va ria ble s Z Z1 X1 Z 2 K 2 lin e a r co m bin a tio n o f th e M W s = WP P = a n M xK 2 m a trix. W P is N xK 2 Z = [ Z 1 , Z 2 ]= [ X 1 , Z 2 ]= [ X 1 , W P ] W h y m u st M be K 2 ? S o Z 2 ca n h a ve fu ll co lu m n ra n k. Part 8: IV and GMM Estimation [ 23/48] Generalizing the IV Estimator B y th e d e fin itio n s, Z is a se t o f in stru m e n ta l v a ria b le s. ˆ = [ Z 'X ] -1 Z 'y β is co n siste n t a n d a sy m p to tica lly n o rm a lly d istrib u te d . 2 ˆ ˆ )'( y X β ˆ) (y Xβ N o r (N -K ) A ssu m in g h o m o sce d a sticity a n d n o a u to co r e la tio n , 2 -1 -1 ˆ] E st.A sy.V a r[ β ˆ [ Z 'X ] Z 'Z [ X 'Z ] Part 8: IV and GMM Estimation [ 24/48] The Best Set of Instruments Z1 X1 Z 2 K 2 lin e a r co m b in a tio n o f th e M W s = WP P = a n M x K 2 m a trix . W P is N x K 2 Z = [ Z 1 , Z 2 ]= [ X 1 , Z 2 ]= [ X 1 , W P ] W h a t is th e b e st P to u se (th e b e st w a y to co m b in e th e e x o g e n o u s in stru m e n ts)? (a ) If M = K 2 , it m a k e s n o d iffe re n ce . (b ) If M < K 2 , th e re a re to o fe w in stru m e n ts to co n tin u e (c) If M > K 2 , th e re is o n e b e st co m b in a tio n , 2 S L S . Part 8: IV and GMM Estimation [ 25/48] Two Stage Least Squares A C la ss o f IV e stim a to rs by Z = [ Z 1 , Z 2 ] = [ X 1 , W ] P 2 S LS is de fin e d by (1 ) R e gre ss ( X 1 a n d X 2 ) o n a ll o f ( X 1 a n d W ), c o lu m n by co lu m n , ˆ and X ˆ ) = X ˆ . X is re pro du ce d a n d co m pu te pre dicte d va lu e s, ( X 1 2 1 I ˆ pe rfe ctly by re gre ssin g it o n itse lf so X 1 = [ X 1 , W ] P1 =[ X 1 , W ] 0 ˆ [ X , W ] P . Fo r 2 S LS , X ˆ = Z (Z 'Z ) -1 Z 'X X 2 1 2 ˆ to e stim a te β . (2 ) R e gre ss y o n X (D o e s it w o rk a s a n IV e stim a to r? ˆ is a lin e a r co m bin a tio n o f X a n d W , so ye s.) X 2 1 Part 8: IV and GMM Estimation [ 26/48] 2SLS Estimator B y th e d e fin itio n s, Z is a se t o f in stru m e n ta l v a ria b le s. ˆ = [X ˆ 'X ] -1 X ˆ 'y β is co n siste n t a n d a sy m p to tica lly n o rm a lly d istrib u te d . 2 ˆ ˆ )'( y X β ˆ) (y Xβ N o r (N -K ) A ssu m in g h o m o sce d a sticity a n d n o a u to co r e la t io n , 2 ˆ -1 ˆ ˆ ˆ] ˆ ] -1 E st.A sy.V a r[ β 'X ] X 'X [ X 'X ˆ [X Part 8: IV and GMM Estimation [ 27/48] 2SLS Algebra ˆ 'X = Z (Z 'Z ) -1 Z 'X 'X X -1 = X ' Z (Z 'Z ) Z ' X = X' -1 Z (Z 'Z ) Z ' -1 Z (Z 'Z ) Z ' X ˆ 'X ˆ = X T h e re fo re ˆ 'X ] -1 X ˆ 'X ˆ [ X 'X ˆ ] -1 [ X ˆ 'X ˆ ]1 [X ˆ] ˆ 'X ˆ] , E st.A sy.V a r[β ˆ [X ˆ 2 -1 2 ˆ )'( y X β ˆ) (y Xβ n o r (n -K ) Part 8: IV and GMM Estimation [ 28/48] A General Result for IV We defined a class of IV estimators by the set of variables Z1 X1 Z 2 K 2 lin e a r co m b in a tio n o f th e M W s = WP P = a n M x K 2 m a trix . W P is N x K 2 Z = [ Z 1 , Z 2 ]= [ X 1 , Z 2 ]= [ X 1 , W P ] The minimum variance (most efficient) member in this class is 2SLS (Brundy and Jorgenson(1971)) (rediscovered JW, 2000, p. 96-97) Part 8: IV and GMM Estimation [ 29/48] GMM Estimation – Orthogonality Conditions G e n e ra l M o d e l F o rm u la tio n : y = X β + ε ; p lim [(1 /n ) X 'ε ] 0 (p o ssib ly ) K re g re sso rs in X M K In stru m e n ta l v a ria b le s Z ; p lim [(1 /n ) Z 'ε ] = 0 . IV fo rm u la tio n im p lie s M o rth o g o n a lity c o n d itio n s E [z m ( y x 'β )] 0 . 2S L S o n ly K o f th e se in th e fo rm ˆ m ( y x 'β )] 0 w h e re E [x M ˆ x m = l= 1 lm z m ˆ = (X ˆ 'X ˆ ) -1 X ˆ 'y S o lu tio n is β C o n sid e r a n e stim a to r th a t u se s a ll M e q u a tio n s w h e n M > K T h e o rth o g o n a lity co n d itio n to m im ic is n E [ (1 /n ) i= 1 z im ( y i x iβ )]= 0 , m = 1 ,...,M T h is is M e q u a tio n s in K u n k n o w n s e a ch o f th e fo rm E [ g m ( β )]= 0 . Part 8: IV and GMM Estimation [ 30/48] GMM Estimation - 1 n E [(1 /n ) i= 1 z im ( y i x iβ )]= 0 , m = 1 ,...,M E [g m ( β )]= 0 , m = 1 ,...,M . S a m p le cou n te rp a rts - fin d in g th e e stim a tor: N ˆ )= 0 (1 /n ) i= 1 z im ( y i x iβ (a ) If M = K , th e e x a ct solu tion is 2 S LS (b ) If M < K , th e re a re too f e w e q u a tion s. N o solu tion . (c) If M > K , th e re a re e x ce ss e q u a tion s . H ow to re con cile th e m ? F irst P a ss: "Le a st S q u a re s" ˆ : T ry M in im izin g w rt β M m=1 ˆ) (1 /n ) i= 1 z im ( y i x iβ n 2 g ( β ) 'g ( β ) Part 8: IV and GMM Estimation [ 31/48] GMM Estimation - 2 ˆ = th e m in im ize r of β g ( β ) 'g ( β ) = g ( β ) ' I -1 M m=1 ˆ) (1 /n ) i= 1 z im ( y i x iβ n 2 g ( β ) 'g ( β ) g(β ) D e fin e s a "M in im u m D ista n ce E stim a tor" w ith w e ig h t m a trix = I. M ore g e n e ra lly : L e t ˆ = th e m in im ize r of g ( β ) ' A g ( β ) β R e su lts: F or a n y p ositiv e d e fin ite m a tr ix A , ˆ is con siste n t a n d a sy m p totica lly n orm a lly d istrib u te d . β ) β ( g ) β ( g ˆ ]= A )] β ( g r[ a sy.V A A A sy .V a r[ β ' β ' β (S e e JW , C h . 1 4 for a n a ly sis of a sy m p totic p rop e rtie s.) Part 8: IV and GMM Estimation [ 32/48] IV Estimation ˆ = th e m in im izer of g ( β ) ' A g ( β ) β R esu lts: F or an y p ositive d efin ite m atr ix A , ˆ is con sisten t. β g ( β ) g ( β ) ˆ ]= A sy.V ar[ β A A sy.V ar[ g ( β )] A β ' β ' -1 F or IV estim ation , g ( β ) = (1 /n ) Z '( y - X β ) g(β ) (1 / n) Z 'X β ' 2 n 2 A sy.V ar[ g ( β )] (1 / n) i 1 z i z i a ssu m in g h o m o sce d a sticity a n d n o a u to co r re la tio n . Part 8: IV and GMM Estimation [ 33/48] An Optimal Weighting Matrix ˆ = th e m in im ize r o f g ( β ) ' A g ( β ) β Fo r a n y p o sitiv e d e fin ite m a trix A , ˆ is c o n siste n t a n d a sy m p to tic a lly n o rm a lly d istrib u te d . β g ( β ) g ( β ) ˆ ]= A sy .V a r[ β A A sy.V a r[ g ( β )] A β ' β ' 1 Is th e re a 'b e st' A m a trix ? T h e m o st e ffic ie n t e stim a to r in th e G M M c la ss has A = A sy.V a r[ g ( β )] 1 . A A sy.V a r[ g ( β )] A = A sy.V a r[ g ( β )] 1 ˆ β = th e m in im ize r o f g ( β ) ' A sy.V a r[ g ( β )] g( β ) GMM 1 Part 8: IV and GMM Estimation [ 34/48] The GMM Estimator 1 ˆ β = th e m in im ize r of q = g ( β ) ' A sy.V a r[ g ( β )] g( β ) GMM 1 g(β ) g(β ) ˆ A sy.V a r[ β G M M ]= A sy.V a r[ g ( β )] β ' β ' F or IV e stim a tion , g ( β ) = (1 /n ) Z '( y - X β ), 2 N 2 2 1 g(β ) (1 / N) Z 'X β ' 2 A sy.V a r[ g ( β )] (1 / n) i 1 z i z i =( / n ) Z 'Z 2 2 -1 ˆ A sy.V a r[ β ]= ( (1 / n) X 'Z )[( / n ) Z 'Z ] ( (1 / n) Z 'X ) GMM 1 2 -1 = X 'Z [ Z 'Z ] Z 'X ) 1 !!!! ! IM P L IC A T IO N : 2 S L S is n o t ju st e fficie n t fo r IV e stim a to rs th a t u se a lin e a r c o m b in a tio n o f th e co lu m n s o f Z . It is e ffici e n t a m o n g a ll e stim a to rs th a t u se th e co lu m n s o f Z . Part 8: IV and GMM Estimation [ 35/48] GMM Estimation g ( β )= 1 N N i 1 z i ( y i x iβ ) 1 N N i1 z i ε i A ssu m in g h o m o sce d a sticity a n d n o a u to co r re la tio n 2 S L S is th e e fficie n t G M M e stim a to r. W h a t if th e re is h e te ro sce d a sticity ? 1 1 n 2 1 N 2 A sy.V a r[ g ( β )] 2 i 1 i z i z i , e stim a te d w ith i 1 e i z i z i n nn b a se d o n 2 S L S re sid u a ls e i . T h e G M M e stim a to r m in im ize s 1 n 1 q i 1 z i ( y i x iβ ) ' n n 1 n 2 i 1 e i z i z i n 1 1 n z ( y x β ) i1 i i i . n -1 T h is is n o t 2 S L S b e ca u se th e w e ig h tin g m a trix is n o t ( Z 'Z ) . Part 8: IV and GMM Estimation [ 36/48] Application - GMM NAMELIST NAMELIST 2SLS NLSQ ; x = one,exp,expsq,occ,south,smsa,wks$ ; z = one,exp,expsq,occ,south,smsa,ms,union,ed$ ; lhs = lwage ; RHS = X ; INST = Z $ ; fcn = lwage-b1'x ; labels = b1,b2,b3,b4,b5,b6,b7 ; start = b ; inst = Z ; pds = 0$ Part 8: IV and GMM Estimation [ 37/48] Application - 2SLS Part 8: IV and GMM Estimation [ 38/48] GMM Estimates Part 8: IV and GMM Estimation [ 39/48] 2SLS GMM with Heteroscedasticity Part 8: IV and GMM Estimation [ 40/48] Testing the Overidentifying Restrictions q = g ( β ) ' A sy.V a r[ g ( β )] 1 g( β ) U n de r th e h ypo th e sis th a t E [ g ( β )] = 0 , d 2 q [M K ] M = n u m be r o f m o m e n t e qu a tio n s K = n u m be r o f pa ra m e te rs e stim a te d (In o u r e x a m ple , M = 9 , K = 7 .) M - K = n u m be r o f 'e x tr a ' m o m e n t e qu a tio n s. M o re th a n a re n e e de d to ide n tify th e pa ra m e te rs. Fo r th e e x a m ple , | Value of the GMM criterion : | e(b)tZ inv(ZtWZ) Zte(b) = | 537.3916 | Part 8: IV and GMM Estimation [ 41/48] Inference About the Parameters N 2 -1 ˆ β (X 'Z )[ i= 1ˆ i z i z i ] (Z 'X ) GMM 1 (X 'Z )[ N i= 1 N 2 -1 ˆ E st.A sy.V a r[ β ]= (X 'Z ) [ z z ] (Z 'X ) ˆ GMM i= 1 i i i 2 -1 ˆ i z i z i ] (Z 'y ) 1 R e strictio n s ca n be te ste d u sin g W a ld sta tistics; H 0 : r ( β )= h H 1 :N o t H 0 W a ld R ˆ r (β )- h GMM ˆ r (β )- h GMM ˆ ' R E st.A sy.V a r[ β ] R GMM 1 r ( βˆ GMM )- h ˆ β GMM E .g., fo r a sim ple te st, H 0 : k = 0 , th is is th e squ a re o f th e t-ra tio . Part 8: IV and GMM Estimation [ 42/48] Specification Test Based on the Criterion C o n sid e r a n u ll h yp o th e sis H 0 th a t im p o se s re strictio n s o n a n a lte rn a tive h yp o th e sis H 1 , U n d e r th e n u ll h yp o th e sis th a t E [ g ( β 0 )] = 0 , q 0 = g ( β 0 ) ' A sy.V a r[ g ( β 0 )] 1 d 2 g ( β 0 ) [M K 0 ] U n d e r th e a lte rn a tive h yp o th e sis, H 1 q 1 = g ( β 1 ) ' A sy.V a r[ g ( β 1 )] d 1 d 2 g ( β 1 ) [M K 1 ] 2 U n d e r th e n u ll, q 0 q 1 [K 1 K 0 ] R e strictio n s ca n b e te ste d u sin g th e cri te rio n fu n ctio n s sta tistic, q 0 q 1 . (W e ig h tin g m a trix m u st b e th e sa m e fo r H 0 a n d H 1 . U se th e u n re stricte d w e ig h tin g m a trix .) Part 8: IV and GMM Estimation [ 43/48] Extending the Form of the GMM Estimator to Nonlinear Models V e ry little ch a n ge s if th e re gre ssio n fu n ctio n is n o n lin e a r. 1 1 N 2 1 N 2 A sy.V a r[ g ( β )] 2 i 1 i z i z i , e stim a te d w ith i 1 e i z i z i N N N ba se d o n n o n lin e a r 2 S LS re sidu a ls e i . T h e G M M e stim a to r m in im ize s 1 N 1 q i 1 z i ( y i f ( x iβ )) ' N N 1 N 2 i 1 e i z i z i N T h e pro ble m is e sse n tia lly th e sa m e . 1 1 N z ( y f ( x β )) i 1 i i i . N Part 8: IV and GMM Estimation [ 44/48] A Nonlinear Conditional Mean f ( x iβ ) e x p( x β ) E[ z i ( y i e x p( x iβ ))] 0 N o n lin e a r in stru m e n ta l va ria ble s (2 S LS ) m in im ize s N i= 1 1 N ( y i e x p( x iβ )) z i '[ Z 'Z ] i= 1 z i ( y i e x p( x iβ )) N o n lin e a r G M M th e n m in im ize s 1 N 2 N 2 1 ( y e x p( x β )) z '[(1 / N) i 1ˆ i z i z i ] i= 1 i i i N 1 N ˆ 1 i= 1 ( y i e x p( x iβ )) z i ' W N 1 N z ( y e x p( x β )) i= 1 i i i N 1 N z ( y e x p( x β ) ) i= 1 i i i N Part 8: IV and GMM Estimation [ 45/48] Nonlinear Regression/GMM NAMELIST ; x = one,exp,expsq,occ,south,smsa,wks$ NAMELIST ; z = one,exp,expsq,occ,south,smsa,ms,union,ed$ ? Get initial values to use for optimal weighting matrix NLSQ ; lhs = lwage ; fcn=exp(b1'x) ; inst = z ; labels=b1,b2,b3,b4,b5,b6,b7 ; start=7_0$ ? GMM using previous estimates to compute weighting matrix NLSQ (GMM) ; fcn = lwage-exp(b1'x) ; inst = Z ; labels = b1,b2,b3,b4,b5,b6,b7 ; start = b ; pds = 0 $ (Means use White style estimator) Part 8: IV and GMM Estimation [ 46/48] Nonlinear Wage Equation Estimates NLSQ Initial Values Part 8: IV and GMM Estimation [ 47/48] Nonlinear Wage Equation Estimates 2nd Step GMM Part 8: IV and GMM Estimation [ 48/48] IV for Panel Data Fixed E ffects b 2 sls ,lsdv N i 1 X i M D Z i N i 1 Z i M D Z i 1 N i 1 Z i M D X i 1 1 N N N X M Z Z M Z Z M y i 1 i D i i 1 i D i i 1 i D i R andom E ffects N ˆ 1Z b 2 sls , R E i 1 X i i i N X ˆ 1Z i 1 i i i N ˆ 1Z i 1 Z i i i N i 1 ˆ Z Z i i 1 i 1 1 N ˆ 1 X i 1 Z i i i N i 1 ˆ 1y Z i i i 1