Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,4 @@ Tax donor matching therefore requires a two-step price bridge:
1. Inflate SimPaths income to policy-year prices before matching.
2. Deflate the imputed financial values from the matched donor record back to 2015 prices.

The default uprating series is `TimeSeriesVariable.Inflation`, sourced from the `UK_inflation` worksheet in `input/time_series_factor.xlsx`. An alternative option (added 2026-04) allows wage growth to be used instead of price growth for the initial matching step, controlled via a config flag.
The default uprating series is `TimeSeriesVariable.Inflation`, sourced from the `inflation` worksheet in `input/economic_time_series.xlsx`. An alternative option (added 2026-04) allows wage growth to be used instead of price growth for the initial matching step, controlled via a config flag.
12 changes: 6 additions & 6 deletions documentation/repository-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ SimPaths/
│ ├── projections_*.xlsx # Mortality/fertility projections
│ ├── DatabaseCountryYear.xlsx # Database metadata
│ ├── EUROMODpolicySchedule.xlsx # Policy schedule
│ ├── policy parameters.xlsx # Tax-benefit parameters
│ ├── social_care_parameters.xlsx # Social care parameters
│ ├── validation_statistics.xlsx # Validation targets
│ └── input.mv.db # H2 donor database (generated by setup)
Expand Down Expand Up @@ -192,7 +192,7 @@ SimPaths/
| `projections_*.xlsx` | Demographic projections (mortality, fertility) |
| `DatabaseCountryYear.xlsx` | Tracks current database country/year |
| `EUROMODpolicySchedule.xlsx` | Tax-benefit policy schedule |
| `policy parameters.xlsx` | Detailed policy parameters |
| `social_care_parameters.xlsx` | Detailed social care parameters |

