Skip to content
Merged
Show file tree
Hide file tree
Changes from 56 commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
263c51b
Update elterngeld.py
ThOrtmann May 13, 2024
35bebb0
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 13, 2024
c200412
Update hh_id_1.yaml
ThOrtmann May 13, 2024
0a2894e
Update hh_id_1.yaml
ThOrtmann May 13, 2024
b781e65
Update hh_id_8.yaml
ThOrtmann May 13, 2024
43af73b
Update test_full_taxes_and_transfers.py
ThOrtmann May 13, 2024
efb8be5
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 13, 2024
2825933
Update test_full_taxes_and_transfers.py
ThOrtmann May 13, 2024
d5eb80b
Update hh_id_3.yaml
ThOrtmann May 13, 2024
47a8a55
Update test_full_taxes_and_transfers.py
ThOrtmann May 14, 2024
5e189fc
Update elterngeld.py
ThOrtmann May 14, 2024
4e7c419
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 14, 2024
e08ad61
Update elterngeld.yaml
ThOrtmann May 15, 2024
ad6122d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 15, 2024
f5550a4
Update elterngeld.yaml
ThOrtmann May 15, 2024
d469b81
Update elterngeld.py
ThOrtmann May 15, 2024
9dea761
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 15, 2024
712436a
Fix indentation error.
hmgaudecker May 15, 2024
08c750a
Merge branch 'some_elterngeld_fixes' of github.com:iza-institute-of-l…
hmgaudecker May 15, 2024
de1e7cc
Closes #756
ThOrtmann May 27, 2024
e8827b6
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 27, 2024
5aaca2a
Updated Tests as well as the config.py files to
ThOrtmann May 30, 2024
9bbed96
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 30, 2024
0c1a608
updated max_eink parameters
ThOrtmann May 30, 2024
dea89c7
Merge branch 'main' into some_elterngeld_fixes
MImmesberger Aug 27, 2024
5a1aaa8
Update parameter file.
MImmesberger Aug 27, 2024
df8819f
Start to adjust module to new machinery.
MImmesberger Aug 28, 2024
dd67b37
Add todos.
MImmesberger Aug 28, 2024
981db5c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 28, 2024
8bf8a37
Continue with Geschwisterbonus and move Elterngeld eligibility to fg …
MImmesberger Aug 28, 2024
fe5565d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 28, 2024
2bcadea
Continue with restructuring, income t-1 and empfänger still missing.
MImmesberger Aug 29, 2024
d94e183
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 29, 2024
c35e08b
Finish restructuring, still need to adjust net wage approximation.
MImmesberger Aug 29, 2024
7b52bfb
Add Elterngeld Nettolohn Vorjahr target and do some clean up.
MImmesberger Aug 30, 2024
80f7fb2
Fix vectorization test.
MImmesberger Aug 30, 2024
8ab7c03
Credits.
MImmesberger Aug 30, 2024
a80127f
Change anrechenbares Einkommen and adjust some test files.
MImmesberger Aug 30, 2024
9f6b837
Fix full_tt tests, more clean up.
MImmesberger Aug 30, 2024
f7ace99
Fix regression test.
MImmesberger Aug 30, 2024
e007f5d
Adjust Elterngeld tests.
MImmesberger Aug 30, 2024
15b9ee7
Add regression tests for 2024.
MImmesberger Aug 30, 2024
b8ee997
Typos.
MImmesberger Aug 30, 2024
559bf07
Remove old target.
MImmesberger Aug 30, 2024
933c9a9
Test net wage approximation.
MImmesberger Aug 30, 2024
6af4eba
Clean up.
MImmesberger Aug 30, 2024
6dea561
Jakobs comments.
MImmesberger Sep 5, 2024
7655609
Some more fixes.
MImmesberger Sep 5, 2024
52e1179
Merge branch 'main' into some_elterngeld_fixes
MImmesberger Sep 7, 2024
3ac1da2
First set of comments.
MImmesberger Sep 7, 2024
caf1a09
Optional smoothing of replacement rate.
MImmesberger Sep 7, 2024
86915e6
Update hooks so that we don't end up with conflicts in policy-functio…
hmgaudecker Sep 7, 2024
242e84c
Fix bug and add regression test.
MImmesberger Sep 8, 2024
fa34d53
Merge branch 'some_elterngeld_fixes' of https://github.com/iza-instit…
MImmesberger Sep 8, 2024
da4b008
Add notebook howto Elterngeld calculation.
MImmesberger Sep 10, 2024
f6e2129
Update a paragraph.
hmgaudecker Sep 11, 2024
02c01ce
Adjust notebook and round Elterngeld.
MImmesberger Sep 11, 2024
d4e13c5
Fix bug that occurs after May 2024.
MImmesberger Sep 11, 2024
37b7df5
Update text with gist of Github discussion.
hmgaudecker Sep 11, 2024
0892ca6
Adjust notebook slightly.
MImmesberger Sep 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ repos:
- id: blacken-docs
# exclude: docs/source/how_to_guides/optimization/how_to_specify_constraints.md
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.3
rev: v0.6.4
hooks:
- id: ruff
# args:
Expand Down
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ releases are available on [Anaconda.org](https://anaconda.org/conda-forge/gettsi

## Unpublished

- {gh}`756` Refactor Elterngeld module and some small fixes ({ghuser}`MImmesberger`,
{ghuser}`ThOrtmann`).
- {gh}`790` Add unterhaltsvors implementation 2009 to 2016 ({ghuser}`mjbloemer`).
- {gh}`788` Pension benefit earnings test for early retirees ({ghuser}`MImmesberger`).
- {gh}`786` Check directly whether child and parent are in same Bedarfsgemeinschaft for
Expand Down
53 changes: 33 additions & 20 deletions docs/gettsim_objects/input_variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,11 +247,40 @@ Weekly working hours of individual

Type: float

(elterngeld_claimed)=

## `elterngeld_claimed`

Individual claims Elterngeld

Type: bool

(elterngeld_nettoeinkommen_vorjahr_m)=

## `elterngeld_nettoeinkommen_vorjahr_m`

Approximation of the net wage in the 12 months before birth of youngest child (according
to simplified calculation rules). You may let GETTSIM compute this variable via the
`elterngeld_nettolohn_approximation_m` target in a separate run, which would typically
be for the previous calendar year.

Type: float

(elterngeld_zu_verst_eink_vorjahr_y_sn)=

## `elterngeld_zu_verst_eink_vorjahr_y_sn`

Taxable income in the 12 months before birth of youngest child. You may let GETTSIM
compute this variable via the `_zu_verst_eink_mit_kinderfreib_y_sn` target in a separate
run, which would typically be for the previous calendar year.

Type: float

(bruttolohn_vorj_m)=

## `bruttolohn_vorj_m`

Monthly wage, previous year
Gross wage in the previous year

Type: float

Expand Down Expand Up @@ -295,27 +324,11 @@ Month of retirement

Type: int

(m_elterngeld)=

## `m_elterngeld`

Number of months hh received elterngeld

Type: int

(m_elterngeld_vat_hh)=

## `m_elterngeld_vat_hh`

Number of months father received elterngeld

Type: int

(m_elterngeld_mut_hh)=
(monate_elterngeldbezug)=

## `m_elterngeld_mut_hh`
## `monate_elterngeldbezug`

Number of months mother received elterngeld
Number of months the individual received Elterngeld for the current youngest child.

Type: int

Expand Down
211 changes: 211 additions & 0 deletions docs/how_to_guides/calculating_elterngeld.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,211 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# How to calculate Elterngeld\n",
"\n",
"Elterngeld (parental leave benefit) is a financial support for parents in the first\n",
"months after the birth of a child. It replaces some share of the income before birth\n",
"(usually about 67% of net income). This net income is approximated using simplified\n",
"calculation rules. This document explains how to calculate Elterngeld\n",
"based on historical income data for a given household.\n",
"\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_nettolohn_approximation_m`.\n",
"3. Call GETTSIM with the target `elterngeld_m` using the outcome of step 2 as the input\n",
" for `elterngeld_nettoeinkommen_vorjahr_m`.\n",
"\n",
"In the following, we will explain some more details."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example\n",
"\n",
"In the following, we compute Elterngeld for a child that is born in July 2024. The\n",
"parent that receives Elterngeld had a monthly gross wage of 2000€ in the 12 months\n",
"before birth of the child.\n",
"\n",
"### Step 1: Compute the average monthly gross income before birth\n",
"\n",
"If income from dependent employment is the only source of income, the basis for the\n",
"Elterngeld calculation is the average monthly gross income in the 12 months before the\n",
"birth of a child. In our case, this would be July 2023 until June 2024. If other income\n",
"sources exist, the basis is the average monthly gross income in the calendar year before\n",
"the birth of the child, 2023 in our example. We will stick to the first case here\n",
"because:\n",
"\n",
"> **Note**: The Elterngeld implementation in GETTSIM does currently not consider income\n",
"> from self-employment or other sources. See\n",
"> [this](https://github.com/iza-institute-of-labor-economics/gettsim/issues/613) issue.\n",
"\n",
"So let's stick to the case where income from dependent employment is the only source of\n",
"income. You can compute this directly if you have monthly information on gross income\n",
"(e.g. IAB or DRV data). If you have only annual income data, you must choose an\n",
"approximation. In most cases, a good approximation is the income of the year before\n",
"birth.\n",
"\n",
"Here, we use made-up data using the `create_synthetic_data` function.\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from gettsim import (\n",
" compute_taxes_and_transfers,\n",
" create_synthetic_data,\n",
" set_up_policy_environment,\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"params, functions = set_up_policy_environment(2024)\n",
"\n",
"data_before_birth = create_synthetic_data(\n",
" n_adults=2,\n",
" n_children=0,\n",
" specs_heterogeneous={\n",
" \"bruttolohn_m\": [[2000.0, 0.0]],\n",
" },\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### 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 `elterngeld_nettolohn_approximation_m`."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"net_wage_approximation = compute_taxes_and_transfers(\n",
" data=data_before_birth,\n",
" functions=functions,\n",
" params=params,\n",
" targets=[\"elterngeld_nettolohn_approximation_m\"],\n",
")\n",
"\n",
"net_wage_approximation"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Step 3: Compute Elterngeld\n",
"\n",
"Finally, we can compute Elterngeld using the target `elterngeld_m` and the net wage\n",
"information from step 2.\n",
"\n",
"The reason for not doing this in one GETTSIM call (together with step 2) is that \n",
"1. the correct policy date of the net wage calculation (step 2) is always January 1st of\n",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought @JakobWegmann linked a law/directive saying that the parameters throughout the larger part of the year before birth mattered? So for a kid born in March, it would be 2023. For a kid born in November, 2024? Again, I'd argue for keeping our the standard approximation using the previous year, but we should be precise here, also for our own sanity when reading it down the road.

Copy link
Collaborator

@MImmesberger MImmesberger Sep 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One law, three different interpretations 😅

§2e BEEG Abs. 1 Satz 2:

Die Abzüge für Steuern werden einheitlich für Einkommen aus nichtselbstständiger und selbstständiger Erwerbstätigkeit auf Grundlage einer Berechnung anhand des am 1. Januar des Kalenderjahres vor der Geburt des Kindes für dieses Jahr geltenden Programmablaufplans [...] ermittelt.

My interpretation is that the relevant parameters are the ones of the year before (i.e. child born in December 2024, parameters of January 1st 2023 are considered). I'll adjust the notebook accordingly, but intervene if you understand the law differently.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be my interpretation of the text, too! @JakobWegmann, could you weigh in one last time?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, 1st of January of the calendar year before birth is correct (no matter the birth month).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought @JakobWegmann linked a law/directive saying that the parameters throughout the larger part of the year before birth mattered?

For the sake of completeness: That was about the input values of the function, so Steuerklasse, place of residence, church tax,...

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent, if all of you (@MImmesberger @JakobWegmann and maybe also @pia-molitor ?) could just read through the notebook text and fix any errors in my summary (+maybe add a link to the application form, Jakob?), we'll be good to go!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No complaints from my side.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks very good!

A direct link to a PDF: https://www.zbfs.bayern.de/imperia/md/content/zbfs_intranet/produktgruppe_i/formulare/beeg-antrag/2021_09_anlage_n_mit_info_.pdf

I find this part a bit confusing:

The Lohnsteuerklasse is always set on a yearly basis; if it changes with the start of the calendar year a child is born, the date of birth matters. Up to June, the Lohnsteuerklasse from the previous calendar year will be relevant; for July or later, the Lohnsteuerklasse from the current calendar year will be relevant.

I would simply delete it. Eventually, also the Steuerklasse is a choice of the data preparer.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Depends on the dataset, I guess 😄

I don't care either way, your call @MImmesberger, and then go ahead and merge!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left it in there because it helped me to understand the purpose of the paragraph. I just added a "for example" to make clear that this reasoning also applies to the other variables.

"the year the child was born (disregarding potential parameter changes throughout the\n",
"year). If there was no parameter change (or you're fine with neglecting this), you can\n",
"choose the same policy date as in step 2.\n",
"2. other state variables of the household (e.g. place of residence) might change\n",
"after birth of the child.\n",
"\n",
"First, we create the new data set after birth."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Create data\n",
"data_after_birth = create_synthetic_data(\n",
" n_adults=2,\n",
" n_children=1,\n",
" specs_heterogeneous={\n",
" \"bruttolohn_m\": [[0.0, 0.0, 0.0]],\n",
" \"geburtsjahr\": [[1980, 1980, 2024]],\n",
" \"geburtsmonat\": [[1, 1, 7]],\n",
" \"alter\": [[44, 44, 0]],\n",
" \"elterngeld_claimed\": [[True, False, False]], # First adult claims Elterngeld\n",
" },\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Then, we add `elterngeld_nettoeinkommen_vorjahr_m` to the data based on step 2."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Add net wage approximation\n",
"data_after_birth[\"elterngeld_nettoeinkommen_vorjahr_m\"] = net_wage_approximation[\n",
" \"elterngeld_nettolohn_approximation_m\"\n",
"]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Then, we compute Elterngeld."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Compute Elterngeld\n",
"results = compute_taxes_and_transfers(\n",
" data=data_after_birth,\n",
" functions=functions,\n",
" params=params,\n",
" targets=[\"elterngeld_m\"],\n",
")\n",
"\n",
"results"
]
}
],
"metadata": {
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
1 change: 1 addition & 0 deletions docs/how_to_guides/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ maxdepth: 1
---
different_ways_to_load_policy_functions
visualizing_the_system
calculating_elterngeld
```
8 changes: 5 additions & 3 deletions src/_gettsim/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ def set_array_backend(backend: str):
"eink_st_y_sn",
"soli_st_y_sn",
"abgelt_st_y_sn",
"elterngeld_m",
"sozialv_beitr_arbeitnehmer_m",
"ges_rentenv_beitr_arbeitnehmer_m",
"arbeitsl_v_beitr_arbeitnehmer_m",
Expand Down Expand Up @@ -171,6 +172,8 @@ def set_array_backend(backend: str):
"eink_selbst_m": float,
"in_priv_krankenv": bool,
"priv_rentenv_beitr_m": float,
"elterngeld_nettoeinkommen_vorjahr_m": float,
"elterngeld_zu_verst_eink_vorjahr_y_sn": float,
"bruttolohn_vorj_m": float,
"arbeitsstunden_w": float,
"geburtsjahr": int,
Expand All @@ -191,9 +194,8 @@ def set_array_backend(backend: str):
"monat_renteneintr": int,
"behinderungsgrad": int,
"wohnfläche_hh": float,
"m_elterngeld": int,
"m_elterngeld_vat_hh": int,
"m_elterngeld_mut_hh": int,
"monate_elterngeldbezug": int,
"elterngeld_claimed": bool,
"in_ausbildung": bool,
"alleinerz": bool,
"bewohnt_eigentum_hh": bool,
Expand Down
Loading