Skip to content

Lifetime income current - #545

Open
justin-ven wants to merge 12 commits into
simpaths:developfrom
justin-ven:lifetime-income-current
Open

justin-ven wants to merge 12 commits into
simpaths:developfrom
justin-ven:lifetime-income-current

Conversation

@justin-ven

Copy link
Copy Markdown
Contributor

updates model for progress implementing lifetime incomes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Startup failures, inconsistent income matching and exports, and a broken Stata continuation remain unresolved.

6 open issues
What changed in this PR

This PR advances SimPaths’ lifetime-income implementation by replacing persisted birth-cohort donors with shared, in-memory normalised income profiles.

Changes:

  • Generate template profiles and match them to the initial simulation population.
  • Add survey-sample matching, mortality projection, and income exports.
  • Update age-specific calibration, supporting model APIs, and package documentation.
File Description
src/​main/​java/​simpaths/​model/​SimPathsModel.java Integrates template generation and population imputation.
src/​main/​java/​simpaths/​model/​Person.java Adds template matching and income reconstruction.
src/​main/​java/​simpaths/​model/​lifetime_incomes/​WhiteNoiseEstimate.java Uses integer observation ages.
src/​main/​java/​simpaths/​model/​lifetime_incomes/​SampleIndividual.java Adds survey matching and mortality projection.
src/​main/​java/​simpaths/​model/​lifetime_incomes/​RegressionProxy.java Supplies age and GDP regression inputs.
src/​main/​java/​simpaths/​model/​lifetime_incomes/​ManagerProjectLifetimeIncomes.java Removes the database-backed projection manager.
src/​main/​java/​simpaths/​model/​lifetime_incomes/​ManagerLifetimeIncomes.java Coordinates template generation, matching, and exports.
src/​main/​java/​simpaths/​model/​lifetime_incomes/​LifetimeIncomeImputation.java Removes legacy cohort-based matching.
src/​main/​java/​simpaths/​model/​lifetime_incomes/​IndividualComparator.java Removes the legacy donor comparator.
src/​main/​java/​simpaths/​model/​lifetime_incomes/​Individual.java Removes the persisted donor entity.
src/​main/​java/​simpaths/​model/​lifetime_incomes/​ImputedIncome.java Adds age-specific income export records.
src/​main/​java/​simpaths/​model/​lifetime_incomes/​ExportCSV.java Removes the legacy cohort exporter.
src/​main/​java/​simpaths/​model/​lifetime_incomes/​EquivalisedIncomeCDF.java Removes the legacy distribution helper.
src/​main/​java/​simpaths/​model/​lifetime_incomes/​BirthCohort.java Removes the persisted cohort entity.
src/​main/​java/​simpaths/​model/​lifetime_incomes/​AnnualIncome.java Removes the persisted annual-income entity.
src/​main/​java/​simpaths/​model/​lifetime_incomes/​AdjustmentFactors.java Revises fixed-effect and age-specific noise factors.
src/​main/​java/​simpaths/​model/​enums/​Gender.java Adds boolean conversion helpers.
src/​main/​java/​simpaths/​model/​BenefitUnit.java Adds an income getter and clarifies a scale comment.
src/​main/​java/​simpaths/​data/​Parameters.java Caps observed-income lookups at the maximum age.
input/​InitialPopulations/​compile/​07_was_wealth_data.do Changes whitespace around a continuation marker.
documentation/​wiki/​developer-guide/​repository-guide.md Renames the manager in the wiki package table.
documentation/​repository-guide.md Renames the manager in the package table.
.gitignore Excludes annual lifetime-income survey samples.

Review effort: Balanced

this.demEnterSample = demEnterSample;

