Exemplo n.º 1
0
def proxy_eink_vorj_elterngeld(
    rentenv_beitr_bemess_grenze: FloatSeries,
    bruttolohn_vorj_m: FloatSeries,
    elterngeld_params: dict,
    eink_st_params: dict,
    eink_st_abzuege_params: dict,
    soli_st_params: dict,
) -> FloatSeries:
    """Calculating the claim for benefits depending on previous wage.

    TODO: This function requires `.fillna(0)` at the end. Investigate!

    Parameters
    ----------
    rentenv_beitr_bemess_grenze
        See :func:`rentenv_beitr_bemess_grenze`.
    bruttolohn_vorj_m
        See basic input variable :ref:`bruttolohn_vorj_m <bruttolohn_vorj_m>`.
    elterngeld_params
        See params documentation :ref:`elterngeld_params <elterngeld_params>`.
    eink_st_params
        See params documentation :ref:`eink_st_params <eink_st_params>`.
    eink_st_abzuege_params
        See params documentation :ref:`eink_st_abzuege_params <eink_st_abzuege_params>`.
    soli_st_params
        See params documentation :ref:`soli_st_params <soli_st_params>`.

    Returns
    -------

    """
    # Relevant wage is capped at the contribution thresholds
    max_wage = bruttolohn_vorj_m.clip(upper=rentenv_beitr_bemess_grenze)

    # We need to deduct lump-sum amounts for contributions, taxes and soli
    prox_ssc = elterngeld_params["elterngeld_soz_vers_pausch"] * max_wage

    # Fictive taxes (Lohnsteuer) are approximated by applying the wage to the tax tariff
    prox_tax = st_tarif(
        (12 * max_wage -
         eink_st_abzuege_params["werbungskostenpauschale"]).clip(lower=0),
        eink_st_params,
    )

    prox_soli = piecewise_polynomial(
        prox_tax,
        thresholds=soli_st_params["soli_st"]["thresholds"],
        rates=soli_st_params["soli_st"]["rates"],
        intercepts_at_lower_thresholds=soli_st_params["soli_st"]
        ["intercepts_at_lower_thresholds"],
    )

    return (max_wage - prox_ssc - prox_tax / 12 - prox_soli / 12).clip(lower=0)
def proxy_eink_vorj_arbeitsl_geld(
    rentenv_beitr_bemess_grenze: FloatSeries,
    bruttolohn_vorj_m: FloatSeries,
    arbeitsl_geld_params: dict,
    eink_st_params: dict,
    eink_st_abzuege_params: dict,
    soli_st_params: dict,
) -> FloatSeries:
    """Approximate last years income for unemployment benefit.

    Parameters
    ----------
    rentenv_beitr_bemess_grenze
        See :func:`rentenv_beitr_bemess_grenze`.
    bruttolohn_vorj_m
        See basic input variable :ref:`bruttolohn_vorj_m <bruttolohn_vorj_m>`.
    arbeitsl_geld_params
        See params documentation :ref:`arbeitsl_geld_params <arbeitsl_geld_params>`.
    eink_st_params
        See params documentation :ref:`eink_st_params <eink_st_params>`.
    eink_st_abzuege_params
        See params documentation :ref:`eink_st_abzuege_params <eink_st_abzuege_params>`.
    soli_st_params
        See params documentation :ref:`soli_st_params <soli_st_params>`.

    Returns
    -------

    """
    # Relevant wage is capped at the contribution thresholds
    max_wage = bruttolohn_vorj_m.clip(lower=None, upper=rentenv_beitr_bemess_grenze)

    # We need to deduct lump-sum amounts for contributions, taxes and soli
    prox_ssc = arbeitsl_geld_params["soz_vers_pausch_arbeitsl_geld"] * max_wage

    # Fictive taxes (Lohnsteuer) are approximated by applying the wage to the tax tariff
    prox_tax = st_tarif(
        12 * max_wage - eink_st_abzuege_params["werbungskostenpauschale"],
        eink_st_params,
    )
    prox_soli = piecewise_polynomial(
        prox_tax,
        thresholds=soli_st_params["soli_st"]["thresholds"],
        rates=soli_st_params["soli_st"]["rates"],
        intercepts_at_lower_thresholds=soli_st_params["soli_st"][
            "intercepts_at_lower_thresholds"
        ],
    )

    return (max_wage - prox_ssc - prox_tax / 12 - prox_soli / 12).clip(lower=0)
def tax_rate_data(start, end):
    """
    For a given year span returns the policy parameters to plot income tax
    rate per income

    sel_year (Int): The year for which the data will be simulated. The range for
                    which parameters can be simulated is 2002-2020.

    returns dict
    """
    years = range(start, end + 1)
    einkommen = pd.Series(data=np.linspace(0, 300000, 601))
    tax_rate_dict_full = {}
    for i in years:
        policy_params, policy_functions = set_up_policy_environment(i)
        eink_params = policy_params["eink_st"]
        soli_params = policy_params["soli_st"]["soli_st"]

        eink_tax = st_tarif(einkommen, eink_params)
        soli = piecewise_polynomial(
            eink_tax,
            thresholds=soli_params["thresholds"],
            rates=soli_params["rates"],
            intercepts_at_lower_thresholds=soli_params[
                "intercepts_at_lower_thresholds"],
        )
        marginal_rate = np.gradient(eink_tax, einkommen)
        overall_marginal_rate = np.gradient(eink_tax + soli, einkommen)
        tax_rate_dict_full[i] = {
            "tax_rate": (eink_tax / einkommen),
            "overall_tax_rate": ((soli + eink_tax) / einkommen),
            "marginal_rate": pd.Series(marginal_rate),
            "overall_marginal_rate": pd.Series(overall_marginal_rate),
            "income": einkommen,
        }

    return tax_rate_dict_full
