xt
commandsIn Statas language, xt is the way that one naturally refers to CSTS/TSCS data. Consider NT observations on some random variable yit where i∈N and t∈T. The TSCS/CSTS commands almost always have this prefix. \begin{itemize}
Given two-dimensional data, how should we break it down? The most common method is unit-averages; we break each unit's time series on each element into deviations from their own mean. This is called the within transform. The between portion represents deviations between the unit's mean and the overall mean. Stationarity considerations are generically implicit.
Let A be a variance/covariance matrix across panels and B be the same matrix for a given panel. This is a fairly general way to conceive of a panel data problem.
The homoscedastic case is described by σ2I.
The [unit] heteroscedastic case is described, generally, by σ2iIN⊗It (σ21IT0000σ22IT0000⋱0000σ2NIT) The ultimate result will be of dimension NT×NT. The first T entries will be σ21, entries T+1 to 2T will be σ22… and the entries (N−1)T+1 to NT will be σ2N. If we believed that the heteroscedasticity arose from time points rather than units, replace N with T and vice versa; i becomes t.
Φ=σ2Ψ=σ2e(1ρ1ρ2…ρT−1ρ11ρ1…ρT−2ρ2ρ11…ρT−3⋮⋮⋮⋱⋮ρT−1ρT−2ρT−3…1)
given that et=ρet−1+νt. A Toeplitz form....
This allows us to calculate the variance of e using results from basic statistics, i.e. Var(et)=ρ2Var(et−1)+Var(ν). If the variance is stationary, we can rewrite,
σ2e=σ2ν1−ρ2
When discussing heteroscedasticity, we notice that the off-diagonal elements are all zeroes. This is the assumption of no correlation among [somehow] adjacent elements. The somehow takes two forms: (1) spatial and (2) temporal. Just as before where time-induced heteroscedasticity simply involved interchanging N and T and i and t; the same idea prevails here.
In a now-classic paper, Aitken generalized the Gauss-Markov theorem to the class of Generalized Least Squares estimators. It is important to note that these are GLS and not FGLS estimators. What is the difference? The two GLS estimators considered by Stimson are not strictly speaking GLS.
Definition: ˆβGLS=(X′Ω−1X)−1X′Ω−1y
Properties:
We need to estimate things to replace unknown covariance structures and coverage will depend on properties of the estimators of these covariances. Consistent estimators will work but there is euphemistically considerable variation in the class of consistent estimators. Contrasting the Beck and Katz/White approach with the GLS approach is a valid difference in philosophies. NB: We will return to this when we look at Hausman because this is the essential issue.
Beck and Katz take a different tack to the general data types in common use (long T). The basic idea is to generate estimates using OLS because GLS can be quite bad. What do we need to be able to do this?
Every Stata user is familiar with this, it seems. Though not developed by Stata (but Hardin, a student of Huber), the two are synonymous. What would these look like in an application?
Two significant options of note
Most discussions of panel data estimators draw on a fixed versus random effects distinction. The subtle distinction is important but perhaps overstated.
Let's construct a general model: yit=αit+Xitβit+ϵit
αi∼[α,σ2α]
ϵit∼[0,σ2ϵ]
A brief simulation.
N∑i=1T∑t=1(xit−¯x)2=N∑i=1T∑t=1x2it−NT¯x2
N∑i=1T∑t=1x2it−Ti¯xi+Ti¯xi−NT¯x2
N∑i=1T∑t=1(xit−¯xi)2⏟Wi+N∑i=1Ti(¯xi−¯x)2⏟BT
For total pooling, we can F-test 3−11. This is the least and most restricted sets of models. If we can reject this, pooling is (perhaps) justified? Now let's construct some others. Suppose we reject total pooling. Is it intercepts, slopes, or both? Imposing a slope restriction gives us 2, the F we want is 2−11. What do we get from 3−22? NB: It's conditional. We can also do this with time. This is a good starting point, but it is not as clean as we might like.
ˆβOLS=[Stxx]−1Stxy ˆβOLS=[Swxx+Sbxx]−1(Swxy+Sbxy) ˆβOLS=[Swxx+Sbxx]−1Swxy+[Swxx+Sbxx]−1Sbxy
Let Fw=[Swxx+Sbxx]−1Swxx→Fb=I−Fw=[Swxx+Sbxx]−1Sbxx.
My claim is that ˆβOLS=Fwβw+Fbβb.
ˆβOLS=[Swxx+Sbxx]−1Swxx[Swxx]−1⏟ISwxy+[Swxx+Sbxx]−1Sbxx[Sbxx]−1⏟ISbxy ˆβOLS=[Swxx+Sbxx]−1Swxy+[Swxx+Sbxx]−1Sbxy
The basic idea is that the fixed effects estimator is consistent but potentially inefficient. The random effects estimator is only consistent under the null. We can leverage this to form a test in the Hausman family using the result proved in the paper. This is implemented in Stata using model storage capabilities.
The basic idea behind Mundlak's paper is that the fixed versus random effects debate is ill conceived. Moreover, there is a right model. Why and how?
Estimate a variant of the Mundlak model that accommodates all the concerns.
yit=β0+β1W(xit−¯xi)+β2B¯xi+β3zi+(νi+ϵit)
Define Δ to be a difference operator so that we can define ΔX=Xit−Xi,t−1
Δy=yit−yi,t−1
Observation: N(T-1) observations if Ti≥2∀i. Equality case is interesting. The first-difference estimator is then: Δy=β(ΔX)+ϵit
And an OLS estimator would simply look like: ˆβ=(ΔX′ΔX)−1(ΔX′Δy) NB: For T=2 show that FE is FD.
Either transformation removes heterogeneity. The difference is that the two estimators operate at different orders of integration. The difference is not purely convenience; there is substance to this and theory can help. At the same time, the statistics matter.
The fixed effect model is entirely conditional on the sample. If we do not know a unit fixed effect, the predictions are undefined. The random effects model can sample from the distribution of random effects.
xtreg: contains five estimators. For now, we will skip ($\texttt{pa}$).
be: the between effects estimator. ¯yi=¯xi+ϵi
That weight is not in any sense optimally determined, it is a function of the relative ratio of the two quantities (all variance counts the same). As Hsiao (p. 37) points out that the random effects estimator is often known as a quasi-demeaning estimator. This is because it is a partial within transformation.
We will start with the model we defined as random effects before. We defined random effects αi⊥Xit: αi∼[α,σ2α]ϵit∼[0,σ2ϵ]. Consider νit=αi+ϵit.
For a single cross-section (remembering the Kronecker product will help us here) E(νitν′it)=σ2ϵIT+σ2α1T=Ω The inverse is given by Ω−1=1σ2ϵ[IT−σ2ασ2ϵ+Tσ2α1T]
We can also estimate this by using ordinary least squares applied to transformed data. The quasi-demeaning can be done in a first-stage with OLS estimates on the quasi-demeaned data. Recall the pooled regression uses no transformation. The within estimator uses complete demeaning. The random effects estimator is somewhere in between.
Breusch and Pagan (modified by Baltagi and Li) have developed a Lagrange multiplier test of whether or not the random effects have a variance. The test statistic is defined as:
LM=NT2(T−1)[∑N(∑Tϵit)2∑N∑Tϵ2it−1]∼χ21
. xtreg growth lagg opengdp openex openimp leftc central inter, reRandom-effects GLS regression Number of obs = 240Group variable (i): country Number of groups = 16 ----------------------------------------------------------------------------- growth | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+--------------------------------------------------------------- lagg1 | .151848 .0865508 1.75 0.079 -.0177884 .3214843opengdp | .0082889 .0010012 8.28 0.000 .0063267 .0102511 openex | .0019834 .0005903 3.36 0.001 .0008263 .0031404openimp | -.0047988 .0010474 -4.58 0.000 -.0068518 -.0027459 leftc | -.0268801 .0108211 -2.48 0.013 -.048089 -.0056711central | -.7428119 .2547157 -2.92 0.004 -1.242045 -.2435784 inter | .0138935 .0041671 3.33 0.001 .0057261 .0220609 _cons | 3.607517 .571187 6.32 0.000 2.488011 4.727023 -------------+---------------------------------------------------------------sigma_u | .36517121sigma_e | 2.0094449 rho | .03196908 (fraction of variance due to u_i) -----------------------------------------------------------------------------
. xtreg growth lagg1 opengdp, feFixed-effects (within) regression Number of obs = 240Group variable (i): country Number of groups = 16R-sq: within = 0.2562 Obs per group: min = 15 between = 0.0031 avg = 15.0 overall = 0.1563 max = 15 F(2,222) = 38.23corr(u_i, Xb) = -0.3888 Prob > F = 0.0000------------------------------------------------------------------------------ growth | Coef. Std. Err. t P>|t| [95% Conf. Interval]-------------+---------------------------------------------------------------- lagg1 | .2647972 .0851979 3.11 0.002 .0968971 .4326972 opengdp | .0094949 .0011229 8.46 0.000 .007282 .0117078 _cons | .5289261 .3719065 1.42 0.156 -.2039929 1.261845-------------+---------------------------------------------------------------- sigma_u | 1.142546 sigma_e | 2.0889953 rho | .23025918 (fraction of variance due to u_i)------------------------------------------------------------------------------F test that all u_i=0: F(15, 222) = 3.55 Prob > F = 0.0000
. reg Cgrowth Clagg1 Copengdp Source | SS df MS Number of obs = 240-------------+------------------------------ F( 2, 237) = 40.81 Model | 333.650655 2 166.825327 Prob > F = 0.0000Residual | 968.786108 237 4.0877051 R-squared = 0.2562-------------+------------------------------ Adj R-squared = 0.2499 Total | 1302.43676 239 5.4495262 Root MSE = 2.0218----------------------------------------------------------------------------- Cgrowth | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+--------------------------------------------------------------- Clagg1 | .2647972 .0824577 3.21 0.002 .1023536 .4272408Copengdp | .0094949 .0010868 8.74 0.000 .0073539 .0116359 _cons | 1.30e-08 .1305071 0.00 1.000 -.2571021 .2571021------------------------------------------------------------------------------
. by country: egen gmean = mean(growth). by country: egen glmean = mean(lagg1). by country: egen opengdpmean = mean(opengdp). gen yhatb = _b[_cons] + _b[lagg1]*glmean + _b[opengdp]*opengdpmean. reg gmean yhatbSource | SS df MS Number of obs = 240-------------+------------------------------ F( 1, 238) = 0.75Model | .445360906 1 .445360906 Prob > F = 0.3868Residual | 140.975583 238 .592334381 R-squared = 0.0031-------------+------------------------------ Adj R-squared = -0.0010Total | 141.420943 239 .591719429 Root MSE = .76963------------------------------------------------------------------------------ gmean | Coef. Std. Err. t P>|t| [95% Conf. Interval]-------------+---------------------------------------------------------------- yhatb | -.0570801 .0658282 -0.87 0.387 -.1867605 .0726003 _cons | 3.185291 .2044862 15.58 0.000 2.782457 3.588125------------------------------------------------------------------------------
gen yhatT = _b[_cons] + _b[lagg1]*lagg1 + _b[opengdp]*opengdp. fit growth yhatT Source | SS df MS Number of obs = 240-------------+------------------------------ F( 1, 238) = 44.11 Model | 225.744206 1 225.744206 Prob > F = 0.0000Residual | 1218.11349 238 5.11812392 R-squared = 0.1563-------------+------------------------------ Adj R-squared = 0.1528 Total | 1443.8577 239 6.0412456 Root MSE = 2.2623------------------------------------------------------------------------------ growth | Coef. Std. Err. t P>|t| [95% Conf. Interval]-------------+---------------------------------------------------------------- yhatT | .6927893 .1043154 6.64 0.000 .48729 .8982887 _cons | .9257153 .3465985 2.67 0.008 .2429227 1.608508------------------------------------------------------------------------------
Extending this basic logic will hold for all \texttt{xtreg} estimators. Basically, think about them as projecting any given model result to the centered data, to group means, and to all data.
We saw fixed and random effects. The basic idea generalizes to regression coefficients on variables that are not unit-specific factors/indicators.
yit=α+(¯β+μi)Xit+ϵit E[αi]=0;E[αiXit]=0 E[αiαj]={Δif i=j0if i≠j
Hsiao and Pesaran (2004, IZA DP 136) show that the GLS estimator is a matrix weighted average of the OLS estimator applied to each unit separately with weights inversely proportional to the covariance matrix for the unit.
xtrc estimates the Swamy random coefficients model and provides us with a test statistic of parameter constancy. If the statistic is significantly different from zero, parameter constancy is rejected. Option betas gives us the unit-specifics. We have vce options here also.
Note, as with many xt commands, the jackknife is unit-based.
Stata has a mixed effects module that we can use for some things we have already seen and for extensions. I should say in passing that this also works for dimensions with nesting properties, though we are looking at two-dimensional data structures.
. sum Variable | Obs Mean Std. Dev. Min Max-------------+-------------------------------------------------------- year | 240 1977 4.329523 1970 1984 country | 240 8.5 4.619406 1 16 growth | 240 3.013292 2.457895 -3.6 9.8 lagg1 | 240 3.119855 1.652682 -2.40641 6.683519 opengdp | 240 174.6452 146.2456 -32.1 736.02 ----------+-------------------------------------------------------- openex | 240 489.7662 420.4374 30.94 2879.2 openimp | 240 482.8254 267.6722 64.96 1415.2 leftc | 240 34.79583 39.56008 0 100 central | 240 2.02421 .9593759 .4054115 3.618419 inter | 240 91.33376 117.5622 0 361.8419
. xtreg growth lagg1 opengdp openimp openex leftc, reRandom-effects GLS regression Number of obs = 240Group variable (i): country Number of groups = 16R-sq: within = 0.2960 Obs per group: min = 15 between = 0.2038 avg = 15.0 overall = 0.2811 max = 15Random effects u_i ~ Gaussian Wald chi2(5) = 92.41corr(u_i, X) = 0 (assumed) Prob > chi2 = 0.0000------------------------------------------------------------------------------ growth | Coef. Std. Err. z P>|z| [95% Conf. Interval]-------------+---------------------------------------------------------------- lagg1 | .2194248 .0875581 2.51 0.012 .0478142 .3910355 opengdp | .0077965 .0009824 7.94 0.000 .005871 .0097219 openimp | -.0053695 .0009868 -5.44 0.000 -.0073035 -.0034355 openex | .0019647 .0006047 3.25 0.001 .0007796 .0031498 leftc | .0030365 .0036142 0.84 0.401 -.0040472 .0101202 _cons | 2.491734 .4633904 5.38 0.000 1.583505 3.399962-------------+---------------------------------------------------------------- sigma_u | .21759529 sigma_e | 2.0364407 rho | .01128821 (fraction of variance due to u_i)------------------------------------------------------------------------------
. xtreg growth lagg1 opengdp openimp openex leftc, mleRandom-effects ML regression Number of obs = 240Group variable (i): country Number of groups = 16Random effects u_i ~ Gaussian Obs per group: min = 15LR chi2(5) = 81.33Log likelihood = -514.4714 Prob > chi2 = 0.0000------------------------------------------------------------------------------ growth | Coef. Std. Err. z P>|z| [95% Conf. Interval]-------------+---------------------------------------------------------------- lagg1 | .1873509 .0881362 2.13 0.034 .014607 .3600947 opengdp | .0077706 .0009913 7.84 0.000 .0058276 .0097136 openimp | -.0055243 .0010506 -5.26 0.000 -.0075835 -.0034651 openex | .0020447 .0005936 3.44 0.001 .0008812 .0032082 leftc | .0044378 .0039745 1.12 0.264 -.0033521 .0122277 _cons | 2.583146 .5204807 4.96 0.000 1.563022 3.603269 -------------+---------------------------------------------------------------- /sigma_u | .5100119 .1962033 .2399497 1.084028 /sigma_e | 2.018389 .0957214 1.839233 2.214995 rho | .0600166 .0445522 .0110832 .2056057------------------------------------------------------------------------------Likelihood-ratio test of sigma_u=0: chibar2(01)= 3.56 Prob>=chibar2 = 0.030
. xtmixed growth lagg1 opengdp openimp openex leftc || R.country, mle Mixed-effects ML regression Number of obs = 240 Group variable: _all Number of groups = 1 Wald chi2(5) = 97.44 Log likelihood = -514.4714 Prob > chi2 = 0.0000------------------------------------------------------------------------------ growth | Coef. Std. Err. z P>|z| [95% Conf. Interval]-------------+---------------------------------------------------------------- lagg1 | .1873501 .0859494 2.18 0.029 .0188925 .3558078 opengdp | .0077706 .0009911 7.84 0.000 .0058281 .009713 openimp | -.0055243 .0010452 -5.29 0.000 -.0075729 -.0034757 openex | .0020447 .0005915 3.46 0.001 .0008854 .0032039 leftc | .0044378 .0038479 1.15 0.249 -.003104 .0119796 _cons | 2.583148 .5173579 4.99 0.000 1.569145 3.597151------------------------------------------------------------------------------------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval]-----------------------------+------------------------------------------------ _all: Identity | sd(R.country) | .5100191 .1962046 .2399545 1.084037-----------------------------+------------------------------------------------ sd(Residual) | 2.018388 .0957229 1.83923 2.214997------------------------------------------------------------------------------LR test vs. linear regression: chibar2(01) = 3.56 Prob >= chibar2 = 0.0296
For virtually all Stata commands, we can acquire multiple variance/covariance matrices of the parameters.
Will allow us to do tons of things. In particular, we can play with the residual correlation matrix using the option residuals. One can recreate virtually everything that we have seen so far this way. The remaining task for you in the lab is to figure out what all you can make it do.
Mixed effects models will allow us to estimate many interesting models for \texttt{xt} data.
For the simple random effects estimator, there are two ways to do it via ML.
. xtreg growth lagg1 opengdp openimp openex leftc, mleLR chi2(5) = 81.33Log likelihood = -514.4714 Prob > chi2 = 0.0000------------------------------------------------------------------------------ growth | Coef. Std. Err. z P>|z| [95% Conf. Interval]-------------+---------------------------------------------------------------- lagg1 | .1873509 .0881362 2.13 0.034 .014607 .3600947 opengdp | .0077706 .0009913 7.84 0.000 .0058276 .0097136 openimp | -.0055243 .0010506 -5.26 0.000 -.0075835 -.0034651 openex | .0020447 .0005936 3.44 0.001 .0008812 .0032082 leftc | .0044378 .0039745 1.12 0.264 -.0033521 .0122277 _cons | 2.583146 .5204807 4.96 0.000 1.563022 3.603269-------------+---------------------------------------------------------------- /sigma_u | .5100119 .1962033 .2399497 1.084028 /sigma_e | 2.018389 .0957214 1.839233 2.214995 rho | .0600166 .0445522 .0110832 .2056057------------------------------------------------------------------------------Likelihood-ratio test of sigma_u=0: chibar2(01)= 3.56 Prob>=chibar2 = 0.030. xtmixed growth lagg1 opengdp openimp openex leftc || _all: R.country, mle Wald chi2(5) = 97.44 Log likelihood = -514.4714 Prob > chi2 = 0.0000------------------------------------------------------------------------------ growth | Coef. Std. Err. z P>|z| [95% Conf. Interval]-------------+---------------------------------------------------------------- lagg1 | .1873501 .0859494 2.18 0.029 .0188925 .3558078 opengdp | .0077706 .0009911 7.84 0.000 .0058281 .009713 openimp | -.0055243 .0010452 -5.29 0.000 -.0075729 -.0034757 openex | .0020447 .0005915 3.46 0.001 .0008854 .0032039 leftc | .0044378 .0038479 1.15 0.249 -.003104 .0119796 _cons | 2.583148 .5173579 4.99 0.000 1.569145 3.597151------------------------------------------------------------------------------------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ _all: Identity | sd(R.country) | .5100191 .1962046 .2399545 1.084037 -----------------------------+------------------------------------------------ sd(Residual) | 2.018388 .0957229 1.83923 2.214997 ------------------------------------------------------------------------------LR test vs. linear regression: chibar2(01) = 3.56 Prob >= chibar2 = 0.0296
Mixed-effects ML regression Number of obs = 240Group variable: _all Number of groups = 1Obs per group: min = 240 avg = 240.0 max = 240Wald chi2(5) = 7.18Log likelihood = -503.45468 Prob > chi2 = 0.2076------------------------------------------------------------------------------ growth | Coef. Std. Err. z P>|z| [95% Conf. Interval]-------------+---------------------------------------------------------------- lagg1 | .0059048 .1296512 0.05 0.964 -.2482069 .2600164 opengdp | .0001904 .0016087 0.12 0.906 -.0029626 .0033433 openimp | -.0030722 .0015617 -1.97 0.049 -.006133 -.0000114 openex | .002307 .0010185 2.27 0.024 .0003108 .0043032 leftc | .0048234 .0036133 1.33 0.182 -.0022585 .0119053 _cons | 3.147245 .7630121 4.12 0.000 1.651768 4.642721------------------------------------------------------------------------------------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval]-----------------------------+------------------------------------------------ _all: Identity | sd(R.country) | .6667379 .1900389 .3813634 1.165658 -----------------------------+------------------------------------------------ _all: Identity | sd(R.year) | 1.554459 .4033566 .9347738 2.58495 -----------------------------+------------------------------------------------ sd(Residual) | 1.752177 .0885389 1.586961 1.934595 ------------------------------------------------------------------------------LR test vs. linear regression: chi2(2) = 25.59 Prob > chi2 = 0.0000Note: LR test is conservative and provided only for reference . estimates store MLEtwowayRE
. lrtest MLEtwowayRE MLEunitRE Likelihood-ratio test LR chibar2(01) = 22.03 (Assumption: MLEunitRE nested in MLEtwowayRE) Prob > chibar2 = 0.0000 . qui xtmixed growth lagg1 opengdp openimp openex leftc || _all: R.year, mle . lrtest MLEtwowayRE . Likelihood-ratio test LR chibar2(01) = 10.04 (Assumption: . nested in MLEtwowayRE) Prob > chibar2 = 0.0008
. xtmixed growth lagg1 opengdp openimp openex leftc || country: leftc, covariance(unstructured)Performing EM optimization: Performing gradient-based optimization: Iteration 0: log restricted-likelihood = -540.17955 Iteration 1: log restricted-likelihood = -540.15493 Iteration 2: log restricted-likelihood = -540.15472 Iteration 3: log restricted-likelihood = -540.15472 Computing standard errors: Mixed-effects REML regression Number of obs = 240 Group variable: country Number of groups = 16 Obs per group: min = 15 avg = 15.0 max = 15 Wald chi2(5) = 95.70 Log restricted-likelihood = -540.15472 Prob > chi2 = 0.0000------------------------------------------------------------------------------ growth | Coef. Std. Err. z P>|z| [95% Conf. Interval]-------------+---------------------------------------------------------------- lagg1 | .170562 .0869219 1.96 0.050 .0001982 .3409259 opengdp | .0078608 .0010053 7.82 0.000 .0058905 .0098312 openimp | -.0055371 .0010763 -5.14 0.000 -.0076465 -.0034277 openex | .0020745 .0005967 3.48 0.001 .0009051 .0032439 leftc | .0039332 .0046265 0.85 0.395 -.0051346 .013001 _cons | 2.570449 .5444497 4.72 0.000 1.503347 3.637551------------------------------------------------------------------------------------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval]-----------------------------+------------------------------------------------ country: Unstructured | sd(leftc) | .0089451 .0078813 .0015908 .0502989 sd(_cons) | .6566839 .2658791 .2969756 1.452085 corr(leftc,_cons) | -.6168731 .5300418 -.9835763 .7429732-----------------------------+------------------------------------------------ sd(Residual) | 2.022226 .098202 1.83863 2.224156 ------------------------------------------------------------------------------LR test vs. linear regression: chi2(3) = 5.40 Prob > chi2 = 0.1445Note: LR test is conservative and provided only for reference . * The coefficient is insignificant as is the randomness
. estat recovarianceRandom-effects covariance matrix for level country | leftc _cons -------------+---------------------- leftc | .00008 _cons | -.0036236 .4312338 . capture drop u1 u2 . predict u*, reffects
. by country, sort: sum u*--------------------------------------------------------------------------------------------------------------- -> country = AULVariable | Obs Mean Std. Dev. Min Max-------------+-------------------------------------------------------- u1 | 15 -.0006591 0 -.0006591 -.0006591 u2 | 15 .1237475 0 .1237475 .1237475 -> country = AUS u1 | 15 .0005591 0 .0005591 .0005591 u2 | 15 .0125652 0 .0125652 .0125652 -> country = BEL u1 | 15 -.0000316 0 -.0000316 -.0000316 u2 | 15 -.0002924 0 -.0002924 -.0002924 -> country = CAN u1 | 15 -.0035756 0 -.0035756 -.0035756 u2 | 15 .4255248 0 .4255248 .4255248 -> country = DEN u1 | 15 .0019625 0 .0019625 .0019625 u2 | 15 -.462575 0 -.462575 -.462575 -> country = FIN u1 | 15 .003543 0 .003543 .003543 u2 | 15 .1606634 0 .1606634 .1606634 -> country = FRA u1 | 15 -.0083416 0 -.0083416 -.0083416 u2 | 15 .3128709 0 .3128709 .3128709 -> country = GER u1 | 15 .0011514 0 .0011514 .0011514 u2 | 15 -.3119804 0 -.3119804 -.3119804 -> country = IRE u1 | 15 -.0021854 0 -.0021854 -.0021854 u2 | 15 .3908045 0 .3908045 .3908045 -> country = ITA u1 | 15 .0002358 0 .0002358 .0002358 u2 | 15 -.1705837 0 -.1705837 -.1705837 -> country = JAP u1 | 15 -.0090248 0 -.0090248 -.0090248 u2 | 15 1.074025 0 1.074025 1.074025 -> country = NET u1 | 15 .0031352 0 .0031352 .0031352 u2 | 15 -.2520462 0 -.2520462 -.2520462 -> country = NOR u1 | 15 .0088704 0 .0088704 .0088704 u2 | 15 .0223926 0 .0223926 .0223926 -> country = SWE u1 | 15 .002398 0 .002398 .002398 u2 | 15 -.5351107 0 -.5351107 -.5351107 -> country = UK u1 | 15 .000085 0 .000085 .000085 u2 | 15 -.5665398 0 -.5665398 -.5665398 -> country = USA u1 | 15 .0018777 0 .0018777 .0018777 u2 | 15 -.2234658 0 -.2234658 -.2234658
Does it matter?
Table 3
Table 4
What do we do? Raise the bar for positive findings and look at multiple models trying to tease out the role of particular assumptions as necessary and/or sufficient for results.
. xttest0 Breusch and Pagan Lagrangian multiplier test for random effects: growth[country,t] = Xb + u[country] + e[country,t] Estimated results: | Var sd = sqrt(Var) ---------+----------------------------- growth | 6.041246 2.457895 e | 4.147091 2.036441 u | .0473477 .2175953 Test: Var(u) = 0 chi2(1) = 4.39 Prob > chi2 = 0.0361
. xttest1Tests for the error component model: growth[country,t] = Xb + u[country] + v[country,t] v[country,t] = rho v[country,(t-1)] + e[country,t] Estimated results: Var sd = sqrt(Var) ---------+----------------------------- growth | 6.041246 2.457895 e | 4.037869 2.0094449 u | .13335 .36517121 Tests: Random Effects, Two Sided: LM(Var(u)=0) = 1.00 Pr>chi2(1) = 0.3174 ALM(Var(u)=0) = 0.54 Pr>chi2(1) = 0.4610 Random Effects, One Sided: LM(Var(u)=0) = 1.00 Pr>N(0,1) = 0.1587 ALM(Var(u)=0) = 0.74 Pr>N(0,1) = 0.2305 Serial Correlation: LM(rho=0) = 0.74 Pr>chi2(1) = 0.3906 ALM(rho=0) = 0.28 Pr>chi2(1) = 0.5961 Joint Test: LM(Var(u)=0,rho=0) = 1.28 Pr>chi2(2) = 0.5271 * We cannot reject the null hypothesis of no variation in the random effects. Also no evidence of serial correlation. Remember, with the lagged endogenous variable on the right hand side, the random effects are included if they are there.
After fe or xtgls, we have two tests pre-programmed.
Wooldridge presents a test for serial correlation.
How do we test for cross-sectional dependence?
Driscoll and Kraay (1998) describe a robust covariance matrix estimator for pooled and fixed effects regression models that contain a large time dimension. The approach is robust to heteroscedasticity, autocorrelation, and spatial correlation.
There are limitation imposed by what people have programmed in terms of regression diagnostics. However, if we can fit the same model by OLS, we can use standard regression diagnostics post-estimation to avoid calculating the diagnostics by hand. Many diagnostics are pre-programmed.
Levin-Lin-Chu ( xtunitroot llc ): trend nocons (unit specific) demean (within transform) lags. Under (crucial) cross-sectional independence, the test is an advancement on the generic Dickey-Fuller theory that allows the lag lengths to vary by cross-sections. The test relies on specifying a kernel (beyond our purposes) and a lag length (upper bound). The test statistic has a standard normal basis with asymptotics in √NTT ( T grows faster than N ). The test is of either all series containing unit roots ( H0 ) or all stationary; this is a limitation. It is recommended for moderate to large T and N.
Perform separate ADF regressions: Δyit=ρiΔyi,t−1+pi∑L=1θiLΔyi,t=L+αmidmt+ϵit with dmt as the vector of deterministic variables (none, drift, drift and trend). Select a max L and use t on ˆθiL to attempt to simplify. Then use Δyit=Δyi,t−L and dmt for residuals
Harris-Tzavalis ( xtunitroot ht ): trend nocons (unit specific) demean (within transform) altt (small sample adjust) Similar to the previous, they show that T→∞ faster than N (rather than T fixed) leads to size distortions.
Breitung ( xtunitroot breitung ): trend nocons (unit specific) demean (within transform) robust (CSD) lags. Similar to LLC with a common statistic across all i.
Im, Pesaran, Shin ( xtunitroot ips ): trend demean (within transform) lags. They free ρ to be ρi and average individual unit root statistics. The null is that all contain unit roots while the alternative specifies at least some to be stationary. The test relies on sequential asymptotics (first T, then N). Better in small samples than LLC, but note the differences in the alternatives.
Fisher type tests ( xtunitroot fisher ): dfuller pperron demean lags.
Hadri (LM) ( xtunitroot hadri ): trend demean robust
All but the last are null hypothesis unit-root tests. Most assume balance but the fisher and IPS versions can work for unbalanced panels.
We can consider some very basic time series models.
yit=Xitβ+ϵit where ϵit=ρϵi,t−1+νit and νit∼N(0,σ2ν) with stationarity forcing |ρ|<1. We will use iterated FGLS.
In general, the transformed regression is: yit−ρyi,t−1=α(1−ρ)+β(Xit−ρXi,t−1)+νit with ν white noise.
Static model: Instantaneous impact. yi,t=Xi,tβ+νi,t
Finite distributed lag: lags of x finite horizon impact (defined by lags). yi,t=Xi,tβ+K∑k=1Xi,t−kβk+νi,t
AR(1): Errors decay geometrically, X instantaneous. (Suppose unmeasured x and think this through). yi,t=Xi,tβ+νi,t+θϵi,t−1
Lagged dependent variable: lags of y [common geometric decay] yi,t=Xi,tβ+ϕyi,t−1+νi,t
ADL: current and lagged x and lagged y. yi,t=Xi,tβ+Xi,t−1γ+ϕyi,t−1+ϵi,t
yit=α+γyi,t−1+Xitβ+ϵit yit=α+γ[α+γyi,t−2+Xi,t−1β+ϵi,t−1]+Xitβ+ϵit yit=α+γ[α+γ(α+γyi,t−3+Xi,t−2β+ϵit)+Xi,t−1β+ϵi,t−1]+Xitβ+ϵit
We can continue substituting through to conclude that we have a geometrically decaying impact so that the long-run effect of a one-unit change in X is β1−γ
But γ has uncertainty, it is an estimate. To show the realistic long-run impact, we need to incorporate that uncertainty.
Keyboard shortcuts
↑, ←, Pg Up, k | Go to previous slide |
↓, →, Pg Dn, Space, j | Go to next slide |
Home | Go to first slide |
End | Go to last slide |
Number + Return | Go to specific slide |
b / m / f | Toggle blackout / mirrored / fullscreen mode |
c | Clone slideshow |
p | Toggle presenter mode |
t | Restart the presentation timer |
?, h | Toggle this help |
Esc | Back to slideshow |