analyze_joint_test

source

analyze_joint_test(result_or_model, hypotheses=None, *, distribution='F')

Run a Wald joint-significance test that a set of coefficients are all zero.

Parameters

Name Type Description Default
result_or_model Any A fitted model or a result object carrying .models. required
hypotheses Sequence[str] | str | None Coefficient name(s) to test jointly. None tests all coefficients at once. None
distribution str Reference distribution: "F" (default) or "chi2". 'F'

Returns

Name Type Description
JointTestResult statistic, p_value, the tested hypotheses and the distribution.

Examples

Basic — jointly test the two nonlinear Kuznets terms:

import expdpy as ex
from expdpy.data import load_kuznets, load_kuznets_data_def

df = ex.set_labels(load_kuznets(), load_kuznets_data_def(), set_panel=True)
model = ex.analyze_regression_table(
    df,
    dvs="gini_regional",
    idvs=["log_gdp_pc", "log_gdp_pc_sq", "log_gdp_pc_cu"],
    feffects=["country"],
)
test = ex.analyze_joint_test(model, ["log_gdp_pc_sq", "log_gdp_pc_cu"])
test.statistic, test.p_value
/home/runner/work/expdpy/expdpy/.pixi/envs/docs/lib/python3.12/site-packages/pyfixest/estimation/models/feols_.py:1248: UserWarning: Distribution changed to chi2, as R is not an identity matrix and q is not a zero vector.
  warnings.warn(
(808.3469121726026, 2.9491596950848244e-176)

Advanced — test all slope coefficients at once against a chi-square reference:

import expdpy as ex
from expdpy.data import load_kuznets, load_kuznets_data_def

df = ex.set_labels(load_kuznets(), load_kuznets_data_def(), set_panel=True)
model = ex.analyze_regression_table(
    df,
    dvs="gini_regional",
    idvs=["log_gdp_pc", "log_gdp_pc_sq", "log_gdp_pc_cu"],
    feffects=["country"],
)
ex.analyze_joint_test(model, distribution="chi2").p_value
2.036832873048353e-181