Follow the same individuals (people, firms, countries) over several periods and you can do something a single cross-section never can: compare each individual with itself. That strips out everything about the individual that does not change, including the things nobody measured. This lesson covers the kinds of data, why pooling the observations can mislead, the fixed-effects estimators (within, first-difference, dummy variables), random effects, and the Hausman test that chooses between them, with a lab where the truth is known and real data on twelve economies.
The Ashanagar survey is invented. The statistics modules used one district of 60 households. Econometrics needs more households and more variables, so this is a new, larger survey of 600 households in the same imaginary district: income, spending, household size, whether the household is in the town or a village, the head’s schooling and earnings.
Because we wrote the data-generating process, we know the true answers, and every lab can show whether a regression recovers them. Household spending, in thousands of rupees a month, was generated as 1 + 0.45 × income + 0.9 × household size + 1.5 × town + an error with standard deviation 2.5. A real survey never tells you its true coefficients. This one does, so you can see how close an estimate comes.
It also holds a variable, the head’s ability, that a real survey could not observe. It is kept so that the lessons on omitted variables can show what happens when it is left out. Every figure here is illustrative, not official statistics.
| Kind | What it is | Example |
|---|---|---|
| Cross-section | Many individuals at one point in time | A household survey in one year, the 186 economies in 2019 |
| Time series | One individual over many periods | India’s GDP, 1960 to 2025 |
| Pooled cross-sections | Several cross-sections, each a fresh sample of different individuals | A household survey repeated every year with new households |
| Panel (longitudinal) | The same individuals followed over time | 12 economies, each observed in each of 20 years |
Data collected at a point in time are cross-sectional (CUET asks it directly), and one state over many years is a time series. A panel is balanced if every individual is observed in every period, unbalanced otherwise. With N individuals and T periods the sample has n = NT observations. A short panel has many individuals and few periods (typical of surveys), a long panel few individuals and many periods (typical of country data).
The simplest approach stacks all the observations and runs OLS, ignoring that they come in groups. That is the pooled regression, yit = β₀ + β₁xit + vit. But every observation of individual i shares an individual effect μi: something about that person, firm or country that persists, such as ability, management quality or institutions. It sits in the error: vit = μi + εit. If μi is related to x, we have an omitted variable that is correlated with the regressor, and the bias of lesson 7 returns:
In the lab each individual in colour has its own level (μ), and individuals with a high level also have a high x. Looking across individuals, the pattern is steep; looking within one individual, the slope is the true 1. The dashed pooled line is much steeper than any individual’s own line. Press “draw new samples” and raise c to see the pooled and between estimators drift away from 1 while the within and first-difference estimators stay put.
True model: yit = 1 × xit + μi + eit, with an individual effect μi and xit = c μi + noise. The slope we want is 1. The plot shows 8 individuals, each in its own colour.
| Estimator | Average slope | Spread |
|---|---|---|
| Pooled OLS | 1.465 | 0.109 |
| Between | 1.953 | n/a |
| Fixed effects (within) | 0.997 | 0.093 |
| First differences | 0.999 | 0.111 |
| Random effects | 1.297 | 0.118 |
Horizontal: x. Vertical: y. Each colour is one individual; its short line has the within slope (0.86), and the dashed black line is the pooled OLS fit (1.41).
Individuals with a high effect also have a high x, so the pooled line is steeper than each individual's own: it converges to 1.49, not 1 (average 1.47), and the between estimator, which uses only differences across individuals, is worse (1.95). The within and first-difference estimators remove μ by comparing each individual with itself, and are centred on the truth (1 and 1). Random effects assumes μ is unrelated to x, so it is biased too (1.3). The Hausman test, which compares fixed and random effects, rejects random effects in 100% of samples.
If μi is constant over time, differences within an individual cannot contain it. Three equivalent ways to use that:
μi is the same in every period, so it equals its own average.
The individual effect is gone, whatever its relation to x. The new error εit − ε̄i is unrelated to the demeaned x if x is strictly exogenous with respect to ε, so OLS on the demeaned data is consistent.
The N means were estimated, so the residual degrees of freedom are n − N − k, not n − k. And any variable that does not change over time (sex, country of birth) has x − x̄i = 0, so its coefficient cannot be estimated: the within estimator is silent about it.
Regress y on x and on N − 1 individual dummies (least squares with dummy variables, LSDV) and the slope on x is identical to the within estimator’s. For 12 economies over 20 years of World Bank data (life expectancy on ln GDP per head), the within slope is 8.129 and the LSDV slope is 8.129. The pooled slope, which ignores the economy effects, is 6.3678. The within regression has 227 degrees of freedom: 240 − 12 − 1.
What fixed effects costs: degrees of freedom (n − N − k), and the ability to estimate the effect of any variable that does not change within an individual: sex, birthplace, a country’s geography. Those are absorbed by the individual effect. The within estimator answers “what happens when x changes for the same individual?” and is silent on differences between individuals.
The random-effects (RE) model treats μi as a random draw, assumed uncorrelated with x. The composite error vit = μi + εit is then correlated within an individual (the same μi in each period), so OLS is unbiased but inefficient, and GLS fixes that. GLS is computed as OLS on quasi-demeaned data: subtract a fraction θ of the individual mean,
RE is more efficient than FE when its assumption holds, because it also uses the variation between individuals, and it can estimate the effect of time-invariant variables. But if μi is correlated with x, RE is biased (the lab shows it), while FE is not. Which to use? The Hausman test compares the two:
A model written yit = β₀ + β₁xit + εi + uit with a person-specific error εi and an idiosyncratic error uit is the random-effects form (the individual term is a part of the error, not a set of coefficients).
World Bank, World Development Indicators: life expectancy and GDP per head for 12 economies (India, China, the United States, Japan, Korea, Brazil, Nigeria, Germany, Indonesia, Bangladesh, Ethiopia and the United Kingdom), 2000 to 2019: a balanced panel of 240 observations. Regress life expectancy on the log of GDP per head:
| Estimator | Slope on ln GDP | Standard error |
|---|---|---|
| Pooled OLS | 6.368 | 0.306 |
| Between (economy averages) | 6.295 | 1.491 |
| Fixed effects (within) | 8.129 | 0.294 |
| First differences | 3.097 | 0.597 |
| Random effects | 8.06 | 0.289 |
The estimated individual effects range from −21.6 (Nigeria) to 1 (China) years: economies differ a great deal in life expectancy at the same income, which is what pooling ignores. The within estimate is 8.13, the pooled 6.37. The Hausman test comparing fixed and random effects gives H = 1.45 with 1 degree of freedom (p = 0.23), so it does not reject random effects here; the two estimates (8.13 and 8.06) are close, and the random-effects weight θ = 0.96 is near 1, so RE here behaves almost like FE.
The first-difference slope (3.1) is well below the within slope. They answer slightly different questions: the within estimator uses all the variation over twenty years, including long slow trends in both GDP and life expectancy, whereas first differences use only year-to-year changes, which are small and noisy; one standard reason for such a gap is that differencing amplifies measurement error. These are real data, and no estimator here proves that GDP causes longer lives: fixed effects removes what is constant about an economy, not what changes with GDP and also lengthens life.
With an individual effect correlated with a regressor, pooled OLS is biased and inconsistent. Fixed effects (within, first differences or LSDV) removes it by comparing each individual with itself, at the price of time-invariant regressors and degrees of freedom. Random effects is more efficient but needs the effect to be uncorrelated with the regressors. The Hausman test chooses: rejection means use fixed effects.
Definitions and one-step calculations: a t statistic, an R², which assumption is which. Most CUET and JNU questions sit here.
Restricted against unrestricted regressions, reading output, and statement questions, up to GATE and IIT JAM level.
These are questions from the TestStop bank. A free account answers 10 a day, each with its worked solution; All-Access opens every set with no daily limit.
This lesson’s set is short: few papers ask about panels, and two further questions (on the form of a random-effects model, and on panel data for states) are waiting for a person to sign off their keys. The instrumental-variables alternative to fixed effects is in lesson 11.