{ "cells": [ { "cell_type": "markdown", "id": "d8526d43", "metadata": {}, "source": [ "# User Guide\n", "\n", "This guide is a thorough tour of the Euromod Connector. It assumes you have\n", "already installed the package and can load a model (if not, start with\n", "[Getting Started](getstarted.ipynb)). Where Getting Started shows *the happy\n", "path*, this guide explains *the object model* and the full set of options for\n", "running simulations and building counterfactual reforms.\n", "\n", "**Contents**\n", "\n", "1. [Setup and reproducible paths](#setup)\n", "2. [The `Model` object](#model)\n", "3. [Navigating the model: countries, the object hierarchy](#navigate)\n", "4. [The spine: policies, functions, parameters](#spine)\n", "5. [Systems and datasets](#systems)\n", "6. [Running a simulation](#running)\n", "7. [Building reforms I — policy switches](#switches)\n", "8. [Building reforms II — overwriting constants](#constants)\n", "9. [Add-ons](#addons)\n", "10. [Extensions](#extensions)\n", "11. [Requesting specific outputs](#requested)\n", "12. [Run options reference](#options)\n", "13. [Working across countries](#multicountry)\n", "14. [Caveats](#caveats)" ] }, { "cell_type": "markdown", "id": "e7e40880", "metadata": {}, "source": [ "(setup)=\n", "## 1. Setup and reproducible paths\n", "\n", "A simulation needs a **model** (policy rules) and **input microdata**. Throughout\n", "this guide we use the **training datasets** that ship with every public EUROMOD\n", "release, so nothing here depends on confidential data.\n", "\n", "Edit the two paths below to point at your own EUROMOD installation. `MODEL_PATH`\n", "is the model/release folder; `DATA_DIR` is where the input microdata lives (the\n", "model's `Input` folder in a standard release)." ] }, { "cell_type": "code", "execution_count": 1, "id": "65972bf7", "metadata": { "execution": { "iopub.execute_input": "2026-07-10T10:37:50.880577Z", "iopub.status.busy": "2026-07-10T10:37:50.880577Z", "iopub.status.idle": "2026-07-10T10:37:54.371927Z", "shell.execute_reply": "2026-07-10T10:37:54.368421Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Using EUROMOD as defined in C:\\EUROMOD\\Executable\n" ] } ], "source": [ "import os\n", "import pandas as pd\n", "from euromod import Model\n", "\n", "# --- Point these to your local EUROMOD installation -------------------------\n", "# MODEL_PATH : a EUROMOD model/release folder (the one that contains 'XMLParam').\n", "# DATA_DIR : folder with the input microdata (.txt). In a public release this\n", "# is the model's own 'Input' folder, which ships with the freely\n", "# distributable *training* datasets used throughout these docs.\n", "MODEL_PATH = r\"C:\\EUROMOD\\EUROMOD_RELEASE\"\n", "DATA_DIR = os.path.join(MODEL_PATH, \"Input\")\n", "\n", "# keep DataFrame previews compact in the rendered docs\n", "pd.set_option(\"display.max_rows\", 8, \"display.max_columns\", 8)" ] }, { "cell_type": "markdown", "id": "9509b592", "metadata": {}, "source": [ "(model)=\n", "## 2. The `Model` object\n", "\n", "`Model` is the entry point. Pass it the path to a EUROMOD model folder (the one\n", "containing `XMLParam`). Loading is lazy where it can be, so creating the object\n", "is cheap." ] }, { "cell_type": "code", "execution_count": 3, "id": "20a798be", "metadata": { "execution": { "iopub.execute_input": "2026-07-10T10:37:54.454466Z", "iopub.status.busy": "2026-07-10T10:37:54.446333Z", "iopub.status.idle": "2026-07-10T10:37:54.624439Z", "shell.execute_reply": "2026-07-10T10:37:54.624439Z" } }, "outputs": [ { "data": { "text/plain": [ "------------------------------\n", "Model\n", "------------------------------\n", "\t countries: 28 elements\n", "\t extensions: 17 elements\n", "\t model_path: 'C:\\\\EUROMOD\\\\EUROMOD_RELEASE'" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "mod = Model(MODEL_PATH)\n", "mod" ] }, { "cell_type": "markdown", "id": "cda5ebfd", "metadata": {}, "source": [ "Every connector object has an **informative representation**: printing it shows\n", "its user-relevant attributes and how many elements each container holds. The\n", "`Model` has two you will use constantly:\n", "\n", "- `countries` — a container of `Country` objects;\n", "- `extensions` — the model-wide extensions (more on these\n", " [below](#extensions))." ] }, { "cell_type": "code", "execution_count": 4, "id": "ffc09281", "metadata": { "execution": { "iopub.execute_input": "2026-07-10T10:37:54.632638Z", "iopub.status.busy": "2026-07-10T10:37:54.632638Z", "iopub.status.idle": "2026-07-10T10:37:54.697529Z", "shell.execute_reply": "2026-07-10T10:37:54.697529Z" } }, "outputs": [ { "data": { "text/plain": [ "0: Benefit Take-up Adjustments \n", "1: Tax Compliance Adjustments \n", "2: Full Year Adjustments \n", "3: Uprating by Average Adjustment \n", "4: Extended Policy Simulation \n", "5: Parental leave benefits \n", "6: Minimum Wage Adjustments \n", "7: HHoT unemployment extension \n", "8: EUROMOD JRC-Interface \n", "9: HHoT - Extended Simulation \n", "10: HHoT - Non Compulsory Payments \n", "11: Benefit Calibration Adjustments \n", "12: Consumption Inflation Adjustment \n", "13: HHoT - Monthly Unemployment extension\n", "14: HFCS data \n", "15: HHoT - childcare costs \n", "16: HHoT - sickness benefits " ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "mod.extensions" ] }, { "cell_type": "markdown", "id": "b849d3a3", "metadata": {}, "source": [ "(navigate)=\n", "## 3. Navigating the model\n", "\n", "The connector mirrors the hierarchy of the EUROMOD user interface as a tree of\n", "Python objects. Containers can be indexed **by position** or **by name**, and\n", "they slice like lists." ] }, { "cell_type": "code", "execution_count": 5, "id": "bb562f65", "metadata": { "execution": { "iopub.execute_input": "2026-07-10T10:37:54.705520Z", "iopub.status.busy": "2026-07-10T10:37:54.705520Z", "iopub.status.idle": "2026-07-10T10:37:54.772975Z", "shell.execute_reply": "2026-07-10T10:37:54.772975Z" } }, "outputs": [ { "data": { "text/plain": [ "0: AT \n", "1: BE \n", "2: BG \n", "3: CY \n", "4: CZ \n", "5: DE \n", "6: DK \n", "7: EE \n", "8: EL \n", "9: ES \n", "10: FI\n", "11: FR\n", "12: HR\n", "13: HU\n", "14: IE\n", "15: IT\n", "16: LT\n", "17: LU\n", "18: LV\n", "19: MT\n", "20: NL\n", "21: PL\n", "22: PT\n", "23: RO\n", "24: SE\n", "25: SI\n", "26: SK\n", "27: SL" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "mod.countries # a Container of Country objects" ] }, { "cell_type": "code", "execution_count": 6, "id": "bae8e727", "metadata": { "execution": { "iopub.execute_input": "2026-07-10T10:37:54.780968Z", "iopub.status.busy": "2026-07-10T10:37:54.772975Z", "iopub.status.idle": "2026-07-10T10:37:59.572732Z", "shell.execute_reply": "2026-07-10T10:37:59.572732Z" } }, "outputs": [ { "data": { "text/plain": [ "------------------------------\n", "Country\n", "------------------------------\n", "\t ct_factors: 434 elements\n", "\t datasets: 42 elements\n", "\t extensions: 17 elements\n", "\t local_extensions: 0 elements\n", "\t name: 'IT'\n", "\t policies: 57 elements\n", "\t systems: 21 elements\n", "\t upratefactors: 46 elements" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "mod.countries[\"IT\"] # index by two-letter country code" ] }, { "cell_type": "markdown", "id": "ddb20bb7", "metadata": {}, "source": [ "A `Country` groups everything defined for that country: its `datasets`,\n", "`policies`, `systems`, and any country-local `extensions`. As with the model,\n", "printing shows the shape of each." ] }, { "cell_type": "code", "execution_count": 7, "id": "101907f7", "metadata": { "execution": { "iopub.execute_input": "2026-07-10T10:37:59.572732Z", "iopub.status.busy": "2026-07-10T10:37:59.572732Z", "iopub.status.idle": "2026-07-10T10:37:59.645855Z", "shell.execute_reply": "2026-07-10T10:37:59.645855Z" } }, "outputs": [ { "data": { "text/plain": [ "------------------------------\n", "Country\n", "------------------------------\n", "\t ct_factors: 434 elements\n", "\t datasets: 42 elements\n", "\t extensions: 17 elements\n", "\t local_extensions: 0 elements\n", "\t name: 'IT'\n", "\t policies: 57 elements\n", "\t systems: 21 elements\n", "\t upratefactors: 46 elements" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "it = mod.countries[\"IT\"]\n", "it" ] }, { "cell_type": "markdown", "id": "c32f86fe", "metadata": {}, "source": [ "(spine)=\n", "## 4. The spine: policies, functions, parameters\n", "\n", "The **spine** is EUROMOD's ordered sequence of tax-benefit calculations. It has\n", "three nested levels:\n", "\n", "```\n", "Policy (e.g. income tax)\n", " └─ Function (e.g. a benefit calculation, an eligibility test)\n", " └─ Parameter (e.g. a rate, a threshold, a formula)\n", "```\n", "\n", "These are **defined** at the `Country` level (the design of the rules) and\n", "**implemented** at the `System` level (the design *as parameterised for a given\n", "policy year*). That distinction matters: the same policy has different parameter\n", "values in `IT_2019` and `IT_2020`.\n", "\n", "Let's look at the policies defined for Italy." ] }, { "cell_type": "code", "execution_count": 8, "id": "ff3e6a65", "metadata": { "execution": { "iopub.execute_input": "2026-07-10T10:37:59.645855Z", "iopub.status.busy": "2026-07-10T10:37:59.645855Z", "iopub.status.idle": "2026-07-10T10:38:00.314751Z", "shell.execute_reply": "2026-07-10T10:38:00.314751Z" } }, "outputs": [ { "data": { "text/plain": [ "0: SetDefault_it | | DEF: DEFAULT VALUES \n", "1: Uprate_it | | DEF: UPRATING FACTORS \n", "2: uprate_bands_it | (with switch set for UAA) | DEF: Uprating in bands \n", "3: ConstDef_it | | DEF: CONSTANTS AND INITIALISATION OF VARIABLES \n", "4: random_it | | DEF: assign random numbers \n", "5: ILsDef_it | | DEF: STANDARD INCOME CONCEPTS \n", "6: ILsUDBDef_it | | DEF: UDB related STANDARD INCOME LISTS \n", "7: ILDef_it | | DEF: INCOME CONCEPTS \n", "8: TransLMA_it | | DEF: Modelling labour market transitions (DO NOT S ... \n", "9: TUDef_it | | DEF: ASSESSMENT UNITS \n", "10: TCA_it | (with switch set for TCA) | SWITCH: Tax Compliance Adjustments \n", "11: yem_it | (with switch set for MWA) | DEF: minimum wage \n", "12: neg_it | | DEF: recode negative self-employment income to zer ... \n", "13: sickcomp_it | (with switch set for HHoT_hl) | BEN: sickness compensation (this policy changes ye ... \n", "14: bmact_it | (with switch set for PBE) | BEN: Mandatory Maternity Leave Allowance (Indennit ... \n", "15: bpact_it | (with switch set for PBE) | BEN: Paternity Leave Allowance (Congedo papà) \n", "16: bplct_it | (with switch set for PBE) | BEN: Parental Leave (Indennità per astensione fac ... \n", "17: bmanc_it | (with switch set for PBE) | BEN: State Maternity Benefit (Assegno di Materni ... \n", "18: hhot_switch_it | (with switch set for HHoT_un, WEB) | DEF: switch on bun for HHoT extension \n", "19: bunct01_it | | BEN: Wage Supplementation scheme - PART SIMULATED \n", "20: bunct02_it | | BEN: Unemployment benefit (Indennita' di disoccupa ... \n", "21: sicee_it | | SIC: Employee Social Insurance Contributions (Cont ... \n", "22: sicer_it | | SIC: Employer Social Insurance Contributions (Cont ... \n", "23: sicse_it | | SIC: Self-employed Social Insurance Contributions ... \n", "24: tinrt_it | | TAX: Tax on rental income \n", "25: tpr_it | | TAX: Property Tax (IMU) \n", "26: poaxp_it | | BEN: Pension extra payment \n", "27: tinto_it | | TAX: Additional solidarity contributions \n", "28: tinyse_it | | TAX: Income Tax Self-employed (flat tax optional r ... \n", "29: tintsna_it | | TAX: Personal Income Tax: deduction and schedule ( ... \n", "30: tintc_it | | TAX: Personal Income Tax: personal tax credits (IR ... \n", "31: tinna_it | | TAX: Personal Income Tax: Family tax credits (IRPE ... \n", "32: tintciw_it | | TAX: In work refundable Tax Credit (from 2014) \n", "33: tinrg_it | | TAX: Additional Regional Personal Income Tax (Addi ... \n", "34: tinkt_it | | TAX: Tax on capital incomes (Tassazione dei reddit ... \n", "35: poamt_it | | BEN: Social Allowance for elderly \n", "36: bfacc_it | | BEN: Mother bonus \n", "37: bfacpxc_it | | BEN: Family Allowance for couple and 0 child (Asse ... \n", "38: bfalp_it | | BEN: Family Allowance for 1 parent and children (A ... \n", "39: bfacpwc_it | | BEN: Family Allowance for 2 parents and children ( ... \n", "40: isee_it | | DEF: Indicator of Economic Situation \n", "41: bfaba_it | | BEN: New born bonus \n", "42: bfach_it | (with switch set for HHoT_cc) | BEN: Childcare bonus \n", "43: bmamt_it | (with switch set for PBE) | BEN: Municipalities Maternity Benefit (Assegno di ... \n", "44: bsamm_it | | BEN: Income Support (ReI - Reddito di Inclusione) \n", "45: bau_it | | BEN: Children allowance (Assegno Unico) \n", "46: bls_COVID_it | | BEN: COVD Lump sum benefits \n", "47: bls_ENERGY_it | | BEN: ENERGY related Lump sum benefits \n", "48: bsals_it | | BEN: Lumps sum pro-poor benefit (Carta Dedicata a ... \n", "49: REm_it | | BEN: Emergency income (REm) \n", "50: bfaHFCS_it | (with switch set for HFCS) | BEN: Family Allowance with HFCS data \n", "51: tco_it | | TAX: Commodities \n", "52: spp_it | | BEN: Special Price Policies (OFF by default - swit ... \n", "53: xcc_it | (with switch set for HHoT_cc) | COST: Childcare \n", "54: output_std_it | | DEF: STANDARD OUTPUT INDIVIDUAL LEVEL \n", "55: parben_output_std_it | (with switch set for PBE, WEB) | DEF: STANDARD OUTPUT INDIVIDUAL LEVEL \n", "56: output_std_hh_it | | DEF: STANDARD OUTPUT HOUSEHOLD LEVEL " ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "it.policies" ] }, { "cell_type": "markdown", "id": "a7d55c43", "metadata": {}, "source": [ "Drill into a single policy to see its functions, and into a function to see its\n", "parameters. Here we inspect the personal income tax policy `tinrt_it`.\n", "\n", "> **Indexing note.** Country and system containers can be indexed by name\n", "> (`mod.countries[\"IT\"]`), but `policies` and `functions` are keyed by their\n", "> internal ID, so we pick one out by its readable name with a simple\n", "> comprehension." ] }, { "cell_type": "code", "execution_count": 9, "id": "9804e2e8", "metadata": { "execution": { "iopub.execute_input": "2026-07-10T10:38:00.314751Z", "iopub.status.busy": "2026-07-10T10:38:00.314751Z", "iopub.status.idle": "2026-07-10T10:38:06.032799Z", "shell.execute_reply": "2026-07-10T10:38:06.032799Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "0: DefConst | \n", "1: ArithOp | \n", "2: ArithOp | Proportion of rental income which is taxable \n", "3: ArithOp | \n", "4: ArithOp | Tax on rental income \n", "5: ArithOp | Tax on rental income \n", "\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "0: $tinrt_IncomeTaxable | taxable rental income \n", "1: $tinrt_FixedRate | Rental income is subject to a fixed rate: 21% \n", "2: $tinrt_FixedRate1 | Rental income is subject to a fixed rate: 10% \n", "3: [Placeholder] | \n", "4: [Placeholder] | \n", "5: [Placeholder] | \n", "\n" ] } ], "source": [ "tax = [p for p in it.policies if p.name == \"tinrt_it\"][0]\n", "print(tax.functions)\n", "print(tax.functions[0].parameters)" ] }, { "cell_type": "markdown", "id": "99d6d490", "metadata": {}, "source": [ "The **system-level** view adds the state that applies for a given year — most\n", "importantly the `switch` (whether a policy/function is active) and the concrete\n", "parameter `value`s. Compare the country-level definition above with the\n", "`IT_2020` implementation below: the system view shows each policy's on/off\n", "switch." ] }, { "cell_type": "code", "execution_count": 10, "id": "5a431779", "metadata": { "execution": { "iopub.execute_input": "2026-07-10T10:38:06.041019Z", "iopub.status.busy": "2026-07-10T10:38:06.032799Z", "iopub.status.idle": "2026-07-10T10:38:06.273486Z", "shell.execute_reply": "2026-07-10T10:38:06.273486Z" } }, "outputs": [ { "data": { "text/plain": [ "0: SetDefault_it | on | DEF: DEFAULT VALUES \n", "1: Uprate_it | on | DEF: UPRATING FACTORS \n", "2: uprate_bands_it | on (with switch set for UAA) | DEF: Uprating in bands \n", "3: ConstDef_it | on | DEF: CONSTANTS AND INITIALISATION OF VARIABLES \n", "4: random_it | on | DEF: assign random numbers \n", "5: ILsDef_it | on | DEF: STANDARD INCOME CONCEPTS \n", "6: ILsUDBDef_it | on | DEF: UDB related STANDARD INCOME LISTS \n", "7: ILDef_it | on | DEF: INCOME CONCEPTS \n", "8: TransLMA_it | off | DEF: Modelling labour market transitions (DO NOT S ... \n", "9: TUDef_it | on | DEF: ASSESSMENT UNITS \n", "10: TCA_it | off (with switch set for TCA) | SWITCH: Tax Compliance Adjustments \n", "11: yem_it | off (with switch set for MWA) | DEF: minimum wage \n", "12: neg_it | on | DEF: recode negative self-employment income to zer ... \n", "13: sickcomp_it | off (with switch set for HHoT_hl) | BEN: sickness compensation (this policy changes ye ... \n", "14: bmact_it | off (with switch set for PBE) | BEN: Mandatory Maternity Leave Allowance (Indennit ... \n", "15: bpact_it | off (with switch set for PBE) | BEN: Paternity Leave Allowance (Congedo papà) \n", "16: bplct_it | off (with switch set for PBE) | BEN: Parental Leave (Indennità per astensione fac ... \n", "17: bmanc_it | off (with switch set for PBE) | BEN: State Maternity Benefit (Assegno di Materni ... \n", "18: hhot_switch_it | on (with switch set for HHoT_un, WEB) | DEF: switch on bun for HHoT extension \n", "19: bunct01_it | off | BEN: Wage Supplementation scheme - PART SIMULATED \n", "20: bunct02_it | off | BEN: Unemployment benefit (Indennita' di disoccupa ... \n", "21: sicee_it | on | SIC: Employee Social Insurance Contributions (Cont ... \n", "22: sicer_it | on | SIC: Employer Social Insurance Contributions (Cont ... \n", "23: sicse_it | on | SIC: Self-employed Social Insurance Contributions ... \n", "24: tinrt_it | on | TAX: Tax on rental income \n", "25: tpr_it | on | TAX: Property Tax (IMU) \n", "26: poaxp_it | on | BEN: Pension extra payment \n", "27: tinto_it | on | TAX: Additional solidarity contributions \n", "28: tinyse_it | on | TAX: Income Tax Self-employed (flat tax optional r ... \n", "29: tintsna_it | on | TAX: Personal Income Tax: deduction and schedule ( ... \n", "30: tintc_it | on | TAX: Personal Income Tax: personal tax credits (IR ... \n", "31: tinna_it | on | TAX: Personal Income Tax: Family tax credits (IRPE ... \n", "32: tintciw_it | on | TAX: In work refundable Tax Credit (from 2014) \n", "33: tinrg_it | on | TAX: Additional Regional Personal Income Tax (Addi ... \n", "34: tinkt_it | on | TAX: Tax on capital incomes (Tassazione dei reddit ... \n", "35: poamt_it | on | BEN: Social Allowance for elderly \n", "36: bfacc_it | on | BEN: Mother bonus \n", "37: bfacpxc_it | on | BEN: Family Allowance for couple and 0 child (Asse ... \n", "38: bfalp_it | on | BEN: Family Allowance for 1 parent and children (A ... \n", "39: bfacpwc_it | on | BEN: Family Allowance for 2 parents and children ( ... \n", "40: isee_it | on | DEF: Indicator of Economic Situation \n", "41: bfaba_it | on | BEN: New born bonus \n", "42: bfach_it | on (with switch set for HHoT_cc) | BEN: Childcare bonus \n", "43: bmamt_it | off (with switch set for PBE) | BEN: Municipalities Maternity Benefit (Assegno di ... \n", "44: bsamm_it | on | BEN: Income Support (ReI - Reddito di Inclusione) \n", "45: bau_it | off | BEN: Children allowance (Assegno Unico) \n", "46: bls_COVID_it | off | BEN: COVD Lump sum benefits \n", "47: bls_ENERGY_it | n/a | BEN: ENERGY related Lump sum benefits \n", "48: bsals_it | n/a | BEN: Lumps sum pro-poor benefit (Carta Dedicata a ... \n", "49: REm_it | on | BEN: Emergency income (REm) \n", "50: bfaHFCS_it | on (with switch set for HFCS) | BEN: Family Allowance with HFCS data \n", "51: tco_it | off | TAX: Commodities \n", "52: spp_it | off | BEN: Special Price Policies (OFF by default - swit ... \n", "53: xcc_it | off (with switch set for HHoT_cc) | COST: Childcare \n", "54: output_std_it | on | DEF: STANDARD OUTPUT INDIVIDUAL LEVEL \n", "55: parben_output_std_it | off (with switch set for PBE, WEB) | DEF: STANDARD OUTPUT INDIVIDUAL LEVEL \n", "56: output_std_hh_it | off | DEF: STANDARD OUTPUT HOUSEHOLD LEVEL " ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "it.systems[\"IT_2020\"].policies" ] }, { "cell_type": "markdown", "id": "f769b2cb", "metadata": {}, "source": [ "(systems)=\n", "## 5. Systems and datasets\n", "\n", "A `System` is a country's tax-benefit rules for one policy year. To run one you\n", "must pair it with a **dataset**. A system lists the datasets configured for it,\n", "and marks the **best match** — the dataset the model authors recommend for that\n", "system." ] }, { "cell_type": "code", "execution_count": 11, "id": "df283c86", "metadata": { "execution": { "iopub.execute_input": "2026-07-10T10:38:06.281501Z", "iopub.status.busy": "2026-07-10T10:38:06.281501Z", "iopub.status.idle": "2026-07-10T10:38:06.793409Z", "shell.execute_reply": "2026-07-10T10:38:06.793409Z" } }, "outputs": [ { "data": { "text/plain": [ "0: training_data | \n", "1: IT_2018_a0 | \n", "2: IT_2018_a3 | \n", "3: IT_2019_a0 | \n", "4: IT_2019_a1 | \n", "5: IT_2020_hhot | \n", "6: IT_2010_a6_2010_03_e1 | \n", "7: IT_2021_b1 | best match \n", "8: IT_training_data | \n", "9: IT_2021_h1_imp1 | " ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "it.systems[\"IT_2020\"].datasets" ] }, { "cell_type": "markdown", "id": "262a60d7", "metadata": {}, "source": [ "The `dataset_id` you pass to `run()` selects which dataset-specific\n", "configuration (uprating factors, default values, currency) EUROMOD applies. It\n", "must be one of the datasets configured for the system. Here we use the training\n", "dataset `IT_training_data`." ] }, { "cell_type": "markdown", "id": "dd6f98a8", "metadata": {}, "source": [ "(running)=\n", "## 6. Running a simulation\n", "\n", "`run()` takes the input microdata as a `pandas.DataFrame` plus the `dataset_id`,\n", "and returns a `Simulation`. String variables are ignored (EUROMOD works on\n", "numeric variables), and the input must contain the `idhh` and `idperson`\n", "identifiers." ] }, { "cell_type": "code", "execution_count": 12, "id": "724332bf", "metadata": { "execution": { "iopub.execute_input": "2026-07-10T10:38:06.801213Z", "iopub.status.busy": "2026-07-10T10:38:06.801213Z", "iopub.status.idle": "2026-07-10T10:38:14.715797Z", "shell.execute_reply": "2026-07-10T10:38:14.715797Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Simulation for system IT_2020 with dataset IT_training_data finished.\n" ] }, { "data": { "text/plain": [ "------------------------------\n", "Simulation\n", "------------------------------\n", "\t constantsToOverwrite: {}\n", "\t errors: []\n", "\t output_filenames: ['it_2020_std.txt']\n", "\t outputs: Pandas DataFrame of 579 variables and 7482 observations." ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "data = pd.read_csv(os.path.join(DATA_DIR, \"IT_training_data.txt\"), sep=\"\\t\")\n", "baseline = it.systems[\"IT_2020\"].run(data, \"IT_training_data\")\n", "baseline" ] }, { "cell_type": "markdown", "id": "94a595c8", "metadata": {}, "source": [ "The `Simulation` object bundles:\n", "\n", "- `outputs` — a container of result DataFrames (most systems produce one; some\n", " produce several, e.g. when an add-on adds its own output);\n", "- `output_filenames` — the name of each output;\n", "- `errors` — any errors and warnings raised by the engine;\n", "- `constantsToOverwrite` — a record of the constants you changed (see below).\n", "\n", "Access the main output by position or by filename:" ] }, { "cell_type": "code", "execution_count": 13, "id": "4dfd332d", "metadata": { "execution": { "iopub.execute_input": "2026-07-10T10:38:14.715797Z", "iopub.status.busy": "2026-07-10T10:38:14.715797Z", "iopub.status.idle": "2026-07-10T10:38:14.805528Z", "shell.execute_reply": "2026-07-10T10:38:14.805528Z" } }, "outputs": [ { "data": { "text/html": [ "
| \n", " | idhh | \n", "idperson | \n", "idmother | \n", "idfather | \n", "... | \n", "tu_it_it_IsPartner | \n", "tu_it_it_IsOwnDependentChild | \n", "tu_it_it_IsDepParent | \n", "tu_fa_family_it_HeadID | \n", "
|---|---|---|---|---|---|---|---|---|---|
| 0 | \n", "1.0 | \n", "101.0 | \n", "0.0 | \n", "0.0 | \n", "... | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "101.0 | \n", "
| 1 | \n", "2.0 | \n", "201.0 | \n", "0.0 | \n", "0.0 | \n", "... | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "201.0 | \n", "
| 2 | \n", "3.0 | \n", "301.0 | \n", "0.0 | \n", "0.0 | \n", "... | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "301.0 | \n", "
| 3 | \n", "4.0 | \n", "401.0 | \n", "0.0 | \n", "0.0 | \n", "... | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "401.0 | \n", "
| 4 | \n", "5.0 | \n", "501.0 | \n", "0.0 | \n", "0.0 | \n", "... | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "501.0 | \n", "
5 rows × 579 columns
\n", "