learn_kuznets_waves

source

learn_kuznets_waves(
    n_units=80,
    n_years=15,
    betas=(0.5, -0.3, 0.05, 0.04),
    between_sd=1.0,
    within_sd=0.9,
    unit_effect_sd=0.5,
    noise=0.05,
    seed=0,
)

Show the three Kuznets-waves estimators recovering a planted polynomial wave.

Simulates a panel y_it = sum_k betas[k-1] * g_it^k + a_i + d_t + e_it where the development index g_it = xbar_i + w_it mixes a cross-unit component (between_sd) and a within-unit component (within_sd), and the unit effect a_i and year effect d_t are drawn independently of g (so they bias none of the estimators). Because the planted wave is a within-unit relationship, the within (two-way fixed-effects) and pooled estimators recover the top-order coefficient, while the between estimator — comparing unit averages — differs, since averaging a nonlinear function is not the function of the average. Demonstrated with :func:expdpy.analyze_kuznets_waves.

Parameters

Name Type Description Default
n_units int Panel dimensions. 80
n_years int Panel dimensions. 80
betas tuple[float, …] The planted polynomial coefficients (b_1, ..., b_degree) on g, g^2, ...; its length sets the degree (default the quartic (0.5, -0.3, 0.05, 0.04)). (0.5, -0.3, 0.05, 0.04)
between_sd float Standard deviations of the cross-unit and within-unit components of g. 1.0
within_sd float Standard deviations of the cross-unit and within-unit components of g. 1.0
unit_effect_sd float Standard deviation of the unit and year effects in the outcome (independent of g). 0.5
noise float Idiosyncratic shock standard deviation. 0.05
seed int Random seed. 0

Returns

Name Type Description
SandboxResult df (the top-order coefficient recovered by each estimator vs the true value), fig (the within partial-residual wave), summary and topic.

Examples

This sandbox simulates its own panel with a planted polynomial wave, so the call needs no DataFrame:

import expdpy as ex

res = ex.learn_kuznets_waves()
res.fig