Professional Documents
Culture Documents
April 8, 2008
A. Colin Cameron
Univ. of California - Davis (Based Panel methods for Stata Pravin K. Trivedi, Microeconometrics using Stata, Sta on A. Colin Cameron and April 8, 2008 1 / 55
1. Introduction
Panel data are repeated measures on individuals (i ) over time (t ). Regress yit on xit for i = 1, ..., N and t = 1, ..., T . Complications compared to cross-section data:
1
Inference: correct (inate) standard errors. This is because each additional year of data is not independent of previous years. Modelling: richer models and estimation methods are possible with repeated measures. Fixed eects and dynamic models are examples. Methodology: dierent areas of applied statistics may apply dierent methods to the same panel data set.
A. Colin Cameron
Univ. of California - Davis (Based Panel methods for Stata Pravin K. Trivedi, Microeconometrics using Stata, Sta on A. Colin Cameron and April 8, 2008 2 / 55
This talk: overview of panel data methods and xt commands for Stata 10 most commonly used by microeconometricians. Three specializations to general panel methods:
1
Short panel: data on many individual units and few time periods. Then data viewed as clustered on the individual unit. Many panel methods also apply to clustered data such as cross-section individual-level surveys clustered at the village level. Causation from observational data: use repeated measures to estimate key marginal eects that are causative rather than mere correlation. Fixed eects: assume time-invariant individual-specic eects. IV: use data from other periods as instruments. Dynamic models: regressors include lagged dependent variables.
A. Colin Cameron
Univ. of California - Davis (Based Panel methods for Stata Pravin K. Trivedi, Microeconometrics using Stata, Sta on A. Colin Cameron and April 8, 2008 3 / 55
Outline
1 2 3 4 5 6 7 8 9 10 11 12
Introduction Data example: wages Linear models overview Standard linear short panel estimators Long panels Linear panel IV estimators Linear dynamic models Mixed linear models Clustered data Nonlinear panel models overview Nonlinear panel models estimators Conclusions
A. Colin Cameron
Univ. of California - Davis (Based Panel methods for Stata Pravin K. Trivedi, Microeconometrics using Stata, Sta on A. Colin Cameron and April 8, 2008 4 / 55
PSID wage data 1976-82 on 595 individuals. Balanced. Source: Baltagi and Khanti-Akom (1990). [Corrected version of Cornwell and Rupert (1998).] Goal: estimate causative eect of education on wages. Complication: education is time-invariant in these data. Rules out xed eects. Need to use IV methods (Hausman-Taylor).
A. Colin Cameron
Univ. of California - Davis (Based Panel methods for Stata Pravin K. Trivedi, Microeconometrics using Stata, Sta on A. Colin Cameron and April 8, 2008 5 / 55
. * Read in data set . use mus08psidextract.dta, clear (PSID wage data 1976-82 from Baltagi and Khanti-Akom (1990))
A. Colin Cameron
Univ. of California - Davis (Based Panel methods for Stata Pravin K. Trivedi, Microeconometrics using Stata, Sta on A. Colin Cameron and April 8, 2008 6 / 55
PSID wage data 1976-82 from Baltagi an 16 Aug 2007 16:29 (_dta has notes) variable label
years of full-time work experience weeks worked occupation; occ==1 if in a blue-collar industry; ind==1 if working in a manuf residence; south==1 if in the South ar smsa==1 if in the Standard metropolita marital status female or male if wage set be a union contract years of education black log wage
A. Colin Cameron
Univ. of California - Davis (Based Panel methods for Stata Pravin K. Trivedi, Microeconometrics using Stata, Sta on A. Colin Cameron and April 8, 2008 7 / 55
. * Summarize dataset . summarize Variable exp wks occ ind south smsa ms fem union ed blk lwage id t exp2 Obs 4165 4165 4165 4165 4165 4165 4165 4165 4165 4165 4165 4165 4165 4165 4165 Mean 19.85378 46.81152 .5111645 .3954382 .2902761 .6537815 .8144058 .112605 .3639856 12.84538 .0722689 6.676346 298 4 514.405 Std. Dev. 10.96637 5.129098 .4999354 .4890033 .4539442 .475821 .3888256 .3161473 .4812023 2.787995 .2589637 .4615122 171.7821 2.00024 496.9962 Min 1 5 0 0 0 0 0 0 0 4 0 4.60517 1 1 1 Max 51 52 1 1 1 1 1 1 1 17 1 8.537 595 7 2601
595 = 4165.
A. Colin Cameron
Univ. of California - Davis (Based Panel methods for Stata Pravin K. Trivedi, Microeconometrics using Stata, Sta on A. Colin Cameron and April 8, 2008 8 / 55
. * Organization of data set . list id t exp wks occ in 1/3, clean 1. 2. 3. id 1 1 1 t 1 2 3 exp 3 4 5 wks 32 43 40 occ 0 0 0
A. Colin Cameron
Univ. of California - Davis (Based Panel methods for Stata Pravin K. Trivedi, Microeconometrics using Stata, Sta on A. Colin Cameron and April 8, 2008 9 / 55
xtset command denes i and t. Allows use of panel commands and some time series operators
. * Declare individual identifier and time identifier . xtset id t panel variable: id (strongly balanced) time variable: t, 1 to 7 delta: 1 unit
A. Colin Cameron
Univ. of California - Davis (Based Panel methods for Stata Pravin K. Trivedi, Microeconometrics using 10 / 55 on A. Colin Cameron and April 8, 2008 Stata, Sta
. * Panel description of data set . xtdescribe id: t: 1, 2, ..., 595 1, 2, ..., 7 Delta(t) = 1 unit Span(t) = 7 periods (id*t uniquely identifies each observation) min 7 Cum. 100.00 5% 7 Pattern 1111111 XXXXXXX 25% 7 50% 7 n = T = 595 7
75% 7
95% 7
max 7
Data are balanced with every individual i having 7 time periods of data.
A. Colin Cameron
Univ. of California - Davis (Based Panel methods for Stata Pravin K. Trivedi, Microeconometrics using 11 / 55 on A. Colin Cameron and April 8, 2008 Stata, Sta
. * Panel summary statistics: within and between variation . xtsum lwage exp ed t Variable lwage overall between within overall between within overall between within overall between within Mean 6.676346 Std. Dev. .4615122 .3942387 .2404023 10.96637 10.79018 2.00024 2.787995 2.790006 0 2.00024 0 2.00024 Min 4.60517 5.3364 4.781808 1 4 16.85378 4 4 12.84538 1 4 1 Max 8.537 7.813596 8.621092 51 48 22.85378 17 17 12.84538 7 4 7 Observations N = n = T = N = n = T = N = n = T = N = n = T = 4165 595 7 4165 595 7 4165 595 7 4165 595 7
exp
19.85378
ed
12.84538
For time-invariant variable ed the within variation is zero. For individual-invariant variable t the between variation is zero. For lwage the within variation < between variation.
A. Colin Cameron
Univ. of California - Davis (Based Panel methods for Stata Pravin K. Trivedi, Microeconometrics using 12 / 55 on A. Colin Cameron and April 8, 2008 Stata, Sta
. * Panel tabulation for a variable . xttab south south 0 1 Total Overall Freq. Percent 2956 1209 4165 70.97 29.03 100.00 Between Freq. Percent 428 182 610 (n = 595) 71.93 30.59 102.52 Within Percent 98.66 94.90 97.54
29.03% on average were in the south. 20.59% were ever in the south. 94.9% of those ever in the south were always in the south.
A. Colin Cameron
Univ. of California - Davis (Based Panel methods for Stata Pravin K. Trivedi, Microeconometrics using 13 / 55 on A. Colin Cameron and April 8, 2008 Stata, Sta
. * Transition probabilities for a variable . xttrans south, freq residence; south==1 if in the South area 0 1 Total residence; south==1 if in the South area 0 1 2,527 99.68 8 0.77 2,535 71.01 8 0.32 1,027 99.23 1,035 28.99
For the 28.99% of the sample ever in the south, 99.23% remained in the south the next period.
A. Colin Cameron
Univ. of California - Davis (Based Panel methods for Stata Pravin K. Trivedi, Microeconometrics using 14 / 55 on A. Colin Cameron and April 8, 2008 Stata, Sta
. .
* Time series plots of log wage for first 10 individuals xtline lwage if id<=10, overlay
7.5 5.5 6 log wage 6.5 7
2 id = 1 id = 3 id = 5 id = 7 id = 9
4 t id = 2 id = 4 id = 6 id = 8 id = 10
A. Colin Cameron
Univ. of California - Davis (Based Panel methods for Stata Pravin K. Trivedi, Microeconometrics using 15 / 55 on A. Colin Cameron and April 8, 2008 Stata, Sta
. * First-order autocorrelation in a variable . sort id t . correlate lwage L.lwage L2.lwage L3.lwage L4.lwage L5.lwage L6.lwage (obs=595) lwage lwage --. L1. L2. L3. L4. L5. L6. 1.0000 0.9238 0.9083 0.8753 0.8471 0.8261 0.8033 L. lwage L2. lwage L3. lwage L4. lwage L5. lwage L6. lwage
1.0000 0.9418
1.0000
High serial correlation: Cor[yt , yt 6 ] = 0.80. Can also estimate correlations without imposing stationarity.
A. Colin Cameron
Univ. of California - Davis (Based Panel methods for Stata Pravin K. Trivedi, Microeconometrics using 16 / 55 on A. Colin Cameron and April 8, 2008 Stata, Sta
Commands describe, summarize and tabulate confound cross-section and time series variation. Instead use specialized panel commands after xtset:
xtdescribe: extent to which panel is unbalanced xtsum: separate within (over time) and between (over individuals) variation xttab: tabulations within and between for discrete data e.g. binary xttrans: transition frequencies for discrete data xtline: time series plot for each individual on one chart xtdata: scatterplots for within and between variation.
A. Colin Cameron
Univ. of California - Davis (Based Panel methods for Stata Pravin K. Trivedi, Microeconometrics using 17 / 55 on A. Colin Cameron and April 8, 2008 Stata, Sta
. * Pooled OLS with incorrect default standard errors . regress lwage exp exp2 wks ed, noheader lwage exp exp2 wks ed _cons Coef. .044675 -.0007156 .005827 .0760407 4.907961 Std. Err. .0023929 .0000528 .0011827 .0022266 .0673297 t 18.67 -13.56 4.93 34.15 72.89 P>|t| 0.000 0.000 0.000 0.000 0.000 [95% Conf. Interval] .0399838 -.0008191 .0035084 .0716754 4.775959 .0493663 -.0006121 .0081456 .080406 5.039963
The default standard errors erroneously assume errors are independent over i for given t. Assumes more information content from data then is the case.
A. Colin Cameron
Univ. of California - Davis (Based Panel methods for Stata Pravin K. Trivedi, Microeconometrics using 18 / 55 on A. Colin Cameron and April 8, 2008 Stata, Sta
. * Pooled OLS with cluster-robust standard errors . regress lwage exp exp2 wks ed, noheader vce(cluster id) (Std. Err. adjusted for 595 clusters in id) lwage exp exp2 wks ed _cons Coef. .044675 -.0007156 .005827 .0760407 4.907961 Robust Std. Err. .0054385 .0001285 .0019284 .0052122 .1399887 t 8.21 -5.57 3.02 14.59 35.06 P>|t| 0.000 0.000 0.003 0.000 0.000 [95% Conf. Interval] .0339941 -.0009679 .0020396 .0658042 4.633028 .055356 -.0004633 .0096144 .0862772 5.182894
Cluster-robust standard errors are twice as large as default. Cluster-robust t-statistics are half as large as default. Typical result. Need to use cluster-robust se if use pooled OLS. s
A. Colin Cameron
Univ. of California - Davis (Based Panel methods for Stata Pravin K. Trivedi, Microeconometrics using 19 / 55 on A. Colin Cameron and April 8, 2008 Stata, Sta
6 7
Regular time intervals assumed. Unbalanced panel okay (xt commands handle unbalanced data). [Should then rule out selection/attrition bias]. Short panel assumed, with T small and N ! . [Versus long panels, with T ! and N small or N ! .] Errors are correlated. [For short panel: correlated over t for given i, but not over i.] Parameters may vary over individuals or time. Intercept: Individual-specic eects model (xed or random eects). Slopes: Pooling and random coe cients models. Regressors: time-invariant, individual-invariant, or vary over both. Prediction: ignored. [Not always possible even if marginal eects computed.] Dynamic models: possible. [Usually static models are estimated.]
A. Colin Cameron
Univ. of California - Davis (Based Panel methods for Stata Pravin K. Trivedi, Microeconometrics using 20 / 55 on A. Colin Cameron and April 8, 2008 Stata, Sta
(1)
(2)
(3)
where i may be xed eect or random eect. Mixed model or random coe cients model allows slopes to vary over i 0 yit = i + xit i + it . (4)
A. Colin Cameron
Univ. of California - Davis (Based Panel methods for Stata Pravin K. Trivedi, Microeconometrics using 21 / 55 on A. Colin Cameron and April 8, 2008 Stata, Sta
Univ. of California - Davis (Based Panel methods for Stata Pravin K. Trivedi, Microeconometrics using 22 / 55 on A. Colin Cameron and April 8, 2008 Stata, Sta
Many methods assume it and i (if present) are iid. Yields wrong standard errors if heteroskedasticity or if errors not equicorrelated over time for a given individual. For short panel can relax and use cluster-robust inference.
Allows heteroskedasticity and general correlation over time for given i. Independence over i is still assumed.
For xtreg use option vce(robust) does cluster-robust For some other xt commands use option vce(cluster) And for some other xt commands there is no option but may be able to do a cluster bootstrap.
A. Colin Cameron
Univ. of California - Davis (Based Panel methods for Stata Pravin K. Trivedi, Microeconometrics using 23 / 55 on A. Colin Cameron and April 8, 2008 Stata, Sta
. * Pooled FGLS estimator with AR(2) error & cluster-robust ses . xtgee lwage exp exp2 wks ed, corr(ar 2) vce(robust)
A. Colin Cameron
Univ. of California - Davis (Based Panel methods for Stata Pravin K. Trivedi, Microeconometrics using 24 / 55 on A. Colin Cameron and April 8, 2008 Stata, Sta
. .
* Between estimator with default standard errors xtreg lwage exp exp2 wks ed, be
A. Colin Cameron
Univ. of California - Davis (Based Panel methods for Stata Pravin K. Trivedi, Microeconometrics using 25 / 55 on A. Colin Cameron and April 8, 2008 Stata, Sta
FGLS in RE model assuming i iid (0, 2 ) and i iid (0, 2 ). Equals OLS of (yit bi yi ) on (xit p i = 1 2 / ( Ti 2 + 2 ) . . . bi xi );
* Random effects estimator with cluster-robust ses xtreg lwage exp exp2 wks ed, re vce(robust) theta
Univ. of California - Davis (Based Panel methods for Stata Pravin K. Trivedi, Microeconometrics using 26 / 55 on A. Colin Cameron and April 8, 2008 Stata, Sta
yi ) on (xit
xi ).
. .
* Within or FE estimator with cluster-robust ses xtreg lwage exp exp2 wks ed, fe vce(robust)
A. Colin Cameron
Univ. of California - Davis (Based Panel methods for Stata Pravin K. Trivedi, Microeconometrics using 27 / 55 on A. Colin Cameron and April 8, 2008 Stata, Sta
yi ,t
1)
on (xit
xi ,t
1 ).
. .
* First difference estimator with cluster-robust ses regress D.(lwage $xlist), vce(cluster id)
A. Colin Cameron
Univ. of California - Davis (Based Panel methods for Stata Pravin K. Trivedi, Microeconometrics using 28 / 55 on A. Colin Cameron and April 8, 2008 Stata, Sta
A. Colin Cameron
Univ. of California - Davis (Based Panel methods for Stata Pravin K. Trivedi, Microeconometrics using 29 / 55 on A. Colin Cameron and April 8, 2008 Stata, Sta
OLS 0.0447 0.0054 -0.0007 0.0001 0.0058 0.0019 0.0760 0.0052 4.9080 0.1400 4165.0000
PFGLS 0.0719 0.0040 -0.0009 0.0001 0.0003 0.0011 0.0905 0.0060 4.5264 0.1057 4165.0000
BE 0.0382 0.0057 -0.0006 0.0001 0.0131 0.0041 0.0738 0.0049 4.6830 0.2101 4165.0000
RE 0.0889 0.0029 -0.0008 0.0001 0.0010 0.0009 0.1117 0.0063 3.8294 0.1039 4165.0000
FE 0.1138 0.0040 -0.0004 0.0001 0.0008 0.0009 0.0000 0.0000 4.5964 0.0601 4165.0000 legend: b/se
Coe cients vary considerably across OLS, RE, FE and RE estimators. FE and RE similar as b = 0.82 ' 1. Not shown is that even for FE and RE cluster-robust changes se s. Coe cient of ed not identied for FE as time-invariant regressor!
A. Colin Cameron
Univ. of California - Davis (Based Panel methods for Stata Pravin K. Trivedi, Microeconometrics using 30 / 55 on A. Colin Cameron and April 8, 2008 Stata, Sta
Prefer RE as can estimate all parameters and more e cient. But RE is inconsistent if xed eects present. Use Hausman test to discriminate between FE and RE.
This tests dierence between FE and RE estimates is statistically signicantly dierent from zero.
Problem: hausman command gives incorrect statistic as it assumes RE estimator is fully e cient, usually not the case. Solution: do a panel bootstrap of the Hausman test or use the Wooldridge (2002) robust version of Hausman test.
A. Colin Cameron
Univ. of California - Davis (Based Panel methods for Stata Pravin K. Trivedi, Microeconometrics using 31 / 55 on A. Colin Cameron and April 8, 2008 Stata, Sta
Panel summary
xtset; xtdescribe; xtsum; xtdata; xtline; xttab; xttran Pooled OLS regress Feasible GLS xtgee, family(gaussian) xtgls; xtpcse Random eects xtreg, re; xtregar, re Fixed eects xtreg, fe; xtregar, fe Random slopes xtmixed; quadchk; xtrc First dierences regress (with dierenced data) Static IV xtivreg; xthtaylor Dynamic IV xtabond; xtdpdsys; xtdpd
A. Colin Cameron
Univ. of California - Davis (Based Panel methods for Stata Pravin K. Trivedi, Microeconometrics using 32 / 55 on A. Colin Cameron and April 8, 2008 Stata, Sta
For short panels asymptotics are T xed and N ! . For long panels asymptotics are for T !
A dynamic model for the errors is specied, such as AR(1) error Errors may be correlated over individuals Individual-specic eects can be just individual dummies Furthermore if N is small and T large can allow slopes to dier across individuals and test for poolability.
A. Colin Cameron
Univ. of California - Davis (Based Panel methods for Stata Pravin K. Trivedi, Microeconometrics using 33 / 55 on A. Colin Cameron and April 8, 2008 Stata, Sta
A. Colin Cameron
Univ. of California - Davis (Based Panel methods for Stata Pravin K. Trivedi, Microeconometrics using 34 / 55 on A. Colin Cameron and April 8, 2008 Stata, Sta
yi ) i yi )
IV estimation with instruments zit satisfy E[uit jzit ] = 0. Example: xtivreg lwage exp exp2 (wks = ms), fe
A. Colin Cameron
Univ. of California - Davis (Based Panel methods for Stata Pravin K. Trivedi, Microeconometrics using 35 / 55 on A. Colin Cameron and April 8, 2008 Stata, Sta
Command xthtaylor uses exogenous time-varying regressors xit from periods other than the current as instruments. This enables estimation of coe cient of a time-invariant regressor in a xed eects model (not possible using FE estimator). Example: allows estimation of coe cient of time-invariant regressor ed xthtaylor lwage occ south smsa ind exp exp2 wks ms union fem blk ed, /// endog(exp exp2 wks ms union ed)
A. Colin Cameron
Univ. of California - Davis (Based Panel methods for Stata Pravin K. Trivedi, Microeconometrics using 36 / 55 on A. Colin Cameron and April 8, 2008 Stata, Sta
A. Colin Cameron
Univ. of California - Davis (Based Panel methods for Stata Pravin K. Trivedi, Microeconometrics using 37 / 55 on A. Colin Cameron and April 8, 2008 Stata, Sta
0 + xit + i + it .
A. Colin Cameron
Univ. of California - Davis (Based Panel methods for Stata Pravin K. Trivedi, Microeconometrics using 38 / 55 on A. Colin Cameron and April 8, 2008 Stata, Sta
(yit
yi ,t
1)
= (yi ,t
yi ,t
2 ) + (xit
xi0 ,t
1 )
+ (it
i ,t i ,t
1 ). 1)
OLS inconsistent as (yi ,t 1 yi ,t 2 ) correlated with (it (even under assumption it is serially uncorrelated). But yi ,t 2 is not correlated with (it i ,t 1 ), so can use yi ,t 2 as an instrument for (yi ,t 1 yi ,t
2 ).
Arellano-Bond is a variation that uses unbalanced set of instruments with further lags as instruments. For t = 3 can use yi 1 , for t = 4 can use yi 1 and yi 2 , and so on. Stata commands
xtabond for Arellano-Bond xtdpdsys for Blundell-Bond (more e cient than xtabond) xtdpd for more complicated models than xtabond and xtdpdsys.
A. Colin Cameron
Univ. of California - Davis (Based Panel methods for Stata Pravin K. Trivedi, Microeconometrics using 39 / 55 on A. Colin Cameron and April 8, 2008 Stata, Sta
. * Optimal or two-step GMM for a dynamic panel model . xtabond lwage occ south smsa ind, lags(2) maxldep(3) /// . pre(wks,lag(1,2)) endogenous(ms,lag(0,2)) /// . endogenous(union,lag(0,2)) twostep vce(robust) artests(3) . * Test whether error is serially correlated . estat abond . * Test of overidentifying restrictions . estat sargan . * Arellano/Bover or Blundell/Bond for a dynamic panel model . xtdpdsys lwage occ south smsa ind, lags(2) maxldep(3) /// . pre(wks,lag(1,2)) endogenous(ms,lag(0,2)) /// . endogenous(union,lag(0,2)) twostep vce(robust) artests(3)
A. Colin Cameron
Univ. of California - Davis (Based Panel methods for Stata Pravin K. Trivedi, Microeconometrics using 40 / 55 on A. Colin Cameron and April 8, 2008 Stata, Sta
Generalize random eects model to random slopes. Command xtrc estimates the random coe cients model
0 yit = i + xit i + it ,
where (i , i ) are iid with mean (, ) and variance matrix and it is iid.
A. Colin Cameron
Univ. of California - Davis (Based Panel methods for Stata Pravin K. Trivedi, Microeconometrics using 41 / 55 on A. Colin Cameron and April 8, 2008 Stata, Sta
Not used in microeconometrics but used in many other disciplines. Stack all observations for individual i and specify yi = Xi + Zi ui + i where ui is iid (0, G) and Zi is called a design matrix. Random eects: Zi = e (a vector of ones) and ui = i Random coe cients: Zi = Xi . Example: xtmixed lwage exp exp2 wks ed jj id: covar(unstructured) mle exp wks,
A. Colin Cameron
Univ. of California - Davis (Based Panel methods for Stata Pravin K. Trivedi, Microeconometrics using 42 / 55 on A. Colin Cameron and April 8, 2008 Stata, Sta
Consider data on individual i in village j with clustering on village. A cluster-specic model (here village-specic) species
0 yji = i + xji + ji .
Here clustering is on village (not individual) and the repeated measures are over individuals (not time). Use xtset village id Assuming equicorrelated errors can be more reasonable here than with panel data (where correlation dampens over time). So perhaps less need for vce(cluster) after xtreg
A. Colin Cameron
Univ. of California - Davis (Based Panel methods for Stata Pravin K. Trivedi, Microeconometrics using 43 / 55 on A. Colin Cameron and April 8, 2008 Stata, Sta
First use xtset village person (versus xtset id t for panel). If i is random use:
regress with option vce(cluster village) xtreg,re xtgee with option exchangeable xtmixed for richer models of error structure
If i is xed use:
xtreg,fe
A. Colin Cameron
Univ. of California - Davis (Based Panel methods for Stata Pravin K. Trivedi, Microeconometrics using 44 / 55 on A. Colin Cameron and April 8, 2008 Stata, Sta
Complications
Random eects often not tractable so need numerical integration Fixed eects models in short panels are generally not estimable due to the incidental parameters problem.
A. Colin Cameron
Univ. of California - Davis (Based Panel methods for Stata Pravin K. Trivedi, Microeconometrics using 45 / 55 on A. Colin Cameron and April 8, 2008 Stata, Sta
where denotes additional model parameters such as variance parameters and i is an individual eect. A conditional mean model may be specied, with additive eects
0 E[yit ji , xit ] = i + g (xit )
(6)
0 g (xit ).
(7)
Univ. of California - Davis (Based Panel methods for Stata Pravin K. Trivedi, Microeconometrics using 46 / 55 on A. Colin Cameron and April 8, 2008 Stata, Sta
Counts Pooled poisson nbreg GEE (PA) xtgee,family(poisson) xtgee,family(nbinomial) RE xtpoisson, re xtnbreg, fe Random slopes xtmepoisson FE xtpoisson, fe xtnbreg, fe plus tobit and xttobit.
Binary logit probit xtgee,family(binomial) link(logit xtgee,family(poisson) link(probit xtlogit, re xtprobit, re xtmelogit xtlogit, fe
A. Colin Cameron
Univ. of California - Davis (Based Panel methods for Stata Pravin K. Trivedi, Microeconometrics using 47 / 55 on A. Colin Cameron and April 8, 2008 Stata, Sta
A. Colin Cameron
Univ. of California - Davis (Based Panel methods for Stata Pravin K. Trivedi, Microeconometrics using 48 / 55 on A. Colin Cameron and April 8, 2008 Stata, Sta
(8)
Analytical solution:
For Poisson with gamma random eect For negative binomial with gamma eect Use xtpoisson, re and xtnbreg, re
No analytical solution:
For other models. Instead use numerical integration (only univariate integration is required). Assume normally distributed random eects. Use re option for xtlogit, xtprobit Use normal option for xtpoisson and xtnbreg
A. Colin Cameron
Univ. of California - Davis (Based Panel methods for Stata Pravin K. Trivedi, Microeconometrics using 49 / 55 on A. Colin Cameron and April 8, 2008 Stata, Sta
A. Colin Cameron
Univ. of California - Davis (Based Panel methods for Stata Pravin K. Trivedi, Microeconometrics using 50 / 55 on A. Colin Cameron and April 8, 2008 Stata, Sta
Stata commands
xtlogit, fe xtpoisson, fe (better to use xtpqml as robust se s) xtnbreg, fe
Fixed eects extended to dynamic models for logit and probit. No Stata command.
A. Colin Cameron
Univ. of California - Davis (Based Panel methods for Stata Pravin K. Trivedi, Microeconometrics using 51 / 55 on A. Colin Cameron and April 8, 2008 Stata, Sta
12. Conclusion
Stata provides commands for panel models and estimators commonly used in microeconometrics and biostatistics. Stata also provides diagnostics and postestimation commands, not presented here. The emphasis is on short panels. Some commands provide cluster-robust standard errors, some do not. A big distinction is between xed eects models, emphasized by microeconometricians, and random eects and mixed models favored by many others. Extensions to nonlinear panel models exist, though FE models may not be estimable with short panels. This presentation draws on two chapters in Cameron and Trivedi, Microeconometrics using Stata, forthcoming.
A. Colin Cameron
Univ. of California - Davis (Based Panel methods for Stata Pravin K. Trivedi, Microeconometrics using 52 / 55 on A. Colin Cameron and April 8, 2008 Stata, Sta
Book Outline
For Cameron and Trivedi, Microeconometrics using Stata, forthcoming. 1. Stata basics 2. Data management and graphics 3. Linear regression basics 4. Simulation 5. GLS regression 6. Linear instrumental variable regression 7. Quantile regression 8. Linear panel models 9. Nonlinear regression methods 10. Nonlinear optimization methods 11. Testing methods 12. Bootstrap methods
A. Colin Cameron
Univ. of California - Davis (Based Panel methods for Stata Pravin K. Trivedi, Microeconometrics using 53 / 55 on A. Colin Cameron and April 8, 2008 Stata, Sta
13. Binary outcome models 14. Multinomial models 15. Tobit and selection models 16. Count models 17. Nonlinear panel models 18. Topics A. Programming in Stata B. Mata
A. Colin Cameron
Univ. of California - Davis (Based Panel methods for Stata Pravin K. Trivedi, Microeconometrics using 54 / 55 on A. Colin Cameron and April 8, 2008 Stata, Sta
Univ. of California - Davis (Based Panel methods for Stata Pravin K. Trivedi, Microeconometrics using 55 / 55 on A. Colin Cameron and April 8, 2008 Stata, Sta