예제 #1
0
파일: charts.py 프로젝트: mgilbert1/microdf
UBI_PP = 10000
reform['ubi'] = reform.XTOT * UBI_PP
reform['aftertax_income'] = reform.aftertax_income + reform.ubi
mdf.add_weighted_metrics(reform, 'aftertax_income')

## Charts

### Change to income percentiles

ax = mdf.quantile_chg_plot(base.aftertax_income, reform.aftertax_income,
                      base.XTOT_m, reform.XTOT_m)
plt.show()

### Percent change to income percentiles

mdf.quantile_pct_chg_plot(base.aftertax_income, reform.aftertax_income,
                          base.XTOT_m, reform.XTOT_m)
plt.show()

Make the title and labels more descriptive to this data.

mdf.quantile_pct_chg_plot(base.aftertax_income, reform.aftertax_income,
                          base.XTOT_m, reform.XTOT_m)
# Note: Must set `loc='left'`, otherwise two titles will overlap.
plt.title('Change to disposable income percentiles', loc='left')
plt.xlabel('Disposable income percentile')
plt.ylabel('Change to disposable income at the percentile boundary')
plt.show()

### Other percentiles and labels

mdf.quantile_chg_plot(base.aftertax_income, reform.aftertax_income,
예제 #2
0
def test_quantile_pct_chg_plot():
    mdf.quantile_pct_chg_plot(DF1, DF2, 'v', 'w', 'v', 'w')
예제 #3
0
def test_quantile_pct_chg_plot():
    mdf.quantile_pct_chg_plot(DF1, DF2, "v", "w", "v", "w")
        ),
        loc="left",
        y=1.05,
        fontsize=24,
    )
    return ax


ax = dist_plot("ei_bin", "pct_chg_bin", "household_weight")
plt.show()

# Reform 1 Quantile % change to disposable income
mdf.quantile_pct_chg_plot(
    df1=df,
    df2=df,
    col1="baseline_equiv_household_net_income_bhc",
    col2="reform_1_equiv_household_net_income_bhc",
    w1="household_weight",
    w2="household_weight",
)

# Note: Must set `loc='left'`, otherwise two titles will overlap.
plt.title("Reform 1: Change to disposable income percentiles", loc="left")
plt.xlabel("Disposable income percentile")
plt.ylabel("Change to disposable income at the percentile boundary")
plt.show()

# Reform 2 Quantile % change to disposable income
mdf.quantile_pct_chg_plot(
    df1=df,
    df2=df,
    col1="baseline_equiv_household_net_income_bhc",
예제 #5
0
def test_quantile_pct_chg_plot():
    mdf.quantile_pct_chg_plot(v1=V1, v2=V2, w1=W1, w2=W2)