Professional Documents
Culture Documents
See Stock and Watson, Introduction to Econometrics, chapter 10 “Regression with Panel Data”
150
100
. xtline eps
EPS
50
help xt
0
2012 2014 2016 20182012 2014 2016 2018
Company
Graphs by Number
150
. xtline eps roe npm
100
50
0
2012 2014 2016 20182012 2014 2016 2018
Company
EPS ROE
NPM
Graphs by Number
.03
• gen ln_gdppc = ln(gdppc)
.02
• gen ln_cr = ln(cr + 2)
Density
• If the variable has negative
.01
values, you need to add a value
0
-200 -100 0 100
.4
For example, if the lowest value
.3
in ‘varX’ is -1
Density
.2
.1
0
-1 0 1 2 3 4
ln_npm
Abuzar Nomani (abuzarnomani88@gmail.com)
9
Usage of panel data
• panel data analysis helps to overcome
omitted variable bias by controlling for
unobserved individual-specific factors that
may influence the relationship between the
variables of interest.
Management
R-sq: within = 0.2337 variation in the dependent variable is Obs per group: min = 6
explained by the independent
between = 1.0000 variables in the model. avg = 6.0
overall = 0.5659 max = 6
Robust
ln_eps Coef. Std. Err. t P>|t| [95% Conf. Interval]
sigma_u .83986913
sigma_e .49385331
rho .74307545 (fraction of variance due to u_i)
𝑌𝑖𝑡 = 𝛼𝑖 + 𝛽𝑋𝑖𝑡 + 𝛿𝑡 + 𝑢𝑖 + 𝑒𝑖 Entity and time fixed effects regression using xtreg, fe
Time Fixed effect
. xtreg ln_eps ln_cr ln_qr ln_roce ln_roa ln_roe ln_npm i year, fe robust
F(8,24) = 15.91
corr(u_i, Xb) = -0.0878 Prob > F = 0.0000
Robust
ln_eps Coef. Std. Err. t P>|t| [95% Conf. Interval]
sigma_u .71784076
sigma_e .44665697
rho .72089666 (fraction of variance due to u_i)
Random effect idea
• The random effect model assumes that individual-specific heterogeneity is unrelated to
the predictors we're studying.
• Instead of including entity fixed effects, the random effect model treats individual-
specific effects as random variables.
• These random variables have specific distribution assumptions, often assumed to follow
a normal distribution.
• The random effect model estimates the average effects of the predictors on the outcome
variable.
• It takes into account both within-entity variation (changes in predictors and outcome
over time) and between-entity variation (differences in average values across entities).
• The random effect model is useful when we want to capture overall or average effects of
the predictors on the outcome.
• It assumes that individual-specific effects are random and uncorrelated with the
predictors, allowing us to focus on the relationship between the predictors and the
outcome.
Robust
ln_eps Coef. Std. Err. z P>|z| [95% Conf. Interval]
sigma_u .61152367
sigma_e .49385331
rho .60525987 (fraction of variance due to u_i)
Which to choose?
Coefficients
(b) (B) (b-B) sqrt(diag(V_b-V_B))
fe re Difference S.E.
chi2(6) = (b-B)'[(V_b-V_B)^(-1)](b-B)
= 10.86 If Prob > chi2 is < 0.05
Prob>chi2 = 0.0928 use fixed effects
Do we need random effects?
• The LM test helps you decide between a random effects regression and a simple
OLS regression. The null hypothesis in the LM test is that variances across
entities is equal to zero. This is, no significant difference across units (i.e. no
panel effect). The command in Stata is xttset0 type it right after running the
random effects model
. xttest0
Estimated results:
Var sd = sqrt(Var)
Test: Var(u) = 0
chibar2(01) = 142.48
Prob > chibar2 = 0.0000
25
Suggested books / references
• Introduction to econometrics / James H. Stock, Mark W. Watson. 2nd ed., Boston: Pearson Addison Wesley,
2007.
• Econometric Analysis of Panel Data, Badi H. Baltagi, Wiley, 2008.
• Econometric Analysis / William H. Greene. 6th ed., Upper Saddle River, N.J. : Prentice Hall, 2008.
• An Introduction to Modern Econometrics Using Stata/ Christopher F. Baum, Stata Press, 2006.
• Data analysis using regression and multilevel/hierarchical models / Andrew Gelman, Jennifer Hill. Cambridge
; New York : Cambridge University Press, 2007.
• Data Analysis Using Stata/ Ulrich Kohler, Frauke Kreuter, 2 nd ed., Stata Press, 2009.
• Statistics with Stata / Lawrence Hamilton, Thomson Books/Cole, 2006.
• Statistical Analysis: an interdisciplinary introduction to univariate & multivariate methods / Sam Kachigan,
New York : Radius Press, c1986
• “Beyond “Fixed Versus Random Effects”: A framework for improving substantive and statistical analysis of
panel, time-series cross-sectional, and multilevel data” / Brandom Bartels
http://polmeth.wustl.edu/retrieve.php?id=838
• “Robust Standard Errors for Panel Regressions with Cross-Sectional Dependence” / Daniel Hoechle,
http://fmwww.bc.edu/repec/bocode/x/xtscc_paper.pdf
• Designing Social Inquiry: Scientific Inference in Qualitative Research / Gary King, Robert O.Keohane, Sidney
Verba, Princeton University Press, 1994.
• Unifying Political Methodology: The Likelihood Theory of Statistical Inference / Gary King, Cambridge
University Press, 1989.
Abuzar Nomani (abuzarnomani88@gmail.com) 26