Академический Документы
Профессиональный Документы
Культура Документы
William Greene
Department of Economics
Stern School of Business
Part 7: Regression Extensions [ 2/77]
Regression Extensions
u
v
Part 7: Regression Extensions [ 6/77]
-----------------------------------------------------------------------------
LSDV least squares with fixed effects ....
LHS=YIT Mean = 11.57749
Standard deviation = .64344
---------- No. of observations = 1482 DegFreedom Mean square
Regression Sum of Squares = 605.772 255 2.37558
Residual Sum of Squares = 7.37954 1226 .00602
Total Sum of Squares = 613.152 1481 .41401
---------- Standard error of e = .07758 Root MSE .07057
Fit R-squared = .98796 R-bar squared .98546
Estd. Autocorrelation of e(i,t) = .007815
--------------------------------------------------
Panel:Groups Empty 0, Valid data 247
Smallest 6, Largest 6
Average group size in panel 6.00
Variances Effects a(i) Residuals e(i,t)
.021204 .006019
Std.Devs. .145615 .077583
Rho squared: Residual variation due to ai .778892
Within groups variation in YIT .49745D+02
R squared based on within group variation .851653
Between group variation in YIT .56341D+03
--------+--------------------------------------------------------------------
| Standard Prob. 95% Confidence
YIT| Coefficient Error z |z|>Z* Interval
--------+--------------------------------------------------------------------
X1| .63797*** .02380 26.81 .0000 .59132 .68461
X2| .04128*** .01544 2.67 .0075 .01100 .07155
X3| .02819 .02217 1.27 .2036 -.01527 .07165
X4| .30816*** .01323 23.30 .0000 .28224 .33408
--------+--------------------------------------------------------------------
T| Base = 1993
1994 | .03292*** .00713 4.62 .0000 .01894 .04690
1995 | .06137*** .00749 8.20 .0000 .04669 .07604 Evidence of technical
1996 | .07195*** .00801 8.98 .0000 .05625 .08765
1997 | .07530*** .00843 8.93 .0000 .05878 .09183
change
1998 | .09401*** .00892 10.53 .0000 .07651 .11150
--------+--------------------------------------------------------------------
Part 7: Regression Extensions [ 8/77]
i 1 i W ,i i i 1 i W ,i i
ˆ N XM X N XM y
i i i
ˆ W W y X ˆ
1
i i
See Cornwell, Schmidt, Sickles (1990) (Frontiers literature.)
Part 7: Regression Extensions [ 9/77]
ˆ)
ˆ i [DiDi ]1 D(y i -X iβ
α
Part 7: Regression Extensions [ 10/77]
Part 7: Regression Extensions [ 11/77]
calc;list;r2=1-(1482-col(x)-3*247)*sst/((n-1)*var(yit))$
[CALC] R2 = .9975014
F[2*247, 1482-4-3*247]
= (.99750 - .98669)/(2*247) / ((1 - .99750)/(1482 – 4 – 3*247))
= 6.45
Wald = 6.45*494 = 3186. Critical chi squared for 494 DF = 546.81
Part 7: Regression Extensions [ 12/77]
1
2.1 ˆ (k+1) = i ,t
xit xit i ,t
xit ( yit ˆ i ( k ) ˆ t ( k ) )
2.2 ˆ i ( k 1)
T
t 1
( yit xit
ˆ (k+1) ) ˆ ( k ) /
t T 2
t 1 ˆ t ( k ) , i 1,..., N
2.3 ˆ t (k+1) =
N
i 1
( yit xit
ˆ (k+1) )ˆ ( k 1)
i / N
i 1
ˆ i
( k 1) 2
, t 2,..., T
3. Iterate to convergence.
(*) a. What does this converge to? MLE under normality.
(*) b. How to compute standard errors? Hessian. No IP problem for linear model.
Part 7: Regression Extensions [ 13/77]
911
Rescue
Part 7: Regression Extensions [ 14/77]
No Effects
Part 7: Regression Extensions [ 18/77]
Generalized Regression
Accommodating Autocorrelation (and Heteroscedasticity)
Fixed Effects :
y it x it β i it
β
y i [X i Di ] ε i
α
Var[εi | X i , Di ] Σ i = Ω i (Dimension Ti xTi ), Σ i positive definite
Random Effects :
y it x it β ui it
y i [X i ]β uii+ε i
Var[uii + εi | X i ] u2ii + Σ = Ω i (Dimension Ti xTi .)
Part 7: Regression Extensions [ 20/77]
OLS Estimation
β
Fixed Effects : y i [X i Di ] ε i = ZFi θF w Fi
α
Random Effects : y i [X i ]β uii +ε i = ZRi θR w Ri
Least Squares
Coefficient Estimator, M = FE or RE
1
ˆ N ZMZM N ZMy M
θM
i1 i i i1 i i
Cluster Robust Covariance Matrix based on the White Estimator
1 1
ˆ ] Z Z Z w
Est.Asy.Var[θ N M M
ˆ wN
ˆ Z Z Z
M M M M N M M
M
i1
i i i1
i i i
i i1 i i
wˆM
i vector of Ti least squares residuals
Part 7: Regression Extensions [ 21/77]
GLS Estimation
ˆ N ZMΦ
1 ˆ2
θ ˆ -1ZM N ZMΦ
ˆ -1 y M , Φ
ˆ -1 I ii
R
i1 i i i i1 i i i i
1 Tiˆ
2
1
ˆ Z Φ
ˆ ] ˆ Z
2 N M -1 M
Est.Asy.Var[θR
i1 i i i
Part 7: Regression Extensions [ 22/77]
Heteroscedasticity
Naturally expected in microeconomic data, less so in
macroeconomic
Model Platforms
Fixed Effects yit i xitβ it , E[it2 | Xi ] 2,it
Random Effects y it x itβ ui it , E[it2 | X i ] 2 ,it
(not actually estimable) E[ui2 | X i ] u,i
2
Estimation
OLS with (or without) robust covariance matrices
GLS and FGLS
Maximum Likelihood
Part 7: Regression Extensions [ 23/77]
See Baltagi (2001, p. 24) for analysis of these data. The article on which the
analysis is based is Baltagi, B. and Griffin, J., "Gasoline Demand in the OECD: An
Application of Pooling and Testing Procedures," European Economic Review, 22,
1983, pp. 117-137. The data were downloaded from the website for Baltagi's
text.
Part 7: Regression Extensions [ 25/77]
6 .0 0
5 .5 0
L GASPCAR
5 .0 0
4 .5 0
4 .0 0
3 .5 0
3 .0 0
0 2 4 6 8 10 12 14 16 18
COUNT RY
Part 7: Regression Extensions [ 26/77]
LSDV Residuals
Country Specific Residuals
.4 0
.2 0
EIT
.0 0
-. 2 0
-. 4 0
0 2 4 6 8 10 12 14 16 18
COUNT RY
Part 7: Regression Extensions [ 27/77]
.0 4 0
.0 3 0
VARIANCE
.0 2 0
.0 1 0
.0 0 0
0 2 4 6 8 10 12 14 16 18
COUNT RY
Part 7: Regression Extensions [ 28/77]
1 1
Est.Var[b | X] Ni1 X iMDi X i Ni1 tTi 1eit2 ( x it x i )( x it x i ) Ni1 XiMDi X i
Using a conventional notation,
1 1
Est.Var[b | X] Ni1 tTi 1 x it x it Ni1 tTi 1eit2 x it x it Ni1 tTi 1 x it x it
Part 7: Regression Extensions [ 29/77]
In order to test robustness two versions of the fixed effects model were run. The first is
Ordinary Least Squares, and the second is heteroscedasticity and auto-correlation robust
(HAC) standard errors in order to check for heteroscedasticity and autocorrelation.
[Only one version of the model was computed. There was no “check.”]
Part 7: Regression Extensions [ 30/77]
Narrower Assumptions
Constant variance within the group
y it i x itβ it , E[it2 | X i ] 2 ,i
White Robust Covariance Matrix Estimator - no change
1 1
Est.Var[b | X] Ni1 X iMDi X i Ni1 t=1
Ti
e 2
( x x )( x x ) Ni1 X iMDi X i
it it i it i
Modified estimator - use within group constancy of variance
1 1
Var[b | X ] Ni1 X iMDi X i Ni12 ,i X iMDi X Ni1 X iMDi X i
1
Ti 2
t=1 eit
1
N
i
Est.Var[b | X] i1 X iMD X i i1 N
i
N
i
X iMD X i1 X iMD X i
Ti
Does it matter?
Part 7: Regression Extensions [ 31/77]
Feasible GLS
Requires a narrower assumption, estimation of 2 ,it is not feasible.
(Same as in cross section model.)
E[it2 | X i ] 2 ,i ; Var[ε|X i ] 2 ,iI = Ωi
ˆ N XMi Ω-1Mi X 1 N X Mi Ω-1Mi y
β i1 i D i D i i1 i D i D i
1
N 1 N 1
= i1 2 XiMD X i i1 2 X iMD y i
i i
,i ,i
= weighted within groups LS with constant weights within groups.
Ti 2
ˆ
ˆ i y i xi β
2 e
ˆ ,i t=1 it
(Not a function of 2
ˆ ,i . Proof left to the reader.)
Ti
Part 7: Regression Extensions [ 33/77]
OLS
1
b X i X i Ni1 X i y i
N
i1
1 1
X X X ΩX X X
1
Var[b | X] N N
i1 Ti i1 Ti Ni1 Ti Ni1 Ti
Ω = diag[Ω1 , Ω2 , ...ΩN ] Each block is Ti xTi
Ωi 2 ,iI u,i
2
ii
Part 7: Regression Extensions [ 38/77]
White correction?
1 1
Est.Var[b|X]= Xi X i Ni1 t=1
N Ti
eit2 x it x it Ni1 Xi X i
i1
Does this work? No. Observations are correlated.
Cluster Estimator
Est.Var[b|X] ( X'X)1 Ni=1 ( t=1
Ti Ti
x it eit )( t=1 x it eit ) ( X'X) 1
Part 7: Regression Extensions [ 40/77]
Maximum Likelihood
Let ,i exp(ziδ),
u,i u exp(hi )
i =1/2i ,
i =ui2 / 2i ,
R i Ti i 1,
Qi i / R i ,
logL i (1 / 2)[i (εiε i Qi (Ti i )2 ) logR i Ti log i Ti log 2]
Can be maximized using ordinary optimization methods.
Treat as a standard nonlinear optimization problem. Solve
with iterative, gradient methods.
Is there much benefit in doing this? Why would one do this?
Part 7: Regression Extensions [ 43/77]
Autocorrelation
Source?
Already present in RE model – equicorrelated.
Models:
Autoregressive: εi,t = ρεi,t-1 + vit – how to interpret
Unrestricted: (Already considered)
Estimation requires an estimate of ρ
1 N Ti
t 2 ei,t ei,t 1
1 N
ˆ i1 i1
ˆi
N T 2
t 1ei,t N
i
Macroeconomic Data –
Baltagi/Griffin Gasoline Market
+----------------------------------------------------+
| Least Squares with Group Dummy Variables |
| LHS=LGASPCAR Mean = 4.296242 |
| Estd. Autocorrelation of e(i,t) .775557 |
+----------------------------------------------------+
+---------+--------------+----------------+--------+---------+
|Variable | Coefficient | Standard Error |t-ratio |P[|T|>t] |
+---------+--------------+----------------+--------+---------+
LINCOMEP .66224966 .07338604 9.024 .0000
LRPMG -.32170246 .04409925 -7.295 .0000
LCARPCAP -.64048288 .02967885 -21.580 .0000
Part 7: Regression Extensions [ 49/77]
Aggregation Test
Aggregation: Separate equations for each unit; the
aggregation hypothesis is that the s are the same.
H0: β1 β2 ... βN
H1: Not H0
Correlation structure (free Σ) is maintained.
Approaches :
(1) Wald test using bi from separate OLS regressions
(2) LR test, using NT[log|S 0 | log | S1 |]. S is computed
using residuals equation by equation. All equations fit
by ML in both cases
(3) Other strategies based on F statistics
(4) Other hypotheses related Σ to are based on the likelihood.
(See Greene (2012, section 11.11).)
Part 7: Regression Extensions [ 50/77]
See Baltagi (2001, p. 24) for analysis of these data. The article on which the
analysis is based is Baltagi, B. and Griffin, J., "Gasoline Demand in the OECD: An
Application of Pooling and Testing Procedures," European Economic Review, 22,
1983, pp. 117-137. The data were downloaded from the website for Baltagi's
text.
Part 7: Regression Extensions [ 51/77]
Measurement Error
Standard regression results: General effects model
y it x *it c i it
x it x *it hit
x it measured variable, including measurement error.
b=(x x )-1 x y=(x x/Ni=1 Ti )-1 (x * h)[x *+c+ε]/Ni=1 T
Var[x *it ] Cov[x *it , c i ]
plim b = * *
Var[x it ] Var[h ]
it Var[x it ] Var[hit ]
Wage Equation
Structure
y i1 x iα zi1β+i i1
y i2 x iα zi2β+i i2
i zi1θ+zi2θ+x iδ i
Reduced Form=Two equation SUR model.
y i1 x i (α+δ) zi1 (β+θ)+zi2θ + (i1 i )
y i2 x i (α+δ)+ zi1θ zi2 (β+θ)+ (i2 i )
First differences gives the "fixed effects" approach
y i1 y i2 (zi1 - zi2 )β+(i1 -i2 )
y i1 y i2 (S11 -S22 )β+(i1 -i2 ) The regressor is measured with error.
First difference gets rid of the family effect, but worsens the
measurement problem
But, S12 S12 may be used as an instrumental variable
Part 7: Regression Extensions [ 56/77]
Part 7: Regression Extensions [ 57/77]
Spatial Autocorrelation
Hypothesis of Spatial
Autocorrelation
Spatial Autoregression
y Wy + Xβ ε.
E[ε|X]=0, Var[ε|X]=2 I
y [I W]1 (Xβ ε)
[I W]1 Xβ [I W]1 ε
E[y|X]=[I W]1 Xβ
Var[y|X ] = 2 [(I W)(I W)]-1
Part 7: Regression Extensions [ 63/77]
Generalized Regression
Potentially very large N – GPS data on
agriculture plots
Estimation of . There is no natural residual
based estimator
Complicated covariance structure – no simple
transformations
Part 7: Regression Extensions [ 64/77]
1
ˆ X (I - W)(I - W) X
β
1
X (I - W)(I - W ) y
1
2
ˆ
1
N
y - Xβ (I - W)(I - W) y - Xβ
ˆ
1
ˆ
ˆ The subject of much research
Part 7: Regression Extensions [ 65/77]
Spatial Autocorrelation in a
Sample Selection Model
Flores-Lagunes, A. and Schnier, K., “Sample Selection and Spatial
Dependence,” Journal of Applied Econometrics, 27, 2, 2012, pp. 173-204.
Spatial Autocorrelation in a
Sample Selection Model
LHS is catch per unit effort = CPUE
Site characteristics: MaxDepth, MinDepth, Biomass
Fleet characteristics:
Catcher vessel (CV = 0/1)
Hook and line (HAL = 0/1)
Nonpelagic trawl gear (NPT = 0/1)
Large (at least 125 feet) (Large = 0/1)
Part 7: Regression Extensions [ 70/77]
Spatial Autocorrelation in a
Sample Selection Model
yi*1 0 xi1 ui1 ui1 j i cij u j1 i1
i1 0 12 12
~ N , 2
, (?? 1 1??)
i 2 0 12 2
Observation Mechanism
yi1 1 yi*1 > 0 Probit Model
yi 2 yi*2 if yi1 = 1, unobserved otherwise.
Part 7: Regression Extensions [ 71/77]
Spatial Autocorrelation in a
Sample Selection Model
u1 Cu1 1
C = Spatial weight matrix, Cii 0.
u1 [I C]1 1 = (1) 1 , likewise for u 2
y 0 xi1 j 1 () , Var[ui1 ] () (1) 2
* N (1) 2 N
i1 ij i1 1 j 1 ij
Cov[u , u ] () ( )
N (1) (2)
i1 i2 12 j 1 ij ij
Part 7: Regression Extensions [ 72/77]
Spatial Weights
1
cij 2 ,
dij
dij Euclidean distance
Band of 7 neighbors is used
Row standardized.
Part 7: Regression Extensions [ 73/77]
Ti 1
ˆ ε to compute FGLS using ˆ
2 2 2 2 2
Then,
ˆ u,i =
ˆi -
ˆ ε . Use
ˆ u,i and i .
"Consistency of the variance estimators requires T and finite N."
Invoking Mazodier and Trognon (1978) and Baltagi and Griffin (1988).
Part 7: Regression Extensions [ 74/77]
Maximum Likelihood
Assuming multivariate normally distributed it
Assuming fixed T > N
ˆ is computed, the MLE
(1) Regardless of how β
ˆ = (1/T) t=1
of Σ is Σ T
ε t εt
(2) In this model, for any given Σ, the MLE of
ˆ GLS
β is by β
(Oberhofer Kmenta (1974)] - iterate back and
ˆ and Σ
forth between β ˆ until convergence. At the
solution.
-NT ˆ|]
logL= [1 log 2 log | Σ
2
Part 7: Regression Extensions [ 76/77]
FGLS
+--------------------------------------------------+
| Groupwise Regression Models |
| Pooled OLS residual variance (SS/nT) .0436 |
| Log-likelihood function = 50.492889 |
+--------------------------------------------------+
+---------+--------------+----------------+--------+---------+
|Variable | Coefficient | Standard Error |b/St.Er.|P[|Z|>z] |
+---------+--------------+----------------+--------+---------+
Constant 2.39132562 .11624845 20.571 .0000
LINCOMEP .88996166 .03559581 25.002 .0000
LRPMG -.89179791 .03013694 -29.592 .0000
LCARPCAP -.76337275 .01849916 -41.265 .0000
+--------------------------------------------------+
| Groupwise Regression Models |
| Test statistics against the correlation |
| Deg.Fr. = 153 C*(.95) = 182.86 C*(.99) = 196.61 |
| Test statistics against the correlation |
| Likelihood ratio statistic = 1010.7643 |
+---------+--------------+----------------+--------+---------+
|Variable | Coefficient | Standard Error |b/St.Er.|P[|Z|>z] |
+---------+--------------+----------------+--------+---------+
Constant 2.11399182 .00962111 219.724 .0000
LINCOMEP .80854298 .00219271 368.741 .0000
LRPMG -.79726940 .00123434 -645.909 .0000
LCARPCAP -.73962381 .00074366 -994.570 .0000