if (originalPerson.ltIncomeDonor!=null) {
if (demEnterSample != SampleEntry.InputData && Parameters.lifetimeIncomeImpute) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

agreed

if (lifetimeIncomeImpute) {
ManagerLifetimeIncomes.generateNormalisedProfiles(log, lifetimeIncomeCapAge, lifetimeIncomeEndAge, lifetimeIncomeCohortSize, lifetimeIncomeTemplates,
lifetimeIncomeWriteToCSV, lifetimeIncomeRandomSeed, outputPath);
boolean projectSample = true;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This internal control is deliberate at present, as the pull request involves functionality that is not yet fully developed

Comment on lines +24 to +26
double dispIncomePerYear = person.getBenefitUnit().getYDispMonth() * 12.0;
double equivScale = person.getBenefitUnit().getEquivalisedWeight();
this.observedIncome = dispIncomePerYear / equivScale;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agreed

Comment on lines +218 to +220
templateIndividuals.sort(Comparator.comparingDouble(individual -> individual.getNormIncome(ageHere).getZValue()));
final double[] sortedZ = templateIndividuals.stream().mapToDouble(individual -> individual.getNormIncome(ageHere).getZValue()).toArray();
boolean agePlus = (age>=capAge);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This cap on age is due to the cap applied by the FRS - age 80 donors are best understood as aged 80+

}
}
try {
String path = outputDir + File.separator + "imputed_incomes.csv";

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agreed

@dav-sonn

Copy link
Copy Markdown
Collaborator

🟡 Changes recommended

Startup failures, inconsistent income matching and exports, and a broken Stata continuation remain unresolved.

6 open issues

What changed in this PR
This PR advances SimPaths’ lifetime-income implementation by replacing persisted birth-cohort donors with shared, in-memory normalised income profiles.

Changes:

  • Generate template profiles and match them to the initial simulation population.
  • Add survey-sample matching, mortality projection, and income exports.
  • Update age-specific calibration, supporting model APIs, and package documentation.

File Description
src/​main/​java/​simpaths/​model/​SimPathsModel.java Integrates template generation and population imputation.
src/​main/​java/​simpaths/​model/​Person.java Adds template matching and income reconstruction.
src/​main/​java/​simpaths/​model/​lifetime_incomes/​WhiteNoiseEstimate.java Uses integer observation ages.
src/​main/​java/​simpaths/​model/​lifetime_incomes/​SampleIndividual.java Adds survey matching and mortality projection.
src/​main/​java/​simpaths/​model/​lifetime_incomes/​RegressionProxy.java Supplies age and GDP regression inputs.
src/​main/​java/​simpaths/​model/​lifetime_incomes/​ManagerProjectLifetimeIncomes.java Removes the database-backed projection manager.
src/​main/​java/​simpaths/​model/​lifetime_incomes/​ManagerLifetimeIncomes.java Coordinates template generation, matching, and exports.
src/​main/​java/​simpaths/​model/​lifetime_incomes/​LifetimeIncomeImputation.java Removes legacy cohort-based matching.
src/​main/​java/​simpaths/​model/​lifetime_incomes/​IndividualComparator.java Removes the legacy donor comparator.
src/​main/​java/​simpaths/​model/​lifetime_incomes/​Individual.java Removes the persisted donor entity.
src/​main/​java/​simpaths/​model/​lifetime_incomes/​ImputedIncome.java Adds age-specific income export records.
src/​main/​java/​simpaths/​model/​lifetime_incomes/​ExportCSV.java Removes the legacy cohort exporter.
src/​main/​java/​simpaths/​model/​lifetime_incomes/​EquivalisedIncomeCDF.java Removes the legacy distribution helper.
src/​main/​java/​simpaths/​model/​lifetime_incomes/​BirthCohort.java Removes the persisted cohort entity.
src/​main/​java/​simpaths/​model/​lifetime_incomes/​AnnualIncome.java Removes the persisted annual-income entity.
src/​main/​java/​simpaths/​model/​lifetime_incomes/​AdjustmentFactors.java Revises fixed-effect and age-specific noise factors.
src/​main/​java/​simpaths/​model/​enums/​Gender.java Adds boolean conversion helpers.
src/​main/​java/​simpaths/​model/​BenefitUnit.java Adds an income getter and clarifies a scale comment.
src/​main/​java/​simpaths/​data/​Parameters.java Caps observed-income lookups at the maximum age.
input/​InitialPopulations/​compile/​07_was_wealth_data.do Changes whitespace around a continuation marker.
documentation/​wiki/​developer-guide/​repository-guide.md Renames the manager in the wiki package table.
documentation/​repository-guide.md Renames the manager in the package table.
.gitignore Excludes annual lifetime-income survey samples.
Review effort: Balanced

@justin-ven: some issues reported here are flagged with high priority. Could you briefly check whether they're relevant? Thank you!
I'm happy to proceed with the merge after your confirmation.

justin-ven and others added 2 commits October 31, 2026 18:14
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@justin-ven

justin-ven commented Oct 31, 2026 via email

Copy link
Copy Markdown
Contributor Author

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants