Statistics Glossary → Panel Data Regression
Panel Data Regressionanalysis
Regression methods for data in which the same units (firms, households, provinces, countries) are followed over several periods, estimating relationships between variables while controlling for unobserved, time-invariant characteristics of the units.
Concept
Panel data have both a cross-sectional dimension (many units) and a time dimension (many periods). Their great advantage is that unmeasured but constant characteristics of the units (a firm's management culture, a province's geography) can be controlled for. If these characteristics are related to both the explanatory variable and the outcome, ordinary regression that pools all observations together gives biased results.
The fixed-effects (within) estimator uses each unit's deviations from its own average; all constant differences between units then drop out, and the coefficient answers 'within the same unit, how much does the outcome change when the explanatory variable rises?'. Two-way fixed effects also removes period shocks that affect all units at once. The random-effects model treats unit differences as a random component; it is more efficient but assumes that the unit effects are uncorrelated with the explanatory variables. The Hausman test provides evidence on whether this assumption holds, and hence whether random effects can be used. First-difference and between estimators are further options that use within-unit or between-unit variation separately.
Fixed effects cannot estimate the effect of time-invariant variables (e.g. sex, place of founding), because they vanish in the within transformation. The errors of the same unit in consecutive periods are usually correlated (serial correlation), and units may be hit by common shocks (cross-sectional dependence); classical standard errors are then unreliable and standard errors clustered by unit should be used. If the variables contain unit roots over time, there is a risk of spurious regression.
When to use it
- When the same units are observed over several periods and there is concern that unmeasured, time-invariant characteristics of the units distort the results (firm investment, household income, province-level indicators).
- If the effect of an intervention is studied by comparing before and after in treated and untreated units, use difference-in-differences; if an explanatory variable is correlated with the error term, instrumental variables regression is also considered.
- If there are very many periods and dynamics (the effect of past values) matter, use time-series or dynamic panel methods; if the data cover a single period only, ordinary multiple regression is used.
An everyday example
A researcher studies the advertising spending and sales of 40 retail firms over 10 years. Firms with strong brands both advertise more and already sell more, and brand strength is not measured. Pooling all firm-years together overstates the effect of advertising. The fixed-effects model compares each firm with its own average: 'in years when a firm raises its advertising above its usual level, how much do its sales rise?'. It might find that each extra million spent on advertising raises sales by 3 million; constant differences such as brand strength do not distort this estimate.
Parameters in MerQur
Model (Fixed effects (within) / Fixed effects (two-way: unit + time) / Random effects (GLS) / Pooled OLS / First differences / Between estimator (unit means) / Fixed effects (one-way: time))
Concept: Determines which kind of variation in the panel is used. Fixed effects uses only within-unit change; two-way fixed effects also removes common period shocks; random effects uses a weighted combination of within- and between-unit variation; pooled OLS uses all observations while ignoring the panel structure; first differences uses changes between consecutive periods; and the between estimator uses only differences between unit averages.
Everyday example: In the pooled model the effect of advertising may come out large, because strong brands both advertise and sell a lot. The fixed-effects model removes this brand difference by comparing each firm with itself; the two-way model also strips out yearly swings that affect every firm, such as a recession year.
What it does: Selects the reported estimator: within uses deviations from unit means, two-way also removes period means, random effects applies GLS quasi-demeaning, pooled OLS ignores the panel structure, first differences uses consecutive-period differences, between uses unit means.
Effect on the result: The coefficient table, the R² triple and the type of model test change. Hausman, unit-effects F and Breusch-Pagan LM are model-independent; Breusch-Godfrey and CD use the residuals of the main model. Time-invariant or collinear columns are dropped with a warning.
On the validation data: capital (SE): within 0.3101 (0.0174); two-way 0.3579 (0.0227); RE 0.3081 (0.0172); pooled 0.2307 (0.0255); FD 0.2918 (0.0538). R²: 0.767, 0.720, 0.770, 0.812, 0.409.
RE variance estimator (Swamy-Arora / Amemiya / Wallace-Hussain)
Concept: Determines how the between-unit and within-unit variances are estimated in the random-effects model. The ratio of these variances sets how far the model combines within-unit and between-unit information.
Everyday example: If persistent sales differences between firms are much larger than year-to-year fluctuations, the random-effects model ends up behaving much like fixed effects. Different estimation methods may compute this ratio slightly differently and shift the coefficients a little.
What it does: The estimation method of σ²_u and σ²_e in the random-effects model: Swamy-Arora (within and between residuals), Amemiya (within residuals), Wallace-Hussain (pooled OLS residuals). Active only when the model is Random effects.
Effect on the result: θ, the RE coefficients and SEs, and the Hausman statistic change. If Hausman is negative, no p is given and a warning is written.
On the validation data: σ²_u = 7089.8 (SA), 6477.3 (Amemiya), 5690.2 (WH); θ = 0.8612, 0.8557, 0.8374; Hausman χ²(2) = 2.330, 4.853, -4.289 (with WH, V_FE - V_RE is not positive definite).
Standard errors (Classical (homoskedastic) / Clustered: unit (Arellano, HC0) / Clustered: unit (Arellano, HC1) / Clustered: unit (Stata small-sample correction) / Clustered: time (HC0))
Concept: Determines how the uncertainty of the coefficients is computed. Classical standard errors assume independent errors with equal variance; standard errors clustered by unit allow the same unit's errors to be correlated across years, and those clustered by time allow common shocks among units in the same year. The coefficients do not change; only the standard errors and p values do.
Everyday example: A firm's sales usually stay good after a good year, so the errors are correlated from year to year. Standard errors clustered by firm account for this and widen the interval for the advertising effect compared with classical standard errors.
What it does: Estimates the coefficient covariance: classical, Arellano sandwich clustered by unit (HC0; HC1 = n/(n - k); CR1 correction G/(G - 1)·(n - 1)/(n - k)) or clustered by time (HC0).
Effect on the result: Only SE, t, p, CI and the model test (F for classical, Wald χ² otherwise) change; the coefficients stay the same.
On the validation data: capital SE (within): classical 0.01735; HC0 0.04979; HC1 0.05004; CR1-corrected 0.05262; time-clustered 0.03058. With HC0 the model test is χ²(2) = 63.55.
Confidence Level (90% / 95% / 99% / Other (custom))
Concept: Sets the confidence level of the intervals for the coefficients; the higher the level, the wider the interval.
Everyday example: The advertising effect might lie between 2.4 and 3.6 with 95% confidence, meaning each extra million spent on advertising raises sales by between 2.4 and 3.6 million. At 99% confidence the interval widens.
What it does: The coverage probability of the coefficient interval; critical value t(df_resid).
Effect on the result: Only the interval limits and the significance in the interpretation change; estimates, SEs and tests do not.
On the validation data: capital interval (within): 90% [0.2814, 0.3388]; 95% [0.2758, 0.3443]; 99% [0.2649, 0.3552].
Additional tests: Serial correlation and BG test lag order
Concept: Tests whether a unit's errors in consecutive periods are correlated (serial correlation). If they are, classical standard errors are unreliable and clustered standard errors should be used.
Everyday example: If the test is significant, a firm selling better than expected in one year is linked to it selling well the next year too. The advertising effect should then be reported with standard errors clustered by firm.
What it does: The Breusch-Godfrey/Wooldridge test checks p-th order serial correlation in the transformed residuals of the main model; the Wooldridge first-difference test (Drukker 2003) tests for no serial correlation in the level errors.
Effect on the result: When off, the two test rows are removed; the order changes the df and value of the BG χ².
On the validation data: BG χ²(1) = 42.09, χ²(2) = 42.59; Wooldridge F(1, 178) = 371.9. EmplUK: Wooldridge F(1, 749) = 131.55.
Additional tests: Cross-sectional dependence (Pesaran CD)
Concept: Tests whether the errors of different units in the same period are correlated. If common shocks (a recession, a regulatory change) affect units together, there is cross-sectional dependence and the standard errors should be adjusted.
Everyday example: If all retail firms' sales fall at once during a currency crisis, the firms' errors move together. The Pesaran CD test detects this joint movement; two-way fixed effects or standard errors clustered by time should then be considered.
What it does: Tests cross-sectional dependence with the average correlation between the units' residuals (Pesaran 2004).
Effect on the result: When off, the CD row and its interpretation are removed; computation time grows with the square of the number of units.
On the validation data: z = 4.661 (within). nlswork (4697 units): z = 33.027, 3.5 s.
Panel unit root tests; Unit root: exogenous terms (Intercept / Intercept and trend / None), Unit root: lag selection (Fixed lag / AIC / SIC / Hall (general-to-specific t test)), Unit root: lag / maximum lag
Concept: Tests, for each unit and across the panel, whether a variable carries a persistent trend over time (a unit root, non-stationarity). Regressions between non-stationary variables can give spurious results that look significant even when no real relationship exists.
Everyday example: If both firms' advertising and their sales rise together with inflation over the years, a strong relationship may appear even if none exists. Unit root tests reveal this risk in advance; if needed, differences or inflation-adjusted values of the variables are used.
What it does: Per-unit ADF regression (MacKinnon 1994 p value) and combined tests: Maddala-Wu Fisher χ²(2N), Choi Pm, inverse normal Z, logit L* and Im-Pesaran-Shin W-bar. The exogenous terms and the lag are selected.
Effect on the result: An extra table; does not change the model estimates and gives a spurious-regression warning.
On the validation data: Grunfeld inv, intercept and trend, lag 1: Fisher χ² = 76.4100284292, p = 1.583e-08; IPS W = -2.6180071297.
Example on real data
Data: Grunfeld 1958, R plm
Variables: dependent inv (gross investment), explanatory value (firm value) and capital (capital stock), unit firm, time year
- Question: In 20 years of data on ten firms, how is gross investment (inv) related to firm value (value) and capital stock (capital), and does the relationship hold when unobserved firm differences are controlled?
- Assumption: Unit effects F(9, 188) = 49.18, p < .001 (firm effects exist); Breusch-Pagan LM χ²(1) = 798.16, p < .001; Hausman χ²(2) = 2.33; the Hausman test is not significant (p = .312); the fixed- and random-effects estimates show no systematic difference, which suggests that the random-effects model can be used (a non-significant test does not prove the RE assumption). Breusch-Godfrey χ²(1) = 42.09 and Wooldridge F(1, 178) = 371.89 indicate serial correlation and Pesaran CD z = 4.66 cross-sectional dependence (all p < .001); results should also be reported with clustered (Arellano) or Driscoll-Kraay SEs.
- Result: In the fixed effects (within) model value b = 0.110 (SE = 0.012, t(188) = 9.29, p < .001) and capital b = 0.310 (SE = 0.017, t(188) = 17.87, p < .001); within a firm, a one-unit increase in capital stock raises investment by 0.31 units on average.
- Effect size: R² (within) = .77 (adjusted .75); model test F(2, 188) = 309.01, p < .001.
- APA: Fixed effects panel regression (10 units, 20 periods, N = 200); capital: b = 0.310, SE = 0.017, t(188) = 17.87, p < .001; R² = .77; Hausman χ²(2) = 2.33, p = .312.
Related concepts
Cross-sectional dependence (Pesaran CD)Fixed and random effectsSerial correlation tests (Breusch-Godfrey)Unit root tests (ADF, Phillips-Perron)Hausman testTwo-way fixed effects (TWFE)Breusch-Pagan and White testsRobust (sandwich) standard errors (HC0-HC3)
The numbers in the examples are MerQur's output on independent, publicly available validation data; see the MerQur Technical Note for details.