Skip to content
Merged
20 changes: 11 additions & 9 deletions outdated_docs/how-to-guides/calculating_elterngeld.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
"\n",
"In principle, one can compute Elterngeld in three steps:\n",
"1. Compute the average monthly gross income before birth in the data.\n",
"2. Call GETTSIM with the target `elterngeld__nettoeinkommen_approximation_m` using the policy\n",
"2. Call GETTSIM with the target `elterngeld__mean_nettoeinkommen_für_bemessungsgrundllage_nach_geburt_m` using the policy\n",
" environment of the year **before** the child was born.\n",
"3. Call GETTSIM with the target `elterngeld__betrag_m` using the outcome of step 2 as the input\n",
" for `elterngeld__nettoeinkommen_vorjahr_m` and the policy environment of the year the\n",
" for `elterngeld__mean_nettoeinkommen_in_12_monaten_vor_geburt_m` and the policy environment of the year the\n",
" child was born.\n",
"\n",
"In the following, we will explain some more details."
Expand Down Expand Up @@ -114,8 +114,8 @@
"### Step 2: Approximate net wage before birth\n",
"\n",
"GETTSIM provides an easy way to compute the relevant net wage\n",
"`elterngeld__nettoeinkommen_vorjahr_m` based on step 1 using the target\n",
"`elterngeld__nettoeinkommen_approximation_m`.\n",
"`elterngeld__mean_nettoeinkommen_in_12_monaten_vor_geburt_m` based on step 1 using the target\n",
"`elterngeld__mean_nettoeinkommen_für_bemessungsgrundllage_nach_geburt_m`.\n",
"\n",
"We use the policy environment of January 1st of the year before the child was born (§2e\n",
"Abs. 1 S. 2 BEEG). Note that this is correct regardless of the point in time when the\n",
Expand All @@ -135,7 +135,7 @@
"net_wage_approximation = compute_taxes_and_transfers(\n",
" data=data_before_birth,\n",
" environment=environment_2023,\n",
" targets=[\"elterngeld__nettoeinkommen_approximation_m\"],\n",
" targets=[\"elterngeld__mean_nettoeinkommen_für_bemessungsgrundllage_nach_geburt_m\"],\n",
")\n",
"\n",
"net_wage_approximation"
Expand Down Expand Up @@ -184,7 +184,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Then, we add `elterngeld__nettoeinkommen_vorjahr_m` to the data based on step 2."
"Then, we add `elterngeld__mean_nettoeinkommen_in_12_monaten_vor_geburt_m` to the data based on step 2."
]
},
{
Expand All @@ -194,9 +194,11 @@
"outputs": [],
"source": [
"# Add net wage approximation\n",
"data_after_birth[\"elterngeld__nettoeinkommen_vorjahr_m\"] = net_wage_approximation[\n",
" \"elterngeld__nettoeinkommen_approximation_m\"\n",
"]"
"data_after_birth[\"elterngeld__mean_nettoeinkommen_in_12_monaten_vor_geburt_m\"] = (\n",
" net_wage_approximation[\n",
" \"elterngeld__mean_nettoeinkommen_für_bemessungsgrundllage_nach_geburt_m\"\n",
" ]\n",
")"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion src/_gettsim/arbeitslosengeld_2/inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

@policy_input(start_date="2023-01-01")
def bezug_im_vorjahr() -> bool:
"""Whether the person received Arbeitslosengeld 2 / Bürgergeld in the previous year."""
"""Person received Arbeitslosengeld 2 / Bürgergeld in the last 12 months."""


# TODO(@MImmesberger): Remove input variable eigenbedarf_gedeckt once
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,3 @@
@policy_input()
def bruttolohn_m() -> float:
"""Monthly wage."""


@policy_input()
def bruttolohn_vorjahr_m() -> float:
"""Monthly wage of previous year."""
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,6 @@ def alle_weiteren_m() -> float:
"""


@policy_input(start_date="2021-01-01")
def gesamtbetrag_vorjahr_m() -> float:
"""Income from private and public pensions in the previous year.

GETTSIM can calculate this input based on the data of the previous year using the
target `("einkommensteuer", "einkünfte", "sonstige", "betrag_m")`.
"""


@policy_input()
def sonstige_private_vorsorge_m() -> float:
"""Monthly payout from private pensions without tax-favored contributions.
Expand Down
10 changes: 5 additions & 5 deletions src/_gettsim/elterngeld/einkommen.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ def anzurechnendes_nettoeinkommen_m(
rounding_spec=RoundingSpec(base=2, direction="down", reference="§ 2 (2) BEEG"),
)
def lohnersatzanteil_einkommen_untere_grenze(
nettoeinkommen_vorjahr_m: float,
mean_nettoeinkommen_in_12_monaten_vor_geburt_m: float,
nettoeinkommensstufen_für_lohnersatzrate: dict[str, float],
) -> float:
"""Lower threshold for replacement rate adjustment minus net income."""
return (
nettoeinkommensstufen_für_lohnersatzrate["lower_threshold"]
- nettoeinkommen_vorjahr_m
- mean_nettoeinkommen_in_12_monaten_vor_geburt_m
)


Expand All @@ -42,12 +42,12 @@ def lohnersatzanteil_einkommen_untere_grenze(
rounding_spec=RoundingSpec(base=2, direction="down", reference="§ 2 (2) BEEG"),
)
def lohnersatzanteil_einkommen_obere_grenze(
nettoeinkommen_vorjahr_m: float,
mean_nettoeinkommen_in_12_monaten_vor_geburt_m: float,
nettoeinkommensstufen_für_lohnersatzrate: dict[str, float],
) -> float:
"""Net income minus upper threshold for replacement rate adjustment."""
return (
nettoeinkommen_vorjahr_m
mean_nettoeinkommen_in_12_monaten_vor_geburt_m
- nettoeinkommensstufen_für_lohnersatzrate["upper_threshold"]
)

Expand Down Expand Up @@ -102,7 +102,7 @@ def einkommen_vorjahr_unter_bezugsgrenze_ohne_unterscheidung_single_paar(
start_date="2012-09-18",
rounding_spec=RoundingSpec(base=0.01, direction="down"),
)
def nettoeinkommen_approximation_m(
def mean_nettoeinkommen_für_bemessungsgrundllage_nach_geburt_m(
einkommensteuer__einkünfte__aus_nichtselbstständiger_arbeit__bruttolohn_m: float,
lohnsteuer__betrag_m: float,
lohnsteuer__betrag_soli_m: float,
Expand Down
12 changes: 6 additions & 6 deletions src/_gettsim/elterngeld/elterngeld.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def betrag_m(

@policy_function(start_date="2007-01-01")
def basisbetrag_m(
nettoeinkommen_vorjahr_m: float,
mean_nettoeinkommen_in_12_monaten_vor_geburt_m: float,
lohnersatzanteil: float,
anzurechnendes_nettoeinkommen_m: float,
max_zu_berücksichtigendes_einkommen: float,
Expand All @@ -96,7 +96,7 @@ def basisbetrag_m(

"""
berücksichtigtes_einkommen = min(
nettoeinkommen_vorjahr_m,
mean_nettoeinkommen_in_12_monaten_vor_geburt_m,
max_zu_berücksichtigendes_einkommen,
)
return (
Expand Down Expand Up @@ -212,7 +212,7 @@ def bezugsmonate_unter_grenze_fg(

@policy_function(start_date="2011-01-01")
def lohnersatzanteil(
nettoeinkommen_vorjahr_m: float,
mean_nettoeinkommen_in_12_monaten_vor_geburt_m: float,
lohnersatzanteil_einkommen_untere_grenze: float,
lohnersatzanteil_einkommen_obere_grenze: float,
einkommensschritte_korrektur: float,
Expand All @@ -229,9 +229,9 @@ def lohnersatzanteil(
"""
# Higher replacement rate if considered income is below a threshold
if (
nettoeinkommen_vorjahr_m
mean_nettoeinkommen_in_12_monaten_vor_geburt_m
< nettoeinkommensstufen_für_lohnersatzrate["lower_threshold"]
and nettoeinkommen_vorjahr_m > 0
and mean_nettoeinkommen_in_12_monaten_vor_geburt_m > 0
):
out = satz + (
lohnersatzanteil_einkommen_untere_grenze
Expand All @@ -240,7 +240,7 @@ def lohnersatzanteil(
)
# Lower replacement rate if considered income is above a threshold
elif (
nettoeinkommen_vorjahr_m
mean_nettoeinkommen_in_12_monaten_vor_geburt_m
> nettoeinkommensstufen_für_lohnersatzrate["upper_threshold"]
):
# Replacement rate is only lowered up to a specific value
Expand Down
16 changes: 13 additions & 3 deletions src/_gettsim/elterngeld/inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,20 @@ def claimed() -> bool:


@policy_input()
def nettoeinkommen_vorjahr_m() -> float:
"""Net wage in the 12 months before birth of youngest child."""
def mean_nettoeinkommen_in_12_monaten_vor_geburt_m() -> float:
"""Mean net wage in the 12 months before birth of youngest child.

To compute this value using GETTSIM set `('elterngeld',
'mean_nettoeinkommen_für_bemessungsgrundllage_nach_geburt_m')` as the TT target and
use input data from the last 12 months before the birth of the youngest child.
"""


@policy_input()
def zu_versteuerndes_einkommen_vorjahr_y_sn() -> float:
"""Taxable income in the calendar year prior to the youngest child's birth year."""
"""Taxable income in the calendar year prior to the youngest child's birth year.

To compute this value using GETTSIM set `('einkommensteuer',
'zu_versteuerndes_einkommen_y_sn')` as the TT target and use input data from the
calendar year prior to the youngest child's birth year.
"""
77 changes: 34 additions & 43 deletions src/_gettsim/erziehungsgeld/erziehungsgeld.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,40 +99,34 @@ def erziehungsgeld_kind_ohne_budgetsatz_m() -> NotImplementedError:
)
def anspruchshöhe_kind_mit_budgetsatz_m(
ist_leistungsbegründendes_kind: bool,
abzug_durch_einkommen_m: float,
abzug_durch_einkommen_m_fg: float,
basisbetrag_m: float,
) -> float:
"""Parental leave benefit (Erziehungsgeld) on child level.

For the calculation, the relevant income, the age of the youngest child, the income
threshold and the eligibility for erziehungsgeld is needed.

Legal reference: Bundesgesetzblatt Jahrgang 2004 Teil I Nr. 6
Legal reference: BGBl I. v. 17.02.2004
"""
if ist_leistungsbegründendes_kind:
out = max(
basisbetrag_m - abzug_durch_einkommen_m,
0.0,
)
return max(basisbetrag_m - abzug_durch_einkommen_m_fg, 0.0)
else:
out = 0.0

return out
return 0.0


@policy_function(start_date="2004-01-01", end_date="2008-12-31")
def basisbetrag_m(
budgetsatz: bool,
anzurechnendes_einkommen_y: float,
einkommensgrenze_y: float,
anzurechnendes_einkommen_y_fg: float,
einkommensgrenze_y_fg: float,
alter_monate: int,
altersgrenze_für_reduziertes_einkommenslimit_kind_monate: int,
satz: dict[str, float],
) -> float:
"""Parental leave benefit (Erziehungsgeld) without means-test on child level."""
# no benefit if income is above threshold and child is younger than threshold
if (
anzurechnendes_einkommen_y > einkommensgrenze_y
anzurechnendes_einkommen_y_fg > einkommensgrenze_y_fg
and alter_monate < altersgrenze_für_reduziertes_einkommenslimit_kind_monate
):
out = 0.0
Expand All @@ -145,22 +139,22 @@ def basisbetrag_m(


@policy_function(start_date="2004-01-01", end_date="2008-12-31")
def abzug_durch_einkommen_m(
anzurechnendes_einkommen_m: float,
einkommensgrenze_m: float,
def abzug_durch_einkommen_m_fg(
anzurechnendes_einkommen_m_fg: float,
einkommensgrenze_m_fg: float,
alter_monate: int,
altersgrenze_für_reduziertes_einkommenslimit_kind_monate: float,
abschlagsfaktor: float,
) -> float:
"""Reduction of parental leave benefits (means-test).

Legal reference: Bundesgesetzblatt Jahrgang 2004 Teil I Nr. 6 (p.209)
Legal reference: BGBl I. v. 17.02.2004 S.209
"""
if (
anzurechnendes_einkommen_m > einkommensgrenze_m
anzurechnendes_einkommen_m_fg > einkommensgrenze_m_fg
and alter_monate >= altersgrenze_für_reduziertes_einkommenslimit_kind_monate
):
out = anzurechnendes_einkommen_m * abschlagsfaktor
out = anzurechnendes_einkommen_m_fg * abschlagsfaktor
else:
out = 0.0
return out
Expand All @@ -180,7 +174,7 @@ def _leistungsbegründendes_kind_vor_abschaffung(
) -> bool:
"""Eligibility for parental leave benefit (Erziehungsgeld) on child level.

Legal reference: Bundesgesetzblatt Jahrgang 2004 Teil I Nr. 6 (pp.207)
Legal reference: BGBl I. v. 17.02.2004 S.207
"""
if budgetsatz:
out = p_id_empfänger >= 0 and alter_monate <= maximales_kindsalter_budgetsatz
Expand Down Expand Up @@ -216,7 +210,7 @@ def _leistungsbegründendes_kind_nach_abschaffung(

Abolished for children born after the cut-off date.

Legal reference: Bundesgesetzblatt Jahrgang 2004 Teil I Nr. 6 (pp.207)
Legal reference: BGBl I. v. 17.02.2004 S.207
"""
if budgetsatz and geburtsjahr <= abolishment_cohort:
out = p_id_empfänger >= 0 and alter_monate <= maximales_kindsalter_budgetsatz
Expand All @@ -238,57 +232,54 @@ def grundsätzlich_anspruchsberechtigt(
) -> bool:
"""Eligibility for parental leave benefit (Erziehungsgeld) on parental level.

Legal reference: Bundesgesetzblatt Jahrgang 2004 Teil I Nr. 6 (p.207)
Legal reference: BGBl I. v. 17.02.2004 S.207
"""
return leistungsbegründende_kinder_fg and (
arbeitsstunden_w <= maximale_wochenarbeitszeit
)


@policy_function(start_date="2004-01-01", end_date="2008-12-31")
def anzurechnendes_einkommen_y(
einkommensteuer__einkünfte__aus_nichtselbstständiger_arbeit__bruttolohn_vorjahr_y_fg: float,
familie__anzahl_erwachsene_fg: int,
def anzurechnendes_einkommen_y_fg(
bruttolohn_vorjahr_nach_abzug_werbungskosten_y_fg: float,
ist_leistungsbegründendes_kind: bool,
pauschaler_abzug_vom_einkommen: float,
einkommensteuer__einkünfte__aus_nichtselbstständiger_arbeit__arbeitnehmerpauschbetrag: float,
) -> float:
"""Income relevant for means testing for parental leave benefit (Erziehungsgeld).

Legal reference: Bundesgesetzblatt Jahrgang 2004 Teil I Nr. 6 (p.209)
Legal reference: BGBl I. v. 17.02.2004 S.209

There is special rule for "Beamte, Soldaten und Richter" which is not
implemented yet.
"""
if ist_leistungsbegründendes_kind:
out = (
einkommensteuer__einkünfte__aus_nichtselbstständiger_arbeit__bruttolohn_vorjahr_y_fg
- einkommensteuer__einkünfte__aus_nichtselbstständiger_arbeit__arbeitnehmerpauschbetrag
* familie__anzahl_erwachsene_fg
) * pauschaler_abzug_vom_einkommen
bruttolohn_vorjahr_nach_abzug_werbungskosten_y_fg
* pauschaler_abzug_vom_einkommen
)
else:
out = 0.0
return out


@policy_function(start_date="2004-01-01", end_date="2008-12-31")
def einkommensgrenze_y(
def einkommensgrenze_y_fg(
einkommensgrenze_ohne_geschwisterbonus: float,
familie__anzahl_kinder_fg: float,
ist_leistungsbegründendes_kind: bool,
aufschlag_einkommen: float,
) -> float:
"""Income threshold for parental leave benefit (Erziehungsgeld).

Legal reference: Bundesgesetzblatt Jahrgang 2004 Teil I Nr. 6 (pp.208)
Legal reference: BGBl I. v. 17.02.2004 S.208
"""
out = (
einkommensgrenze_ohne_geschwisterbonus
+ (familie__anzahl_kinder_fg - 1) * aufschlag_einkommen
)
if not ist_leistungsbegründendes_kind:
out = 0.0
return out
if ist_leistungsbegründendes_kind:
return (
einkommensgrenze_ohne_geschwisterbonus
+ (familie__anzahl_kinder_fg - 1) * aufschlag_einkommen
)
else:
return 0.0


@policy_function(start_date="2004-01-01", end_date="2008-12-31")
Expand All @@ -301,7 +292,7 @@ def einkommensgrenze_ohne_geschwisterbonus(
"""Income threshold for parental leave benefit (Erziehungsgeld) before adding the
bonus for additional children.

Legal reference: Bundesgesetzblatt Jahrgang 2004 Teil I Nr. 6 (pp.208)
Legal reference: BGBl I. v. 17.02.2004 S.208
"""
if alter_monate < altersgrenze_für_reduziertes_einkommenslimit_kind_monate:
return einkommensgrenze_ohne_geschwisterbonus_kind_jünger_als_reduzierungsgrenze
Expand All @@ -317,7 +308,7 @@ def einkommensgrenze_ohne_geschwisterbonus_kind_jünger_als_reduzierungsgrenze(
) -> float:
"""Base income threshold for parents of children younger than the age threshold.

Legal reference: Bundesgesetzblatt Jahrgang 2004 Teil I Nr. 6 (pp.208)
Legal reference: BGBl I. v. 17.02.2004 S.208
"""
if budgetsatz and familie__alleinerziehend_fg:
return einkommensgrenze.regulär_alleinerziehend["budgetsatz"]
Expand All @@ -337,7 +328,7 @@ def einkommensgrenze_ohne_geschwisterbonus_kind_älter_als_reduzierungsgrenze(
) -> float:
"""Base income threshold for parents of children older than age threshold.

Legal reference: Bundesgesetzblatt Jahrgang 2004 Teil I Nr. 6 (pp.208)
Legal reference: BGBl I. v. 17.02.2004 S.208
"""
if budgetsatz and familie__alleinerziehend_fg:
return einkommensgrenze.reduziert_alleinerziehend["budgetsatz"]
Expand Down
Loading
Loading