**Subdirectories**:
- `InitialPopulations/`: Starting population databases
Expand Down Expand Up @@ -359,9 +359,9 @@ After running, output Excel files are placed in `input/` (overwriting the existi

| Script | Output file |
|--------|------------|
| `01_employment_shares_initpopdata.do` | `input/employment_targets.xlsx` — employment shares by benefit-unit subgroup and year |
| `01_inSchool_targets_initpopdata.do` | `input/inSchool_targets.xlsx` — school participation rates by year |
| `03_calculate_partneredShare_initialPop_BUlogic.do` | `input/partnered_share_targets.xlsx` — partnership shares by year |
| `01_employment_shares_initpopdata.do` | `input/alignment_targets_employment.xlsx` — employment shares by benefit-unit subgroup and year |
| `01_inSchool_targets_initpopdata.do` | `input/alignment_targets_inSchool.xlsx` — school participation rates by year |
| `03_calculate_partneredShare_initialPop_BUlogic.do` | `input/alignment_targets_partnered_share.xlsx` — partnership shares by year |
| `03_calculate_partnership_target.do` | Supplementary partnership targets |
| `02_person_risk_employment_stats.do` | `employment_risk_emp_stats.csv` — person-level at-risk diagnostics used for employment alignment group construction |
Comment on lines +362 to 366

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@Mariia-Var same here.

@Mariia-Var Mariia-Var Jun 3, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Hi @dav-sonn, yes, thank you for the review - I have committed the suggested changes.


Expand Down Expand Up @@ -462,7 +462,7 @@ ResamplingAlignment.align(

**Regression coefficients**: Edit Excel files in `input/reg_*.xlsx`

**Policy parameters**: Edit `input/policy parameters.xlsx`
**Social care parameters**: Edit `input/social_care_parameters.xlsx`

**Alignment targets**: Edit `input/align_*.xlsx`

Expand Down
16 changes: 8 additions & 8 deletions documentation/wiki/developer-guide/repository-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ SimPaths/
│ ├── projections_*.xlsx # Mortality/fertility projections
│ ├── DatabaseCountryYear.xlsx # Database metadata
│ ├── EUROMODpolicySchedule.xlsx # Policy schedule
│ ├── policy parameters.xlsx # Tax-benefit parameters
│ ├── social_care_parameters.xlsx # Social care parameters
│ ├── validation_statistics.xlsx # Validation targets
│ └── input.mv.db # H2 donor database (generated by setup)
Expand Down Expand Up @@ -197,7 +197,7 @@ SimPaths/
| `projections_*.xlsx` | Demographic projections (mortality, fertility) |
| `DatabaseCountryYear.xlsx` | Tracks current database country/year |
| `EUROMODpolicySchedule.xlsx` | Tax-benefit policy schedule |
| `policy parameters.xlsx` | Detailed policy parameters |
| `social_care_parameters.xlsx` | Detailed social care parameters |

**Subdirectories**:
- `InitialPopulations/`: Starting population databases
Expand Down Expand Up @@ -353,11 +353,11 @@ After running, output Excel files are placed in `input/` (overwriting the existi

| Script | Output file |
|--------|------------|
| `01_employment_shares_initpopdata.do` | `input/employment_targets.xlsx` — employment shares by benefit-unit subgroup and year |
| `01_inSchool_targets_initpopdata.do` | `input/inSchool_targets.xlsx` — school participation rates by year |
| `03_calculate_partneredShare_initialPop_BUlogic.do` | `input/partnered_share_targets.xlsx` — partnership shares by year |
| `03_calculate_partnership_target.do` | Supplementary partnership targets |
| `02_person_risk_employment_stats.do` | `employment_risk_emp_stats.csv` — person-level at-risk diagnostics used for employment alignment group construction |
| `01_employment_shares_initpopdata.do` | `input/alignment_targets_employment.xlsx` — employment shares by benefit-unit subgroup and year |
| `02_inSchool_targets_initpopdata.do` | `input/alignment_targets_inSchool.xlsx` — school participation rates by year |
| `03a_calculate_partneredShare_initialPop_BUlogic.do` | `input/alignment_targets_partnered_share.xlsx` — partnership shares by year |
| `03b_calculate_partnership_target.do` | Supplementary partnership targets |
| `90_person_risk_employment_stats.do` | `employment_risk_emp_stats.csv` — person-level at-risk diagnostics used for employment alignment group construction |

Population projection targets (`align_popProjections.xlsx`) and fertility/mortality projections (`projections_*.xlsx`) come from ONS published projections and are not generated by these scripts.

Expand Down Expand Up @@ -456,7 +456,7 @@ ResamplingAlignment.align(

**Regression coefficients**: Edit Excel files in `input/reg_*.xlsx`

**Policy parameters**: Edit `input/policy parameters.xlsx`
**Social care parameters**: Edit `input/social_care_parameters.xlsx`

**Alignment targets**: Edit `input/align_*.xlsx`

Expand Down
9 changes: 7 additions & 2 deletions documentation/wiki/overview/parameterisation.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,14 @@ Source: [Github](https://github.com/simpaths/SimPaths/tree/develop/input).
Files listed below contain alignment targets.

* align_educLevel.xlsx
* align_employment.xlsx
* align_popProjections.xlsx
* align_student_under30.xlsx

**alignment_targets_ files**
Files listed below contain alignment targets for in-school, partnership, and employment shares.

* alignment_targets_employment.xlsx
* alignment_targets_inSchool.xlsx
* alignment_targets_partnered_share.xlsx

**projections_ files**
Files listed below contain demographic projections.
Expand Down
28 changes: 26 additions & 2 deletions input/DoFilesTarget/01_employment_shares_initpopdata.do
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ use "${dir_working_data}/bu_empl_shares_${country}_allsubgroups_initpopdata.dta"
sort year

* Create/overwrite Excel file that will hold all sheets
putexcel set "${dir_output}/employment_targets.xlsx", replace
putexcel set "${dir_output}/alignment_targets_employment.xlsx", replace

* Identify all BU group codes
levelsof group_code, local(groups)
Expand All @@ -188,7 +188,7 @@ foreach g of local groups {
mkmat year empl_share, matrix(M)

* Point putexcel at the output file and the group-specific sheet
putexcel set "${dir_output}/employment_targets.xlsx", sheet("`g'") modify
putexcel set "${dir_output}/alignment_targets_employment.xlsx", sheet("`g'") modify

* Write headers
putexcel A1=("year") B1=("empl_share")
Expand All @@ -198,3 +198,27 @@ foreach g of local groups {

restore
}

* Add metadata sheet so workbook provenance survives regeneration
putexcel set "${dir_output}/alignment_targets_employment.xlsx", sheet("Info") modify
putexcel A1=("Field") B1=("Value")
putexcel A2=("Workbook") B2=("alignment_targets_employment.xlsx")
putexcel A3=("Data sheets") B3=("Couples, SingleDep_Males, SingleDep_Females, Single_male, SingleAC_Males, Single_female, SingleAC_Females")
putexcel A4=("Relevant do file") B4=("input/DoFilesTarget/01_employment_shares_initpopdata.do")
putexcel A5=("Source data") B5=("input/InitialPopulations/population_initial_UK_2011.csv to population_initial_UK_2023.csv")
putexcel A6=("Years covered") B6=("2011-2023")
putexcel A7=("Unit of analysis") B7=("Benefit unit (BU)")
putexcel A8=("Responsible adults") B8=("Responsible male and female adults are identified from adults aged 18+ within each BU")
putexcel A9=("At-risk definition") B9=("Sex-specific at-risk flag requires age 16-75 inclusive and labc4 not equal to 2 or 4")
putexcel A10=("Weighting") B10=("BU weight equals the sum of wgthhcross across people in the BU")
putexcel A11=("How target is computed") B11=("For each BU: bu_fracemployed = (bu_male_emp + bu_female_emp) / bu_nresp after non-at-risk responsible adults are set to non-employed; then collapse (mean) empl_share = bu_target_emp [pw = bu_w] by year and group_code")
putexcel A12=("AC meaning") B12=("AC denotes adult child status from demadultchildflag")
putexcel A13=("SingleDep note") B13=("SingleDep_Males and SingleDep_Females cannot exceed 0.5 by construction")
putexcel A15=("Group") B15=("Definition")
putexcel A16=("Couples") B16=("Couple BU with at least one at-risk male and at least one at-risk female")
putexcel A17=("SingleDep_Males") B17=("Couple BU where only the male side is at risk")
putexcel A18=("SingleDep_Females") B18=("Couple BU where only the female side is at risk")
putexcel A19=("Single_male") B19=("Single-male BU with demadultchildflag = 0")
putexcel A20=("SingleAC_Males") B20=("Single-male BU with demadultchildflag = 1")
putexcel A21=("Single_female") B21=("Single-female BU with demadultchildflag = 0")
putexcel A22=("SingleAC_Females") B22=("Single-female BU with demadultchildflag = 1")
Original file line number Diff line number Diff line change
Expand Up @@ -83,19 +83,32 @@ use "${dir_working_data}/student_shares_${country}_initpopdata.dta", clear
sort year

* Create/overwrite Excel file that will hold all sheets
putexcel set "${dir_output}/inSchool_targets.xlsx", replace
putexcel set "${dir_output}/alignment_targets_inSchool.xlsx", replace


* Build a matrix of all rows for the two variables (year, student_share)
mkmat year student_share, matrix(M)

* Point putexcel at the output file and the group-specific sheet
putexcel set "${dir_output}/inSchool_targets.xlsx", sheet("students") modify
putexcel set "${dir_output}/alignment_targets_inSchool.xlsx", sheet("students") modify

* Write headers
putexcel A1=("year") B1=("student_share")

* Write data from matrix M (Stata 15+ supports varlists here)
putexcel A2=matrix(M)


* Add metadata sheet so workbook provenance survives regeneration
putexcel set "${dir_output}/alignment_targets_inSchool.xlsx", sheet("Info") modify
putexcel A1=("Field") B1=("Value")
putexcel A2=("Workbook") B2=("alignment_targets_inSchool.xlsx")
putexcel A3=("Data sheet") B3=("students")
putexcel A4=("Relevant do file") B4=("input/DoFilesTarget/02_inSchool_targets_initpopdata.do")
putexcel A5=("Source data") B5=("input/InitialPopulations/population_initial_UK_2011.csv to population_initial_UK_2023.csv")
putexcel A6=("Years covered") B6=("2011-2023")
putexcel A7=("Unit of analysis") B7=("Person-year")
putexcel A8=("Eligible population") B8=("People aged 16-29 with nonmissing labc4; one record kept per idpers in each annual file")
putexcel A9=("Student definition") B9=("isStudent = 1 when labc4 == 2 and age is between 16 and 29 inclusive")
putexcel A10=("Weighting") B10=("Weighted mean using wgthhcross")
putexcel A11=("How target is computed") B11=("For each year: collapse (mean) student_share = isStudent if labc4 != . and age is 16-29 [pw = wgthhcross]")
putexcel A12=("Output meaning") B12=("Annual share of students among people aged 16-29")
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,25 @@ export excel using "`work_dir'/partnered_share_initialPop_BUlogic.xlsx", ///
preserve
keep year partnered_share
format partnered_share %12.7f
export excel using "`work_dir'/partnered_share_targets_BUlogic.xlsx", ///
export excel using "`work_dir'/alignment_targets_partnered_share.xlsx", ///
firstrow(variables) replace
restore

* Add metadata sheet so workbook provenance survives regeneration
putexcel set "`work_dir'/alignment_targets_partnered_share.xlsx", sheet("Info") modify
putexcel A1=("Field") B1=("Value")
putexcel A2=("Workbook") B2=("alignment_targets_partnered_share.xlsx")
putexcel A3=("Data sheet") B3=("partnered_share")
putexcel A4=("Relevant do file") B4=("input/DoFilesTarget/03a_calculate_partneredShare_initialPop_BUlogic.do")
putexcel A5=("Related do file") B5=("input/DoFilesTarget/03b_calculate_partnership_target.do")
putexcel A6=("Source data") B6=("Initial population CSV files for 2011-2023")
putexcel A7=("Years covered") B7=("2011-2023")
putexcel A8=("Unit of analysis") B8=("Adult person-year")
putexcel A9=("Eligible population") B9=("Adults aged 18+")
putexcel A10=("Partner definition") B10=("Partnered = 1 when another adult exists in the same BU after excluding self, mother, and father")
putexcel A11=("Partner identifier use") B11=("idpartner is not used; partnership is inferred from adult BU co-residency")
putexcel A12=("Weighting") B12=("Unweighted annual share")
putexcel A13=("How target is computed") B13=("Build adult BU roster, self-join by year and BU, drop self and parents, mark qualifying co-residents, merge flags back to the full adult population, then compute partnered_share = n_partnered / n_eligible by year")
putexcel A14=("Output meaning") B14=("Annual partnered share among adults aged 18+ under BU-logic partner inference")

list, sep(0)
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,25 @@ order year n_eligible n_partnered partnered_share
preserve
keep year partnered_share
format partnered_share %12.7f
export excel using "`work_dir'/partnered_share_targets_BUlogic.xlsx", ///
export excel using "`work_dir'/alignment_targets_partnered_share.xlsx", ///
firstrow(variables) replace
restore

* Add metadata sheet so workbook provenance survives regeneration
putexcel set "`work_dir'/alignment_targets_partnered_share.xlsx", sheet("Info") modify
putexcel A1=("Field") B1=("Value")
putexcel A2=("Workbook") B2=("alignment_targets_partnered_share.xlsx")
putexcel A3=("Data sheet") B3=("partnered_share")
putexcel A4=("Relevant do file") B4=("input/DoFilesTarget/03b_calculate_partnership_target.do")
putexcel A5=("Related do file") B5=("input/DoFilesTarget/03a_calculate_partneredShare_initialPop_BUlogic.do")
putexcel A6=("Source data") B6=("Initial population CSV files for 2011-2023")
putexcel A7=("Years covered") B7=("2011-2023")
putexcel A8=("Unit of analysis") B8=("Adult person-year")
putexcel A9=("Eligible population") B9=("Adults aged 18+")
putexcel A10=("Partner definition") B10=("Partnered = 1 when another adult exists in the same BU after excluding self, mother, and father")
putexcel A11=("Partner identifier use") B11=("idpartner is not used; partnership is inferred from adult BU co-residency")
putexcel A12=("Weighting") B12=("Weighted annual share using wgthhcross; n_eligible and n_partnered are retained as unweighted counts in the full table")
putexcel A13=("How target is computed") B13=("Build adult BU roster, self-join by year and BU, drop self and parents, mark qualifying co-residents, merge flags back to the full adult population, then collapse (mean) partnered_share = partnered [pw = wgthhcross] by year")
putexcel A14=("Output meaning") B14=("Annual partnered share among adults aged 18+ under BU-logic partner inference")

list, sep(0)
Binary file removed input/align_employment.xlsx
Binary file not shown.
Binary file removed input/align_student_under30.xlsx
Binary file not shown.
Binary file added input/alignment_adjustment_series.xlsx
Binary file not shown.
Binary file added input/alignment_targets_employment.xlsx
Binary file not shown.
Binary file added input/alignment_targets_inSchool.xlsx
Binary file not shown.
Binary file added input/alignment_targets_partnered_share.xlsx
Binary file not shown.
Binary file added input/economic_time_series.xlsx
Binary file not shown.
Binary file removed input/employment_targets.xlsx
Binary file not shown.
Binary file removed input/inSchool_targets.xlsx
Binary file not shown.
Binary file removed input/partnered_share_targets.xlsx
Binary file not shown.
Binary file removed input/policy parameters.xlsx
Binary file not shown.
Binary file added input/social_care_parameters.xlsx
Binary file not shown.
Loading
Loading