learn_correlated_random_effects

source

learn_correlated_random_effects(
    n_units=60,
    n_periods=8,
    beta=1.0,
    unit_effect_corr=0.8,
    seed=0,
)

Show the Mundlak (correlated random effects) device recovering the fixed-effects slope.

The CRE model adds each unit’s time-mean of the regressor to a random-effects specification. Its coefficient on the original x then equals the within (fixed-effects) estimate, and a Wald test on the added means is the Mundlak (Hausman-equivalent) test.

Parameters

Name Type Description Default
n_units int Panel dimensions. 60
n_periods int Panel dimensions. 60
beta float True within-unit slope. 1.0
unit_effect_corr float Correlation between x and the unit effect. 0.8
seed int Random seed. 0

Returns

Name Type Description
SandboxResult df (CRE-within vs plain FE vs true slope), fig, summary and topic.

Examples

This sandbox simulates its own panel, so the call needs no DataFrame:

import expdpy as ex

res = ex.learn_correlated_random_effects()
res.fig