TL;DR
Panel data records the same units, such as workers, firms or countries, over several time periods. Each unit appears many times, once per period. That lets you compare a unit with itself at different dates, which removes everything about the unit that stays the same over time, including traits you never measured.
Where you'll see it: in studies of how a worker's wage changes after more schooling, in tracking how a firm's investment responds to its own tax changes, and in cross-country studies that follow the same countries across decades.
Intuition
A photo or a film
Think of three ways to record a group of people.
- A cross-section is one photo: many people, one moment.
- A time series is one long film of one person: one unit, many moments.
- A panel is many films filmed side by side: many units, many moments.
The panel is the most informative of the three, because it gives you two kinds of comparison at once. You can compare different units at the same time, as a cross-section does, and you can compare the same unit at different times, as a time series does.
A small panel looks like a table with one row per unit and time combination.
| Unit | Year | Hours trained | Wage |
|---|---|---|---|
| Worker 1 | 2020 | 10 | 20 |
| Worker 1 | 2021 | 12 | 23 |
| Worker 2 | 2020 | 20 | 30 |
| Worker 2 | 2021 | 22 | 33 |
Why the second dimension matters
Suppose you have only a single snapshot from 2020. Worker 2 trains more and earns more. Is the extra training the cause, or does Worker 2 simply have more natural ability, which both raises training and raises pay? A snapshot cannot tell these apart, because ability is not in the data.
A panel can. Look at how Worker 2 changes from 2020 to 2021: training rose by 2 hours and pay rose by 3. Ability is the same in both years, so it cannot explain that change. The panel uses each unit as its own control. Anything fixed about the unit drops out of the comparison.
This is the core idea of panel data: a fixed trait of a unit cannot fake an effect when you only look at how that unit changes.
The math
Setting it up
Let be the outcome for unit at time , and let be the variable we want the effect of. There are units, indexed by , and periods, indexed by . A panel with every unit observed in every period is called balanced. It has observations in total.
Suppose the outcome follows
Here is the effect we want. The term is a fixed trait of unit that does not change over time, such as ability, culture or location. It may be unobserved. The term is everything else that changes from period to period.
Definition
A panel dataset is a collection of observations indexed by a unit and a time . It is balanced when every unit is observed in every period, and unbalanced otherwise.
Why a single regression can go wrong
If you ignore and run an ordinary regression of on , the estimate of is biased whenever is correlated with . The fixed trait then gets credited to . This is the omitted variable bias problem, a form of confounding, in a panel setting. The regression run on all rows is called pooled linear regression.
Removing the fixed trait
Average the model over time for each unit (a plain mean of that unit's own rows). Let , and be the unit means. Then
Subtract this from the original equation for each period. The term appears in both, so it cancels:
The result uses only deviations from each unit's own average. The estimator that does this, pooled over all units, is
This is the within estimator. Its full treatment, with the dummy-variable form and its assumptions, is in the fixed effects model.
The estimator only uses variation within units over time. If never changes for a unit, its deviation is zero and the unit contributes nothing to the sums. This matters a great deal in practice, as the examples show.
Worked examples
Take two units observed in two periods. The true model is , with no noise, so the true effect is . Unit A has and unit B has .
| Unit | |||
|---|---|---|---|
| A | 1 | 1 | 2 |
| A | 2 | 2 | 4 |
| B | 1 | 2 | 8 |
| B | 2 | 3 | 10 |
- Check the data. For A, and . For B, and .
- Pooled regression. Ignore the units and fit one line to all four points. The mean of is and the mean of is . The cross-product sum is . The sum of squares of is . The pooled slope is .
- Interpret step 2. The pooled slope is , twice the true value. Unit B has both higher and a higher fixed trait, so the trait is credited to .
- Within deviations. For A, the mean of is and the mean of is , so the deviations are : and : . For B, the means are and , so the deviations are : and : .
- Within slope. The cross-products are for A and for B, a total of . The squared deviations are for A and the same for B, a total of . The within slope is .
- Interpret step 5. The within estimator recovers the true . The fixed traits and were removed by the demeaning.
A standard textbook setting. Wage depends on training hours , with , and each worker has a fixed ability term . The values below are constructed so the model holds exactly.
| Worker | Year 1: , | Year 2: , | |
|---|---|---|---|
| 1 | 5 | 10, 20 | 12, 23 |
| 2 | 0 | 20, 30 | 22, 33 |
| 3 | 30, 35 | 28, 32 |
- Within deviations for worker 1. Mean , mean . Deviations: : ; : .
- Worker 2. Mean , mean . Deviations: : ; : .
- Worker 3. Mean , mean . Deviations: : ; : .
- Cross-products. Each worker contributes , for a total of .
- Squared deviations. Each worker contributes , for a total of .
- Within slope . This matches the true .
- Compare with pooled regression. Pooling all six rows gives a slope of . Worker 3 has high training and low ability, which pulls the pooled slope toward zero. The within estimator is not fooled by that.
The example is exact because there is no noise. With real data the within estimate would differ from the truth by sampling error, but the bias from the fixed traits would be gone.
Illustrative numbers, not from a real dataset. A survey follows adults for years, giving rows. The outcome is annual income and the regressor is years of formal education.
- Count the rows that can help. Within estimation uses only changes over time. Suppose most adults finish their education before the survey starts, so their education value is the same in every year. For those people in every period.
- Suppose 900 of the 1,000 adults have constant education. Then only 100 adults contribute to the denominator . The effect of education is estimated from a small slice of the sample.
- Interpret step 2. The estimate is still valid, but its standard error is much larger than the 10,000 rows suggest. The panel has many observations and little within variation.
- Consequence. Panels are very good at estimating effects of variables that change within units, such as a training programme or a tax change. They are weak for variables that barely move, such as schooling after a certain age. For those, a researcher needs another design or a different estimator.
Tradeoffs and failure modes
Panel data solves one problem and creates others. Use it when a unit trait is likely to be correlated with the variable of interest and you have repeated observations. Be careful in the situations below.
| Situation | Problem | Better choice |
|---|---|---|
| Unit trait is correlated with | Pooled regression is biased | Fixed effects, which use within variation |
| never changes for a unit | That unit gives no information to fixed effects | Choose a variable that varies, or a different design |
| Shocks hit all units in the same period | A common trend can look like an effect | Add time fixed effects (a separate intercept for each period) |
| Errors are correlated within a unit over time | Standard errors (the measure of how much an estimate would vary from sample to sample) that assume independence are too small | Cluster standard errors by unit, which lets errors be related within a unit |
| Units drop out of the survey (attrition) | Remaining units may differ systematically | Check who leaves, and reweight if needed |
| Unit trait is uncorrelated with | Fixed effects throw away useful between-unit variation | Random effects, which treat as random noise drawn per unit |
| Last period's outcome used as a regressor, short | Demeaning makes the regressor correlated with the error, biasing its coefficient | Specialised dynamic panel estimators |
The key tradeoff is between the power of within variation and the information you lose by throwing away between-unit comparisons. Fixed effects give up all between-unit information. Random effects use it, but they assume the unit traits are uncorrelated with , and that assumption is often false.
History
Panel analysis grew out of economic surveys that followed the same households over time. The Panel Study of Income Dynamics, a long-running survey of US families that began in 1968, is one of the best-known early examples. Economists started using fixed effects regressions for panel data in the 1960s, and Yair Mundlak's 1978 paper on pooling time series and cross-section data helped make the random and fixed effects choice a standard part of applied work. The method spread to other fields, including sociology, public health and political science, where repeated measures on the same people or places are common.
Recap
A panel has many units observed over many periods. Each unit can be compared with itself, so any trait that stays fixed for the unit drops out of the comparison. Subtracting each unit's own average is the simplest way to do this, and it gives the within estimator. The price is that only changes within units inform the estimate. The next step is the fixed effects model, which turns this idea into a full regression, and omitted variable bias explains why the fixed traits matter in the first place.
Check yourself
QuestionRecall: what does the term represent in the panel model ?Show answer
It is a fixed trait of unit that does not change over time, such as ability, culture or location. It may be unobserved. It does not carry a time index because it is constant for that unit.
QuestionComputation: a unit has training hours over three periods. What is the within deviation of in the middle period?Show answer
The unit mean is . The middle deviation is . The first deviation is and the last is . Deviations always sum to zero within a unit.
QuestionWhy: why can a pooled regression give the wrong slope even when the data are exact?Show answer
Pooling ignores that units differ in a fixed trait. If a unit with high also has a high fixed trait, the regression attributes part of the trait's effect to . This is omitted variable bias, and it does not disappear with more data from the same units. Example 1 in this lesson shows a pooled slope of 4 when the true value is 2.
QuestionApplied: a researcher studies the effect of a city's minimum wage on teenage employment, using data on 50 cities over 20 years. A city's minimum wage changes only twice in 20 years. Which concern from this lesson applies, and what should the researcher check?Show answer
Most cities have little within-city variation in the policy, so those cities contribute little to the within estimator, and the estimate rests on the few changes. The researcher should check how many changes occur and where they occur, and should consider shocks that hit all cities in the same year, which call for time fixed effects. Clustering standard errors by city is also needed, because outcomes within a city are correlated over time.