Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
816e70a
Corrected handling of wages below MIN_HOURLY_WAGE_RATE
Mariia-Var May 7, 2026
29487a8
Merge pull request #177 from simpaths/main
Mariia-Var May 7, 2026
2f4826e
Merge pull request #178 from Mariia-Var/MV-correct-min-wage-bug
Mariia-Var May 7, 2026
7498db7
Validate startYear against MIN/MAX bounds
Mariia-Var May 13, 2026
f76f143
Optimized validation .do files
Mariia-Var May 13, 2026
903b764
Merge pull request #180 from Mariia-Var/develop
Mariia-Var May 13, 2026
cce0b7c
Corrected MAX_START_YEAR in parameters.xlsx
Mariia-Var May 13, 2026
8802693
Revert "Validate startYear against MIN/MAX bounds"
Mariia-Var May 13, 2026
d33ba3f
Merge pull request #181 from simpaths/revert-180-develop
Mariia-Var May 13, 2026
9e2bb79
Revert "Revert "Validate startYear against MIN/MAX bounds""
Mariia-Var May 13, 2026
af0640e
Merge pull request #182 from simpaths/revert-181-revert-180-develop
Mariia-Var May 13, 2026
64505c4
Merge pull request #183 from Mariia-Var/develop
Mariia-Var May 13, 2026
e23d3a0
Revise project details and update data year range
ANBurdett Jul 8, 2026
fbcaaa1
Update comments and directory paths in master data file
ANBurdett Jul 8, 2026
12c1f1a
Added SILC panel constrcution files and READMEs
ANBurdett Jul 8, 2026
f172e49
Delete input_processing/data_construction/.DS_Store
ANBurdett Jul 8, 2026
78ec5c2
Delete input_processing/data_construction/UID_construction/.DS_Store
ANBurdett Jul 8, 2026
ccba9f6
Delete input_processing/data_construction/SILC_panel_construction/200…
ANBurdett Jul 8, 2026
79acf1d
Delete input_processing/data_construction/SILC_panel_construction/200…
ANBurdett Jul 8, 2026
d6b8117
Merge pull request #189 from simpaths/AB_SILC_construction_files_dev
Mariia-Var Jul 9, 2026
5b089ed
Added ES UID construction files
ANBurdett Aug 24, 2026
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
Binary file modified input/PL/parameters.xlsx
Binary file not shown.
186 changes: 186 additions & 0 deletions input_processing/00_master_conditions_ES.do
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
/*******************************************************************************
* PROJECT: SimPaths EU
* DO-FILE NAME: 00_master_conditions.do
* DESCRIPTION: Sets out the assumptions and conditions imposed in the
* creation of the unique dataset and the if conditions
* imposed when estimating the processes for SimPaths.
********************************************************************************
* COUNTRY: ES
* AUTHORS: Ashley Burdett
* LAST UPDATE: April 2026 AB
********************************************************************************
* -----------------------------------------------------------------------
* Assumptions imposed to align the SILC data with simulation rules:
* -----------------------------------------------------------------------
*
* - Retirement:
* - Treated as an absorbing state
* - Must retire by a specified maximum age
* - Cannot retire before a specified minimum age
*
* - Education:
* - Leave education no earlier than a specified minimum age
* - Must leave the initial education spell by a specified maximum age
* - Cannot return to education after retirement
*
* - Work:
* - Can work from a specified minimum age
* - Activity status and hours of work populated consistently:
* → Assume not working if report hours = 0
* → Assume hours = 0 if not working
* - If missing partial information, don't assume the missing is 0 and
* impute (hot-deck)
*
* - Leaving the parental home:
* - Can leave from a specified minimum age
* - Become the effective head of hh even when living with parents when
* paretns retire or reach state retirment age
*
* - Home ownership:
* - Can own a home from a specified minimum age
*
* - Partnership formation:
* - Can form a partnership from a specified minimum age
*
* - Disability:
* - Treated as a subsample of the not-employed population
*
* The relevant age thresholds are defined in globals defined in "DEFINE
* PARAMETERS" section below.
* Throughout also construct relevant flags and produce a log file
* "flag_descriptives.xlsx" to see the extent of the adjustments to the raw
* data.
*
* -----------------------------------------------------------------------
* Additional notes on implementation:
* -----------------------------------------------------------------------
*
* - Impute health score (generalized ordered logit model).
* - Constructing age is not straight forward as not directly reported in the
* data, therefore:
* → Use interview age (RX010) where available
* → Otherwise use age at end of interview year (PX020). This results in
* upward bias of age.
* - Set education = 0 (na) while in initial education spell.
*
* -----------------------------------------------------------------------
* Remaining disparities between initial populations and simulation rules:
* -----------------------------------------------------------------------
*
* - Ages at which females can have a child. [Be informed by the sample?]
* Permit teenage mothers in this script (deal with in 03_ )
* - A few higher/older education spells (30+) that last multiple years
* in the simulation can only return to education for single year spells.
* - Number of children vars (all ages or 0-2) don't account for feasibility
* of age at birth of the mother.
*
*******************************************************************************/