Exemplo n.º 4
0
def heatmap_data():
    LI = pd.Series(data=np.linspace(0, 310000, 250))  # Labor Income
    CI = pd.Series(data=np.linspace(0, 100000, 250))  # Capital Income

    # Get relevant policy params from GETTSIM
    policy_params, policy_functions = set_up_policy_environment(2020)
    CD = policy_params["eink_st_abzuege"]["sparerpauschbetrag"]
    CTau = policy_params["abgelt_st"][
        "abgelt_st_satz"]  # Capital income tax rate

    TCI = CI - CD  # taxable capital income
    TCI[TCI < 0] = 0  # replace negative taxable income
    CT = TCI * CTau  # Capital income tax

    heatmap_df = pd.DataFrame(columns=LI)

    # Iterate through LI and CI combinations for separate taxes
    for i in range(len(LI)):
        this_column = heatmap_df.columns[i]
        e = pd.Series(data=[LI[i]] * len(LI))
        c = e + CI
        heatmap_df[this_column] = (st_tarif(c, policy_params["eink_st"])) - (
            st_tarif(e, policy_params["eink_st"]) + CT)

    heatmap_df.index = CI

    heatmap_source = pd.DataFrame(heatmap_df.stack(),
                                  columns=["Change to tax burden"
                                           ]).reset_index()
    heatmap_source.columns = [
        "Capital income",
        "Labor income",
        "Change to tax burden",
    ]

    # Data to show where average household per decile is located in heatmap
    deciles = ["", "", "", "", "", "", "", "", "", "P90", "P95", "P99", "P100"]
    capital_income_tax = pd.Series(
        data=[0, 0, 0, 0, 0, 4, 15, 36, 52, 84, 167, 559,
              13873])  # from Bach & Buslei 2017 table 3-2
    capital_income = capital_income_tax / 0.26375
    total_income = pd.Series(data=[
        0,
        -868,
        4569,
        9698,
        14050,
        18760,
        23846,
        29577,
        36769,
        47676,
        63486,
        95899,
        350423,
    ])  # from Bach & Buslei 2017 table 3-2 "Äquivalenzgewichtetes Einkommen"
    labor_income = total_income - capital_income

    household_dict = {
        "deciles": deciles,
        "capital_income": capital_income,
        "labor_income": labor_income,
    }

    return {
        "heatmap_source": heatmap_source,
        "household_dict": household_dict,
    }
Exemplo n.º 5
0
def individiual_view_data():

    LI = pd.Series(data=range(0, 250001, 500))  # Labor Income
    CI = pd.Series(data=range(0, 250001, 500))  # Capital Income
    # np.linspace(-1, 300001, 300001)
    LD = 0.2 * LI  # Assumption
    TTI = LI + CI  # Total Income
    TD = 0.2 * TTI  # Assumption
    TI = TTI - TD  # taxable income

    # Calculate variables separated taxes
    TLI = LI - LD  # taxable labor income

    # Get relevant policy params from GETTSIM
    policy_params, policy_functions = set_up_policy_environment(2020)

    Tau_flat = (
        (st_tarif(TLI, policy_params["eink_st"]) / TLI).fillna(0).round(2)
    )  # Income tax rate - flat

    Tau_integrated = (
        (st_tarif(TI, policy_params["eink_st"]) / TI).fillna(0).round(2)
    )  # Income tax rate - integrated

    CD = pd.Series(
        data=[policy_params["eink_st_abzuege"]["sparerpauschbetrag"]] *
        len(LI))  # Capital income deductions

    CTau = policy_params["abgelt_st"]["abgelt_st_satz"]  # Capital tax rate

    TCI = CI - CD  # taxable capital income
    TCI[TCI < 0] = 0  # replace negative taxable income
    # Calculate variables integrated taxes

    T = (TI * Tau_integrated).round(2)  # Total tax

    # taxable capital income
    LT = (TLI * Tau_flat).round(2)  # Labor income tax
    CT = TCI * CTau  # Capital income tax

    # Net incomes
    NCI = TCI - CT  # Capital
    NLI = (TLI - LT).round(2)  # Labor
    NI = (TI - T).round(2)  # Total

    # blank placeholder
    B = [0] * len(LI)

    data_full = {
        "x_range": [
            "Gross income (S)",
            "Taxable income (S)",
            "Net income (S)",
            "Gross income (R)",
            "Taxable income (R)",
            "Net income (R)",
        ],
        "CI": [CI, B, B, CI, B, B],
        "LI": [LI, B, B, LI, B, B],
        "TI": [B, B, B, B, TI, B],
        "NI": [B, B, B, B, B, NI],
        "T": [B, B, B, B, B, T],
        "CD": [B, CD, CD, B, B, B],
        "LD": [B, LD, B, B, B, B],
        "TCI": [B, TCI, B, B, B, B],
        "TLI": [B, TLI, B, B, B, B],
        "CT": [B, B, CT, B, B, B],
        "LT": [B, B, LT, B, B, B],
        "NCI": [B, B, NCI, B, B, B],
        "NLI": [B, B, NLI, B, B, B],
        "TD": [B, B, B, B, TD, B],
        "LI_list": ["LI", "TLI", "LT", "NLI", "LD"],
        "CI_list": ["CI", "CD", "TCI", "CT", "NCI"],
        "Total_list": ["TI", "NI", "T", "TD"],
        "Final_order": [
            "CI",
            "LI",
            "CD",
            "TCI",
            "TLI",
            "TI",
            "LD",
            "TD",
            "CT",
            "NCI",
            "NLI",
            "LT",
            "NI",
            "T",
        ],
    }

    return data_full