Skip to main content

Cookies on Macro by Mark.We use essential cookies for sign-in, locale, and security. With your permission, we also use optional cookies for preferences, for analytics, and for advertising measurement with the Meta (Facebook) Pixel. Read our cookie policy.

Macro by MarkMacro by Mark
  • Home
Loading…
Loading…
← Models
MacroConceptsPolicyModels

Fixed-effects panel Model

Pooled cross-country or cross-region regression with country and time fixed effects to net out unit-level and aggregate variation.

OverviewGraphMathReferences

Understand the mathematics

Follow the same equations and assumptions one section at a time or in a continuous reading.

Hover or focus a symbol defined in this model to find its exact matches. Select it to keep the highlight; Escape clears the selection.

Within Transformation and OLS Equivalence

The fixed-effects model is yit=αi+xit′β+εity_{it} = \alpha_i + x_{it}' \beta + \varepsilon_{it}yit​=αi​+xit′​β+εit​. The entity fixed effect αi\alpha_iαi​ is correlated with xitx_{it}xit​ (this is why we use FE instead of random effects). OLS on the untransformed equation treats αi\alpha_iαi​ as part of the error and is inconsistent because Cov⁡(xit,αi)≠0\operatorname{Cov}(x_{it}, \alpha_i) \neq 0Cov(xit​,αi​)=0.

The within transformation eliminates αi\alpha_iαi​ by subtracting entity means. This is algebraically equivalent to including N−1N-1N−1 entity dummies and running OLS, but computationally more efficient.

The Frisch-Waugh-Lovell theorem guarantees the equivalence: partialing out the entity dummies (projecting y and x onto the space orthogonal to the dummies) produces identical coefficient estimates.

yit=αi+xit′β+εity_{it} = \alpha_i + \mathbf{x}_{it}' \boldsymbol{\beta} + \varepsilon_{it}yit​=αi​+xit′​β+εit​
αi\alpha_iαi​β\betaβεit\varepsilon_{it}εit​

Structural model. αi\alpha_iαi​ is unobserved and correlated with xitx_{it}xit​.

yˉi=αi+xˉi′β+εˉiwhere yˉi=T−1∑tyit\bar{y}_i = \alpha_i + \bar{\mathbf{x}}_i' \boldsymbol{\beta} + \bar{\varepsilon}_i \quad \text{where } \bar{y}_i = T^{-1}\sum_t y_{it}yˉ​i​=αi​+xˉi′​β+εˉi​where yˉ​i​=T−1t∑​yit​
yˉi\bar{y}_iyˉ​i​αi\alpha_iαi​β\betaβ

Time-averaged equation for entity iii. The fixed effect αi\alpha_iαi​ is absorbed into the mean.

(yit−yˉi)⏟y¨it=(xit−xˉi)′⏟x¨it′β+(εit−εˉi)⏟ε¨it\underbrace{(y_{it} - \bar{y}_i)}_{\ddot{y}_{it}} = \underbrace{(\mathbf{x}_{it} - \bar{\mathbf{x}}_i)'}_{\ddot{\mathbf{x}}_{it}'} \boldsymbol{\beta} + \underbrace{(\varepsilon_{it} - \bar{\varepsilon}_i)}_{\ddot{\varepsilon}_{it}}y¨​it​(yit​−yˉ​i​)​​=x¨it′​(xit​−xˉi​)′​​β+ε¨it​(εit​−εˉi​)​​
yˉi\bar{y}_iyˉ​i​β\betaβεit\varepsilon_{it}εit​

Within-transformed equation. αi\alpha_iαi​ cancels. β\betaβ is identified from within-entity variation only.