/*******************************************************************************
* DEFINTE PARAMETERS
*******************************************************************************/

global country "ES"

global first_sim_year "2011"

global last_sim_year "2024"


* Define threshold ages
/*
The thresholds defined below ensure consistency between the assumptions
applied in the simulation and the structure of the initial population data.
They specify the ages at which certain life-course transitions are permitted
or enforced within the model. These limits reflect both modelling conventions
and empirical considerations drawn from observed data.
*/

* Age become an adult in various dimensions
global age_becomes_responsible 18

global age_becomes_semi_responsible 16

global age_seek_employment 16

global age_leave_school 16

global age_form_partnership 18

global age_have_child_min 18

global age_leave_parental_home 18

global age_max_leave_parental_home 45

global age_own_home 18

global age_can_retire 50

global age_force_retire 75

global age_force_leave_spell1_edu 30

global age_have_child_max 49
// allow this to be informed by the data

global age_cannot_separate 79

global age_max_dep_child 17
// used for defining BU and number of dependent children variables in data construction

global age_adult 18
// used when slicing up hh level income information in data construction

/*******************************************************************************
* PROCESS IF CONDITIONS
*******************************************************************************/

* Education
global e1a_if_condition "dag >= ${age_leave_school} & dag < ${age_force_leave_spell1_edu} & l.les_c4 == 2 & flag_deceased != 1"

global e1b_if_condition "dag >= ${age_leave_school} & l.les_c4 != 4 & l.les_c4 != 2 & flag_deceased != 1"

global e2_if_condition "dag >= ${age_leave_school} & l.les_c4 == 2 & les_c4 != 2 & flag_deceased != 1"

* Leave the parental home
global p1_if_condition "ded == 0 & dag >= ${age_leave_parental_home} & dag <= ${age_max_leave_parental_home} & flag_deceased != 1"

* Partnership
global u1_if_condition "dag >= ${age_form_partnership} & ssscp != 1 & flag_deceased != 1"

global u2_if_condition "dgn == 0 & dag >= ${age_form_partnership} & l.ssscp != 1 & dag < ${age_cannot_separate} & flag_deceased != 1 & flag_deceased != 1"

* Fertility
global f1_if_condition "dag >= ${age_have_child_min} & dag <= ${age_have_child_max} & dgn == 0 & flag_deceased != 1"

* Health
global h1_if_condition "dag >= ${age_becomes_semi_responsible} & flag_dhe_imp == 0 & flag_deceased != 1"

global h2_if_condition "dag >= ${age_becomes_semi_responsible} & ded == 0 & les_c4 != 4 & les_c4 != 2 & flag_deceased != 1"

* Home ownership
global ho1_if_condition "dag >= ${age_own_home} & flag_deceased != 1"

* Retirement
global r1a_if_condition "dcpst == 2 & dag >= ${age_can_retire} & flag_deceased != 1"

global r1b_if_condition "ssscp != 1 & dcpst == 1 & dag >= ${age_can_retire} & flag_deceased != 1"

* Wages
global W1fa_if_condition "dgn == 0 & dag >= ${age_seek_employment} & dag <= ${age_force_retire} & deh_c4 != 0 & flag_deceased != 1"

global W1ma_if_condition "dgn == 1 & dag >= ${age_seek_employment} & dag <= ${age_force_retire} & deh_c4 != 0 & flag_deceased != 1"

global W1fb_if_condition "dgn == 0 & dag >= ${age_seek_employment} & dag <= ${age_force_retire} & deh_c4 != 0 & previouslyWorking == 1 & flag_deceased != 1"

global W1mb_if_condition "dgn == 1 & dag >= ${age_seek_employment} & dag <= ${age_force_retire} & deh_c4 != 0 & previouslyWorking == 1 & flag_deceased != 1"

* Capital income
global i1a_if_condition "dag >= ${age_becomes_semi_responsible} & flag_deceased != 1"

