Euromod Connector
What is Euromod?
The Euromod Connector for Python is built to facilitate and simplify the usage of the EUROMOD microsimulation model for research and analysis purposes.
EUROMOD is a tax-benefit microsimulation model for the European Union that enables researchers and policy analysts to calculate, in a comparable manner, the effects of taxes and benefits on household incomes and work incentives for the population of each country and for the EU as a whole. It is a static microsimulation model that applies user-defined tax and benefit policy rules to harmonised microdata on individuals and households, calculates the effects of these rules on household income.
Installation
Install via PyPi using pip:
$ pip install euromod
Requirements
The Euromod Connector requires two EUROMOD components: 1) the model (coded policy rules) , and 2) the input microdata with the variables that respect the EUROMOD naming conventions. For more information, please, read the sections "Model" and "Input microdata" on the Download Euromod web page.
Run simulation
Importing and loading the model:
In[1]: from euromod import Model
In[2]: mod=Model(r"C:\EUROMOD_RELEASES_I6.0+")
Loading the dataset using pandas:
In[3]: import pandas as pd
In[4]: data = pd.read_csv(r"C:\EUROMOD_RELEASES_I6.0+\Input\sl_demo_v4.txt",sep="\t")
Running a simulation on system 'SL_1996' of the country Simpleland 'SL' (Note: this country model is provided by default with the EUROMOD project):
In[5]: out=mod.countries['SL'].systems['SL_1996'].run(data,'sl_demo_v4')
In[6]: out.outputs[0]
Out[6]:
idhh idperson idmother ... ils_dispy il_taxabley il_bsa_base
0 1.0 101.0 0.0 ... 807.018500 0.00000 807.01850
1 1.0 102.0 0.0 ... 0.000000 0.00000 0.00000
2 1.0 103.0 102.0 ... 0.000000 0.00000 0.00000
3 1.0 104.0 102.0 ... 934.294772 149.54786 149.54786
4 2.0 201.0 0.0 ... 1337.268280 1421.58535 1337.26828
... ... ... ... ... ... ...
1255 500.0 50003.0 50002.0 ... 0.000000 0.00000 0.00000
1256 500.0 50004.0 50002.0 ... 0.000000 0.00000 0.00000
1257 500.0 50005.0 50002.0 ... 0.000000 0.00000 0.00000
1258 500.0 50006.0 0.0 ... 839.845300 0.00000 839.84530
1259 500.0 50007.0 0.0 ... 0.000000 0.00000 0.00000
[1260 rows x 43 columns]
Checking the policies for country Simpleland 'SL':
In[7]: mod.countries['SL'].policies
Out[7]:
0: Uprate_sl | DEF: UPRATING FACTORS
1: ILsDef_sl | DEF: STANDARD INCOME CONCEPTS
2: ILDef_sl | DEF: SPECIFIC INCOME CONCEPTS
3: TUDef_sl | DEF: ASSESSMENT UNITS
4: yem_sl | DEF: Minimum Wage
5: neg_sl | DEF: recode negative self-employment income to zer ...
6: sic_sl | SIC: Social Insurance Contributions
7: bch_sl | BEN: Child Benefit
8: tin_sl | TAX: Income Tax
9: bsa_sl | BEN: Social Assistance
10: output_std_sl | DEF: STANDARD OUTPUT INDIVIDUAL LEVEL
11: output_std_hh_sl | DEF: STANDARD OUTPUT HOUSEHOLD LEVEL
Checking the policies for country Simpleland 'SL' in system 'SL_1996':
In[8]: mod.countries['SL'].systems['SL_1996'].policies
Out[8]:
0: Uprate_sl | on | DEF: UPRATING FACTORS
1: ILsDef_sl | on | DEF: STANDARD INCOME CONCEPTS
2: ILDef_sl | on | DEF: SPECIFIC INCOME CONCEPTS
3: TUDef_sl | on | DEF: ASSESSMENT UNITS
4: yem_sl | on | DEF: Minimum Wage
5: neg_sl | on | DEF: recode negative self-employment income to zer ...
6: sic_sl | on | SIC: Social Insurance Contributions
7: bch_sl | on | BEN: Child Benefit
8: tin_sl | on | TAX: Income Tax
9: bsa_sl | on | BEN: Social Assistance
10: output_std_sl | on | DEF: STANDARD OUTPUT INDIVIDUAL LEVEL
11: output_std_hh_sl | off | DEF: STANDARD OUTPUT HOUSEHOLD LEVEL
Getting information about a specific policy, e.g. "sic_sl", at a country level:
In[9]: mod.countries['SL'].policies[6]
Out[9]:
------------------------------
Policy
------------------------------
ID: '20901CF5-0A2A-4BA8-A18A-7092CD6A182D'
comment: 'SIC: Social Insurance Contributions'
extensions: 0 elements
functions: SchedCalc, SchedCalc, SchedCalc
name: 'sic_sl'
order: '7'
private: 'no'
spineOrder: '7'
Getting information about a specific policy, e.g. "sic_sl", at a system level:
In[9]: mod.countries['SL'].systems['SL_1996'].policies[6]
Out[9]:
------------------------------
PolicyInSystem
------------------------------
ID: 'F7E5CACE-CECC-4BB6-9841-A936D097548120901CF5-0A2A-4BA8-A18A-7092CD6A182D'
comment: 'SIC: Social Insurance Contributions'
extensions: 0 elements
functions: SchedCalc, SchedCalc, SchedCalc
name: 'sic_sl'
order: '7'
polID: '20901CF5-0A2A-4BA8-A18A-7092CD6A182D'
private: 'no'
spineOrder: '7'
switch: 'on'
sysID: 'F7E5CACE-CECC-4BB6-9841-A936D0975481'
Tools for the EU model
The package euromod.eu_euromod holds tools written for one model: the model of
the 27 EU member states maintained by the Joint Research Centre. Its first module
estimates a parametric tax-benefit function from a simulation. The functions need
the folder of the model, the folder with the input datasets and the name of a
system:
from euromod.eu_euromod.calibrate import prepare_sample, fit_hsv
baseline = prepare_sample(r"C:\EUROMOD_RELEASES_J2.0+", r"C:\EUROMOD_DATA", "PT_2022")
fit = fit_hsv(baseline) # net tax rate = 1 - (1 - lambda) * income**(-tau)
fit["lambda"], fit["tau"] # level and progressivity
A reform is a counterfactual system of the model, or a baseline system with
constants overridden (prepare_sample(..., constants={"$tin00_rate9": 0.58})).
See "Calibrating a tax-benefit function" in the documentation.
License
© Copyright 2024 European Commission. EUROMOD is licensed under the EUPL, Version 1.2. See the documentation for details.
Metadata
Release files for euromod 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| euromod-0.4.0-py3-none-win_amd64.whl | Python 3 | none | Windows x86-64 | Details |
| euromod-0.4.0-py3-none-manylinux2014_x86_64.whl | Python 3 | none | Linux glibc 2.17+ x86-64 | Details |
Total release size: 3.4 MB
Release files / euromod-0.4.0-py3-none-win_amd64.whl
| Download URL | euromod-0.4.0-py3-none-win_amd64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
aa4df619e6e7d8e0b4f8af6a146457582d9e44e79ea44784ef7609805d19db7d
|
|
BLAKE2b-256 checksum How to use checksums |
97c23ac98fb64e7960b9c458c0e3f72436166e9184de1460cc091ea54040acb5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / euromod-0.4.0-py3-none-manylinux2014_x86_64.whl
| Download URL | euromod-0.4.0-py3-none-manylinux2014_x86_64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | Linux glibc 2.17+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
f4be75f71c0ef12b0d9614b9fca1086e281ae663e714deda810d16b8b4803269
|
|
BLAKE2b-256 checksum How to use checksums |
14a85122d6d053189c9cac01fd147c210dfa9aac201645215f70005a001cfc9a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Security for euromod 0.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.