β^FE=(∑i=1N∑t=1Tx¨itx¨it′)−1(∑i=1N∑t=1Tx¨ity¨it)\hat{\boldsymbol{\beta}}_{\text{FE}} = \left(\sum_{i=1}^{N}\sum_{t=1}^{T} \ddot{\mathbf{x}}_{it} \ddot{\mathbf{x}}_{it}'\right)^{-1} \left(\sum_{i=1}^{N}\sum_{t=1}^{T} \ddot{\mathbf{x}}_{it} \ddot{y}_{it}\right)β^​FE​=(i=1∑N​t=1∑T​x¨it​x¨it′​)−1(i=1∑N​t=1∑T​x¨it​y¨​it​)
β^FE\hat{\boldsymbol{\beta}}_{\text{FE}}β^​FE​NNNTTTy¨it\ddot{y}_{it}y¨​it​

The within (FE) estimator. OLS on the demeaned data.

Step 1

Average over all time periods for each entity. These means contain αi\alpha_iαi​.
Compute entity means: yˉi=1T∑t=1Tyit,xˉi=1T∑t=1Txit\text{Compute entity means: } \bar{y}_i = \frac{1}{T}\sum_{t=1}^{T} y_{it}, \quad \bar{\mathbf{x}}_i = \frac{1}{T}\sum_{t=1}^{T} \mathbf{x}_{it}Compute entity means: yˉ​i​=T1​t=1∑T​yit​,xˉi​=T1​t=1∑T​xit​
yˉi\bar{y}_iyˉ​i​TTT

Step 2

Subtract entity means from every observation. The fixed effect αi\alpha_iαi​ is present in both yity_{it}yit​ and yˉi\bar{y}_iyˉ​i​, so it cancels. What remains is within-entity deviation from the entity average.
Demean: y¨it=yit−yˉi,x¨it=xit−xˉi\text{Demean: } \ddot{y}_{it} = y_{it} - \bar{y}_i, \quad \ddot{\mathbf{x}}_{it} = \mathbf{x}_{it} - \bar{\mathbf{x}}_iDemean: y¨​it​=yit​−yˉ​i​,x¨it​=xit​−xˉi​
y¨it\ddot{y}_{it}y¨​it​yˉi\bar{y}_iyˉ​i​

Step 3

Standard OLS on the demeaned equation. No intercept (it has been demeaned away). The degrees of freedom adjustment is N(T−1)−KN(T-1) - KN(T−1)−K, not NT−KNT - KNT−K, because NNN entity means have been subtracted.
Run OLS on demeaned data: y¨it=x¨it′β+ε¨it\text{Run OLS on demeaned data: } \ddot{y}_{it} = \ddot{\mathbf{x}}_{it}' \boldsymbol{\beta} + \ddot{\varepsilon}_{it}Run OLS on demeaned data: y¨​it​=x¨it′​β+ε¨it​
y¨it\ddot{y}_{it}y¨​it​β\betaβ

Step 4

Strict exogeneity E[εit∣xi1,…,xiT,αi]=0E[\varepsilon_{it} | x_{i1}, \ldots, x_{iT}, \alpha_i] = 0E[εit​∣xi1​,…,xiT​,αi​]=0 implies E[ε¨it∣x¨i1,…,x¨iT]=0E[\ddot{\varepsilon}_{it} | \ddot{x}_{i1}, \ldots, \ddot{x}_{iT}] = 0E[ε¨it​∣x¨i1​,…,x¨iT​]=0. OLS on the demeaned data is consistent. No assumption about Cov⁡(αi,xit)\operatorname{Cov}(\alpha_i, x_{it})Cov(αi​,xit​) is needed - this is the entire point of fixed effects.
Consistency: plimN,T→∞β^FE=β under strict exogeneity\text{Consistency: } \text{plim}_{N,T \to \infty} \hat{\boldsymbol{\beta}}_{\text{FE}} = \boldsymbol{\beta} \text{ under strict exogeneity}Consistency: plimN,T→∞​β^​FE​=β under strict exogeneity
β^FE\hat{\boldsymbol{\beta}}_{\text{FE}}β^​FE​β\betaβ

Step 5

Recover the estimated fixed effects from the entity means and the estimated slope. These are consistent estimates of αi\alpha_iαi​ when TTT is fixed and NNN grows. They can be used for descriptive analysis (ranking entities) but are estimated with noise when TTT is small.
α^i=yˉi−xˉi′β^FE\hat{\alpha}_i = \bar{y}_i - \bar{\mathbf{x}}_i' \hat{\boldsymbol{\beta}}_{\text{FE}}α^i​=yˉ​i​−xˉi′​β^​FE​
yˉi\bar{y}_iyˉ​i​β^FE\hat{\boldsymbol{\beta}}_{\text{FE}}β^​FE​

Step 6

Including N−1N-1N−1 entity dummies as regressors and running OLS produces identical β\betaβ estimates. The FWL theorem states that partialing out a set of regressors (the dummies) from both yyy and xxx before regressing gives the same coefficients. The within transformation is a computationally efficient implementation of this partialing out.
Equivalence to LSDV: β^FE=β^LSDV (Frisch-Waugh-Lovell theorem)\text{Equivalence to LSDV: } \hat{\boldsymbol{\beta}}_{\text{FE}} = \hat{\boldsymbol{\beta}}_{\text{LSDV}} \text{ (Frisch-Waugh-Lovell theorem)}Equivalence to LSDV: β^​FE​=β^​LSDV​ (Frisch-Waugh-Lovell theorem)
β^FE\hat{\boldsymbol{\beta}}_{\text{FE}}β^​FE​

Random effects vs. fixed effects

Random effects assumes Cov⁡(αi,xit)=0\operatorname{Cov}(\alpha_i, x_{it}) = 0Cov(αi​,xit​)=0 and models αi\alpha_iαi​ as a random draw from a population distribution. This allows estimation of time-invariant regressors and is more efficient than FE when the assumption holds. The Hausman test compares FE and RE estimates: if they differ significantly, RE is inconsistent (because the assumption is violated) and FE should be used. In macro panels, the Hausman test almost always rejects RE because countries' unobserved characteristics (institutions, geography) are correlated with observable policy variables.

Notations

y¨it\ddot{y}_{it}y¨​it​

Demeaned outcome

yˉi\bar{y}_iyˉ​i​

Entity mean

β^FE\hat{\boldsymbol{\beta}}_{\text{FE}}β^​FE​

Within estimator

About these symbols

Demeaned outcome: Within-transformed (demeaned) dependent variable: yity_{it}yit​ minus entity mean

Entity mean: Entity i's time-series average of y

Within estimator: Fixed-effects (within) estimator of the slope vector

    Transition checks

    Comparative-static map
    E(θ)={x:F(x;θ)=0},θ0↦E(θ0), θ1↦E(θ1)E(\theta)=\{x: F(x;\theta)=0\},\qquad \theta_0\mapsto E(\theta_0),\ \theta_1\mapsto E(\theta_1)E(θ)={x:F(x;θ)=0},θ0​↦E(θ0​), θ1​↦E(θ1​)

    The plotted object solves an equilibrium system at each parameter vector. A path would require an additional law of motion, such as xt+1=G(xt,θ)x_{t+1} = G(x_t, \theta)xt+1​=G(xt​,θ). Without that law, the model identifies endpoints but not the adjustment between them.

    Read a parameter move as a new equilibrium or schedule position. The segment between two saved scenarios is not a transition law.

    Do not infer speed, overshooting, or smooth adjustment from a static schedule shift.

    Variable timing

    Equilibrium object

    F(x∗;θ)=0F(x^*;\theta)=0F(x∗;θ)=0

    A point or schedule is solved at the current parameter vector. It is not dated unless the model adds a transition law.

    Parameter move

    θ0↦θ1\theta_0\mapsto\theta_1θ0​↦θ1​

    The parameter changes the solved object immediately in the diagram; the diagram does not say how institutions implement that change.

    Keep going

    Read next

    Continue with a related concept, model, or example.

    Theory model

    IS-LM Model

    a well-connected theoretical model two steps from here

    New angle: theoretical model →
    Macro by Mark
    Help
    Privacy PolicyTerms of UseEthics and Compliance

    © 2026 Mark Jayson Nation LLC