global i1b_if_condition "dag >= ${age_becomes_semi_responsible} & receives_ypncp == 1 & flag_deceased != 1"

* Labour supply
//??
15 changes: 15 additions & 0 deletions input_processing/data_construction/README_data_construction.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Construction of the SimPaths Input Datasets

Date: 6/6/26
Author: A Burdett

Workflow summary:

1. Obtain the required longitudinal EU-SILC releases.

2. Run the GESIS compilation program using the earlier longitudinal release to produce the harmonised 2005-2020 D, H, R, and P datasets.

3. Run the extended version of the GESIS compilation program using the 2024 longitudinal release to produce the harmonised 2005-2023 D, H, R, and P datasets. (Compilation files contained in …./data_construction/SILC_construction/2005_2023_panel/.)

4. Run the SimPaths UID construction files for the country of interest, contained in the ”data_construction/UID_construction/” folder. During this process, the variables affected by post-2020 coding changes are merged from the 2005-2020 dataset into the 2005-2023 dataset. This creates the UID file (“…ipop.dta”) which is used to both process estimation and for internal validation of SimPaths, as well as the annual cross-sections used to initialise the model.

Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
********************************************************************************
* PROJECT: SimPaths EU
* DO-FILE NAME: 00_master_construct_eusilc_panel
* DESCRIPTION: Imports the EU-SILC csv files.
********************************************************************************
* COUNTRY: -
* DATA: EU-SILC longitudinal data
* AUTHORS: Ashley Burdett
* LAST UPDATE: Jan 2025
********************************************************************************
* NOTE: This is a formatted, extended (to include 2023 data)
* and organized version of the procedure constrcuted by
* GESIS to combine the SILC longitudinal data panels in a
* systematic way to idenitfy individuals across
* observations.
*
* In addition to the included do-files you will need to
* obtain the set-up files that transform csv files
* containing the SILC data from GESIS. They can be found
* here: https://www.gesis.org/en/missy/materials/EU-SILC/setups#:~:text=Routines%20to%20transform%20*.csv%20to,document%20of%20every%20data%20release.
*
* The version of the set-up files used should coincide
* with the data release being use.
*
* Population files merged added in "05_weights" need to be
* uploaded into the input_data subfolder. The 2005-2020
* information was obtained from GESIS, whilst the
* 2021-2023 information was obtained from EUROSTAT.
*
* Make sure the necessary subfolders are created for the
* set-up file outputs.
* Currently called in do-file 01-04 using the following
* pattern
* ${do_dir}/EU-SILC/19 L-2023/
* ${do_dir}/EU-SILC/18 L-2022/
* ${do_dir}/EU-SILC/17 L-2021/ ...
*
********************************************************************************

* Initalization
clear all
capture log close
set more off


/*******************************************************************************
* DEFINE DIRECTORIES
*******************************************************************************/

global main_dir "/Users/aburdett/Library/CloudStorage/Box-Box/ESPON - OVERLAP/_countries/Cumulative Longitudional Dataset (all countries)/2005_2023_panel" // master folder for processing

global log_dir "$main_dir/logs" // folder in main_dir that contains logs

global do_files_dir "$main_dir/do_files" // folder in main_dir that contains do files

global data_dir "$main_dir/data" // folder in main_dir that contains output data

global input_data_dir "$main_dir/input_data"

//for set-up files
global do_dir "$main_dir/data" // folder in main_dir that contains output data for merging do file

global datapath "$main_dir/data" // folder in main_dir that contains output data for merging do file

global csv_path "$main_dir/input_data"


/*******************************************************************************
* EXECUTE FILES
*******************************************************************************/
* Call set-up files to import the EU-SILC data
forvalues i = 2005/2023 {

do "$do_files_dir/Long_allcountries_Dfiles_`i'.do"
}

forvalues i = 2005/2023 {

do "$do_files_dir/Long_allcountries_Hfiles_`i'.do"
}


forvalues i = 2005/2023 {

do "$do_files_dir/Long_allcountries_Pfiles_`i'.do"
}


forvalues i = 2005/2023 {

do "$do_files_dir/Long_allcountries_Rfiles_`i'.do"
}
*/

* Create panel using D files
do "$do_files_dir/01_create_masterD.do"


* Create panel using H files
do "$do_files_dir/02_create_masterH.do"


* Create panel using R files
do "$do_files_dir/03_create_masterR.do"


* Create panel using P files
do "$do_files_dir/04_create_masterP.do"


* Adjust weight variables
do "$do_files_dir/05_weights.do"
Loading