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_fixef_plot(model).figanalyze_fixef_plot
analyze_fixef_plot(result_or_model, *, fixef=None, top_n=30, title=None)Plot the estimated group intercepts (fixed effects) of a model, ranked by value.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| result_or_model | Any | A fitted model or a result object carrying .models. |
required |
| fixef | str | None | Which fixed-effect dimension to plot (e.g. "country"). Defaults to the first. |
None |
| top_n | int | None | Show at most this many levels; when there are more, the most extreme (lowest and highest) are kept. None shows every level. |
30 |
| title | str | None | Optional figure title. | None |
Returns
| Name | Type | Description |
|---|---|---|
| FixefPlotResult | df (fixef, level, value) and the Plotly figure. |
Examples
Basic — plot the country fixed effects of a Kuznets-curve model:
Advanced — show only the most extreme levels with a custom title:
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_fixef_plot(
model, fixef="country", top_n=10, title="Country intercepts"
).fig