diff --git a/CLAUDE.md b/CLAUDE.md index 45d8f8362..3e22c5bb6 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -88,7 +88,7 @@ All behavioural equations are estimated externally and loaded at startup from Ex ### Alignment -Several demographic processes are aligned to external targets (ONS projections, LFS shares) via `ActivityAlignmentV2`, `FertilityAlignment`, `PartnershipAlignment`, `InSchoolAlignment`, `SocialCareAlignment`. Alignment factors are exported to `AlignmentAdjustmentFactors1.csv` each run. +Several demographic processes are aligned to external targets (ONS projections, LFS shares) via `ActivityAlignmentV2`, `FertilityAlignment`, `PartnershipAlignment`, `InSchoolAlignment`, `SocialCareAlignment`. Alignment factors are exported to `AlignmentStatistics.csv` each run. ### Configuration @@ -97,10 +97,14 @@ Runs are configured via YAML files in `config/`. `default.yml` documents all ava ### Output Output is written to `output//csv/` by `SimPathsCollector`. Key files: -- `Statistics1.csv` — income distribution (Gini, percentiles, S-Index) -- `Statistics2.csv` — demographic validation (partnership, employment, health by age/gender) -- `EmploymentStatistics.csv`, `HealthStatistics.csv` — domain-specific time series -- `AlignmentAdjustmentFactors1.csv` — alignment diagnostics +- `WealthIncomeStatistics.csv` — income and wealth (Gini, percentiles, S-Index, plus income and wealth by age band) +- `DemographicStatistics.csv` — demographics by age band (partnership, dependent children, population counts) +- `HealthStatistics.csv` — population health by age band (self-rated health, disability shares) +- `LabourStatistics.csv` — labour market transitions, participation, full-time/part-time shares by age band +- `AlignmentStatistics.csv` — alignment diagnostics +- `WellbeingByGender.csv` — wellbeing and quality of life (SF-12, GHQ-12, EQ-5D), ages 25–64, three rows per year (Total/Male/Female) + +The four age-band outputs share one population traversal per year via `AgeBandAggregates`; the bands are 18–29, 30–54 and 55–74. ### Integration tests diff --git a/config/default.yml b/config/default.yml index 785e37cba..f4640ff9c 100644 --- a/config/default.yml +++ b/config/default.yml @@ -1,8 +1,18 @@ # SimPaths multi-run configuration file. # Uncomment and edit any field to override its default value. # CLI flags take final precedence over anything set here. +# +# Commented-out keys show the class default; uncommenting one overrides it. +# An unrecognised key is not an error - it logs a stack trace and is ignored, +# so a mistyped or renamed key silently leaves the default in place. +# +# Only int, long, boolean, double and String fields can be set from this file. +# Fields of other types (for example the UnionMatchingMethod enum behind union +# matching) are not settable here and will fail at startup if added. -# ── Top-level run arguments ──────────────────────────────────────────────────── +# ── Top-level run arguments ─────────────────────────────────────────────────── +# Unlike the sections below, these are active settings rather than documented +# defaults - they override the SimPathsMultiRun defaults on every run. maxNumberOfRuns: 1 # number of sequential simulation runs executeWithGui: false # true = launch JAS-mine GUI; false = headless (required on servers/CI) @@ -23,8 +33,9 @@ model_args: # --- Time trend controls --- # maxAge: 130 # maximum age kept in simulation; persons above this are removed # fixTimeTrend: true # if true, freezes the time trend in regression equations -# timeTrendStopsIn: 2017 # year at which the time trend is frozen (if fixTimeTrend: true) -# timeTrendStopsInMonetaryProcesses: 2017 # same freeze year applied to monetary/income regressions only +# timeTrendStopsIn: 2023 # year at which the time trend is frozen (if fixTimeTrend: true) +# timeTrendStopsInMonetaryProcesses: 2023 # same freeze year for monetary/income regressions; + # defaults to whatever timeTrendStopsIn is set to # --- Random number controls --- # fixRandomSeed: true # if true, each run uses the same fixed seed (randomSeedIfFixed) @@ -32,7 +43,7 @@ model_args: # --- Income security (S-Index) --- # The S-Index is an economic (in)security index computed from a rolling window of # equivalised consumption, discounted and weighted by a risk-aversion parameter. - # SIndex_p50 is reported in Statistics1.csv each year. + # SIndex_p50 is reported in WealthIncomeStatistics.csv each year. # sIndexTimeWindow: 5 # length of rolling window in years (default 5) # sIndexAlpha: 2 # coefficient of relative risk aversion (higher = more sensitivity to drops) # sIndexDelta: 0.98 # annual discount factor applied to past consumption observations @@ -48,7 +59,10 @@ model_args: # useWeights: false # if true, apply survey weights in alignment and statistics calculations # --- Matching method --- -# useSBAMMatching: # if true, use SBAM instead of standard union-matching algorithm + # Union matching is controlled by the UnionMatchingMethod enum field + # `unionMatchingMethod` (default ParametricNoRegion; alternatives Parametric, SBAM). + # It cannot be set from this file - enum fields are not supported by the config + # loader - so change it in SimPathsModel or via the GUI. # --- Demographic projections --- # projectMortality: true # if false, disables stochastic mortality (population does not die) @@ -56,10 +70,10 @@ model_args: # --- Alignment flags --- # See model-concepts.md for a full explanation of what alignment does. # alignPopulation: true # align age-sex-region totals to official population projections -# alignFertility: true # scale birth probabilities to match projected fertility rates +# alignFertility: false # scale birth probabilities to match projected fertility rates # alignEducation: false # align completed education distribution to targets # alignInSchool: false # align school participation rate (age 16–29) to targets -# alignCohabitation: false # align share of cohabiting individuals to targets +# alignCohabitation: true # align share of cohabiting individuals to targets # alignEmployment: false # align employment share to targets # --- Labour market modules --- @@ -68,7 +82,7 @@ model_args: # --- Social care and childcare --- # projectFormalChildcare: true # simulate formal childcare costs -# projectSocialCare: false # simulate social care receipt and provision module +# projectSocialCare: true # simulate social care receipt and provision module # flagSuppressChildcareCosts: false # if true, set formal childcare costs to zero (scenario use) # flagSuppressSocialCareCosts: false # if true, set social care costs to zero (scenario use) @@ -94,12 +108,12 @@ model_args: # Enables backward-induction life-cycle solution for consumption and labour supply. # Decision grids are pre-computed in year 0; agents look up optimal choices each year. # Computationally intensive — disabled by default. -# enableIntertemporalOptimisations: true +# enableIntertemporalOptimisations: false # IO state-space: which characteristics agents respond to when choosing labour/consumption. # Each flag adds a dimension to the grid and increases solve time. # responsesToHealth: true # include physical health in IO state space -# responsesToDisability: false # include disability status in IO state space +# responsesToDisability: true # include disability status in IO state space # responsesToEducation: true # include student and education level in IO state space # responsesToPension: false # include private pension wealth in IO state space # responsesToRetirement: false # include retirement state (and private pension) in IO state space @@ -122,6 +136,19 @@ model_args: # --- Population load --- # ignoreTargetsAtPopulationLoad: false # if true, skip alignment-target checks when loading the initial population + # --- Lifetime income projection --- + # Optional module that projects lifetime income paths for synthetic birth cohorts, + # run once at model build time before the simulation starts. Off by default. +# lifetimeIncomeGenerate: false # generate a new set of lifetime incomes +# lifetimeIncomeStartBirthYear: # first birth cohort to project (no default; required if generating) +# lifetimeIncomeEndBirthYear: # last birth cohort to project (no default; required if generating) +# lifetimeIncomeEndAge: # age at which each cohort's projection stops (no default) +# lifetimeIncomeCohortSize: 10000 # number of synthetic individuals per birth cohort +# lifetimeIncomeWriteToCSV: false # write the projected lifetime incomes to CSV +# lifetimeIncomeRandomSeed: 505 # seed for the lifetime income projection +# lifetimeIncomeAge0StdDev: 0.9 # standard deviation of the initial income draw at age 0 +# lifetimeIncomeImpute: false # impute lifetime income for the initial population at load + # ── innovation_args: parameter variation across sequential runs ──────────────── # These flags control how parameters change between run 0, run 1, run 2, etc. @@ -145,24 +172,31 @@ innovation_args: # ── collector_args: output collection and export ─────────────────────────────── # Controls what SimPathsCollector writes to CSV / database each year. # -# Output files: -# Statistics1.csv — income distribution: Gini coefficients, income percentiles, median EDI, S-Index -# Statistics2.csv — demographic validation: partnership rates, employment, health, disability by age/gender -# AlignmentAdjustmentFactors1.csv — alignment diagnostics: factors, simulated shares, and target shares -# EmploymentStatistics.csv — labour market transitions and participation rates -# HealthStatistics.csv — health measures (SF-12, GHQ-12, EQ-5D) by age/gender +# Output files (one row per year unless noted): +# WealthIncomeStatistics.csv — income and wealth: Gini coefficients, income percentiles, +# median EDI, S-Index, and income/wealth by age band (18-29, 30-54, 55-74) +# DemographicStatistics.csv — demographics by age band: partnership rates, dependent children, +# population counts +# HealthStatistics.csv — population health by age band: self-rated health and disability shares +# LabourStatistics.csv — labour market transitions, participation rates, and +# full-time/part-time shares by age band +# AlignmentStatistics.csv — alignment diagnostics: factors, simulated shares, and target shares +# WellbeingByGender.csv — wellbeing and health-related quality of life (SF-12, GHQ-12, EQ-5D), +# ages 25-64, three rows per year: Total, Male, Female collector_args: # calculateGiniCoefficients: false # compute Gini coefficients (also populates GUI charts); off by default for speed # exportToDatabase: false # write outputs to H2 database (in addition to or instead of CSV) # exportToCSV: true # write outputs to CSV files under output//csv/ -# persistStatistics: true # write Statistics1.csv (income distribution) -# persistStatistics2: true # write Statistics2.csv (demographic validation outputs) -# persistAlignmentAdjustmentFactors: true # write AlignmentAdjustmentFactors1.csv -# persistPersons: false # write one row per person per year (large files) -# persistBenefitUnits: false # write one row per benefit unit per year (large files) -# persistHouseholds: false # write one row per household per year -# persistEmploymentStatistics: false # write EmploymentStatistics.csv +# persistWealthIncomeStatistics: true # write WealthIncomeStatistics.csv (income and wealth) +# persistDemographicStatistics: true # write DemographicStatistics.csv (demographics by age band) +# persistAlignmentStatistics: true # write AlignmentStatistics.csv (alignment diagnostics) +# persistLabourStatistics: true # write LabourStatistics.csv (labour market outcomes) +# persistHealthStatistics: true # write HealthStatistics.csv (population health by age band) +# persistWellbeingByGender: true # write WellbeingByGender.csv (wellbeing by gender, ages 25-64) +# persistPersons: true # write one row per person per year (large files) +# persistBenefitUnits: true # write one row per benefit unit per year (large files) +# persistHouseholds: true # write one row per household per year (large files) # dataDumpStartTime: 0L # first year to write output (0 = startYear) # dataDumpTimePeriod: 1.0 # output frequency in years (1.0 = every year) diff --git a/config/test_run.yml b/config/test_run.yml index 92a0cf6a6..ad0c29019 100644 --- a/config/test_run.yml +++ b/config/test_run.yml @@ -10,9 +10,9 @@ popSize: 20000 integrationTest: true collector_args: - persistStatistics: true - persistStatistics2: true - persistAlignmentAdjustmentFactors: true + persistWealthIncomeStatistics: true + persistDemographicStatistics: true + persistAlignmentStatistics: true persistPersons: false persistBenefitUnits: false persistHouseholds: false diff --git a/documentation/repository-guide.md b/documentation/repository-guide.md index 04c2ed9dc..0a9bcbea7 100644 --- a/documentation/repository-guide.md +++ b/documentation/repository-guide.md @@ -64,12 +64,15 @@ SimPaths/ ├── output/ # Simulation outputs │ ├── [timestamp]_[seed]_[run]/ # Timestamped output folders │ │ ├── csv/ -│ │ │ ├── Statistics1.csv # Income distribution, Gini, S-Index -│ │ │ ├── Statistics2.csv # Demographics by age and gender -│ │ │ ├── Statistics3.csv # Alignment diagnostics -│ │ │ ├── Person.csv # Person-level output -│ │ │ ├── BenefitUnit.csv # Benefit-unit-level output -│ │ │ └── Household.csv # Household-level output +│ │ │ ├── WealthIncomeStatistics.csv # Income and wealth; Gini, S-Index +│ │ │ ├── DemographicStatistics.csv # Demographics by age band +│ │ │ ├── AlignmentStatistics.csv # Alignment diagnostics +│ │ │ ├── LabourStatistics.csv # Labour market transitions and participation +│ │ │ ├── HealthStatistics.csv # Population health by age band +│ │ │ ├── WellbeingByGender.csv # Wellbeing by gender, ages 25-64 +│ │ │ ├── Person.csv # Person-level output +│ │ │ ├── BenefitUnit.csv # Benefit-unit-level output +│ │ │ └── Household.csv # Household-level output │ │ ├── database/ # Run-specific persistence output │ │ └── input/ # Copied run input artifacts │ └── logs/ # Log files (with -f flag on multirun) diff --git a/documentation/wiki/developer-guide/repository-guide.md b/documentation/wiki/developer-guide/repository-guide.md index 8e59bc8c3..1695b9092 100644 --- a/documentation/wiki/developer-guide/repository-guide.md +++ b/documentation/wiki/developer-guide/repository-guide.md @@ -69,12 +69,15 @@ SimPaths/ ├── output/ # Simulation outputs │ ├── [timestamp]_[seed]_[run]/ # Timestamped output folders │ │ ├── csv/ -│ │ │ ├── Statistics1.csv # Income distribution, Gini, S-Index -│ │ │ ├── Statistics2.csv # Demographics by age and gender -│ │ │ ├── Statistics3.csv # Alignment diagnostics -│ │ │ ├── Person.csv # Person-level output -│ │ │ ├── BenefitUnit.csv # Benefit-unit-level output -│ │ │ └── Household.csv # Household-level output +│ │ │ ├── WealthIncomeStatistics.csv # Income and wealth; Gini, S-Index +│ │ │ ├── DemographicStatistics.csv # Demographics by age band +│ │ │ ├── AlignmentStatistics.csv # Alignment diagnostics +│ │ │ ├── LabourStatistics.csv # Labour market transitions and participation +│ │ │ ├── HealthStatistics.csv # Population health by age band +│ │ │ ├── WellbeingByGender.csv # Wellbeing by gender, ages 25-64 +│ │ │ ├── Person.csv # Person-level output +│ │ │ ├── BenefitUnit.csv # Benefit-unit-level output +│ │ │ └── Household.csv # Household-level output │ │ ├── database/ # Run-specific persistence output │ │ └── input/ # Copied run input artifacts │ └── logs/ # Log files (with -f flag on multirun) diff --git a/src/main/java/simpaths/data/statistics/AgeBandAggregates.java b/src/main/java/simpaths/data/statistics/AgeBandAggregates.java new file mode 100644 index 000000000..012ffffef --- /dev/null +++ b/src/main/java/simpaths/data/statistics/AgeBandAggregates.java @@ -0,0 +1,125 @@ +package simpaths.data.statistics; + +import simpaths.data.Parameters; +import simpaths.model.Person; +import simpaths.model.SimPathsModel; +import simpaths.model.enums.Indicator; + +/** + * + * POPULATION AGGREGATES BY AGE BAND, SHARED BY THE ANNUAL STATISTICS OUTPUTS + * + * Bands are indexed 0 = 18-29, 1 = 30-54, 2 = 55-74. + * + * WealthIncomeStatistics, DemographicStatistics, LabourStatistics and HealthStatistics each report a + * subset of these aggregates. Computing them together keeps a single traversal of the + * population per simulated year, and a single definition of each statistic, whichever + * of those four outputs happen to be enabled. + * + */ +public class AgeBandAggregates { + + public final double[] prMarr = {0.,0.,0.}; // share cohabiting + public final double[] avkids = {0.,0.,0.}; // average dependent children + public final double[] health = {0.,0.,0.}; // average self-rated health + public final double[] prDisa = {0.,0.,0.}; // share with long-term disability + public final double[] workFT = {0.,0.,0.}; // share in full-time work + public final double[] workPT = {0.,0.,0.}; // share in part-time work + public final double[] labInc = {0.,0.,0.}; // weekly earnings per worker + public final double[] invInc = {0.,0.,0.}; // monthly equivalised investment income + public final double[] invLosses = {0.,0.,0.}; // monthly equivalised investment losses + public final double[] penInc = {0.,0.,0.}; // monthly equivalised pension income + public final double[] grossDisInc = {0.,0.,0.}; // monthly equivalised disposable income gross of investment losses + public final double[] wealth = {0.,0.,0.}; // equivalised total wealth + public final double[] popula = {0.,0.,0.}; // population count + + private AgeBandAggregates() {} + + /** + * + * TRAVERSE THE POPULATION AND EVALUATE ALL AGE-BAND AGGREGATES + * @param model the simulation manager holding the population + * @return the evaluated aggregates + * + */ + public static AgeBandAggregates compute(SimPathsModel model) { + + AgeBandAggregates agg = new AgeBandAggregates(); + + double[] prMarr = agg.prMarr; + double[] avkids = agg.avkids; + double[] health = agg.health; + double[] prDisa = agg.prDisa; + double[] workFT = agg.workFT; + double[] workPT = agg.workPT; + double[] labInc = agg.labInc; + double[] invInc = agg.invInc; + double[] invLosses = agg.invLosses; + double[] penInc = agg.penInc; + double[] grossDisInc = agg.grossDisInc; + double[] wealth = agg.wealth; + double[] popula = agg.popula; + for (Person person : model.getPersons()) { + // loop over entire population + + int ii = -1; + if (person.getDemAge()>=18 && person.getDemAge()<=29) { + ii = 0; + } else if (person.getDemAge()>=30 && person.getDemAge()<=54) { + ii = 1; + } else if (person.getDemAge()>=55 && person.getDemAge()<=74) { + ii = 2; + } + if (ii>=0) { + + double es = person.getBenefitUnit().getEquivalisedWeight(); + + prMarr[ii] += person.getCohabiting(); + avkids[ii] += person.getBenefitUnit().getNumberChildrenAll(); + health[ii] += person.getHealthSelfRatedValue(); + prDisa[ii] += (Indicator.True.equals(person.getHealthDsblLongtermFlag()))? 1.0: 0.0; + labInc[ii] += person.getEarningsWeekly(); + if ((double)person.getLabourSupplyHoursWeekly() > Parameters.MIN_HOURS_FULL_TIME_EMPLOYED) + workFT[ii] += 1.0; + else if ((double)person.getLabourSupplyHoursWeekly() > 1.0) + workPT[ii] += 1.0; + + invInc[ii] += person.getBenefitUnit().getInvestmentIncomeAnnual() / 12.0 / es; + penInc[ii] += person.getBenefitUnit().getPensionIncomeAnnual() / 12.0 / es; + if (person.getBenefitUnit().getInvestmentIncomeAnnual()<0.0) { + invLosses[ii] += person.getBenefitUnit().getInvestmentIncomeAnnual() / 12.0 / es; + grossDisInc[ii] += (person.getBenefitUnit().getDisposableIncomeMonthlyNoNull() - + person.getBenefitUnit().getInvestmentIncomeAnnual() / 12.0) / es; + } else { + grossDisInc[ii] += person.getBenefitUnit().getDisposableIncomeMonthlyNoNull() / es; + } + wealth[ii] += person.getBenefitUnit().getWealthTotValue(false) / es; + popula[ii] += 1.0; + } + } + for (int ii=0; ii<=2; ii++) { + + // guard both denominators: an empty age band, or a band with no workers, would + // otherwise divide by zero and put NaN into the output + if (workFT[ii] + workPT[ii] > 0.0) + labInc[ii] /= (workFT[ii] + workPT[ii]); + + if (popula[ii]>0) { + + prMarr[ii] /= popula[ii]; + avkids[ii] /= popula[ii]; + health[ii] /= popula[ii]; + prDisa[ii] /= popula[ii]; + workFT[ii] /= popula[ii]; + workPT[ii] /= popula[ii]; + invInc[ii] /= popula[ii]; + penInc[ii] /= popula[ii]; + invLosses[ii] /= popula[ii]; + grossDisInc[ii] /= popula[ii]; + wealth[ii] /= popula[ii]; + } + } + + return agg; + } +} diff --git a/src/main/java/simpaths/data/statistics/AlignmentAdjustmentFactors.java b/src/main/java/simpaths/data/statistics/AlignmentStatistics.java similarity index 99% rename from src/main/java/simpaths/data/statistics/AlignmentAdjustmentFactors.java rename to src/main/java/simpaths/data/statistics/AlignmentStatistics.java index a3d7af30d..e8c6ade34 100644 --- a/src/main/java/simpaths/data/statistics/AlignmentAdjustmentFactors.java +++ b/src/main/java/simpaths/data/statistics/AlignmentStatistics.java @@ -20,7 +20,7 @@ * */ @Entity -public class AlignmentAdjustmentFactors { +public class AlignmentStatistics { @Id private PanelEntityKey key = new PanelEntityKey(1L); diff --git a/src/main/java/simpaths/data/statistics/DemographicStatistics.java b/src/main/java/simpaths/data/statistics/DemographicStatistics.java new file mode 100644 index 000000000..7286a6399 --- /dev/null +++ b/src/main/java/simpaths/data/statistics/DemographicStatistics.java @@ -0,0 +1,142 @@ +package simpaths.data.statistics; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; + +import microsim.data.db.PanelEntityKey; + +/** + * + * DEMOGRAPHIC STATISTICS BY AGE BAND + * + * One row per simulated year, covering the whole population in each of the three age + * bands 18-29, 30-54 and 55-74. + * + * Health, labour and income statistics reported over the same age bands live in + * HealthStatistics, LabourStatistics and WealthIncomeStatistics respectively. + * + */ +@Entity +public class DemographicStatistics { + + @Id + private PanelEntityKey key = new PanelEntityKey(1L); + + //population shares in cohabiting relationships + @Column(name = "pr_married_18_29") + private double demMarried18to29Share; + + @Column(name = "pr_married_30_54") + private double demMarried30to54Share; + + @Column(name = "pr_married_55_74") + private double demMarried55to74Share; + + //average dependent children + @Column(name = "avkids_18_29") + private double demNChild18to29Avg; + + @Column(name = "avkids_30_54") + private double demNChild30to54Avg; + + @Column(name = "avkids_55_74") + private double demNChild55to74Avg; + + //population counts, the denominator for the age-band statistics reported elsewhere + @Column(name= "population_18_29") + private double demPop18to29N; + + @Column(name= "population_30_54") + private double demPop30to54N; + + @Column(name= "population_55_74") + private double demPop55to74N; + + public double getPopulation18to29() { + return demPop18to29N; + } + + public void setPopulation18to29(double demPop18to29N) { + this.demPop18to29N = demPop18to29N; + } + + public double getPopulation30to54() { + return demPop30to54N; + } + + public void setPopulation30to54(double demPop30to54N) { + this.demPop30to54N = demPop30to54N; + } + + public double getPopulation55to74() { + return demPop55to74N; + } + + public void setPopulation55to74(double demPop55to74N) { + this.demPop55to74N = demPop55to74N; + } + + public double getPrMarried18to29() { + return demMarried18to29Share; + } + + public void setPrMarried18to29(double demMarried18to29Share) { + this.demMarried18to29Share = demMarried18to29Share; + } + + public double getPrMarried30to54() { + return demMarried30to54Share; + } + + public void setPrMarried30to54(double demMarried30to54Share) { + this.demMarried30to54Share = demMarried30to54Share; + } + + public double getPrMarried55to74() { + return demMarried55to74Share; + } + + public void setPrMarried55to74(double demMarried55to74Share) { + this.demMarried55to74Share = demMarried55to74Share; + } + + public double getAvkids18to29() { + return demNChild18to29Avg; + } + + public void setAvkids18to29(double demNChild18to29Avg) { + this.demNChild18to29Avg = demNChild18to29Avg; + } + + public double getAvkids30to54() { + return demNChild30to54Avg; + } + + public void setAvkids30to54(double demNChild30to54Avg) { + this.demNChild30to54Avg = demNChild30to54Avg; + } + + public double getAvkids55to74() { + return demNChild55to74Avg; + } + + public void setAvkids55to74(double demNChild55to74Avg) { + this.demNChild55to74Avg = demNChild55to74Avg; + } + + public void update(AgeBandAggregates agg) { + + setPrMarried18to29(agg.prMarr[0]); + setPrMarried30to54(agg.prMarr[1]); + setPrMarried55to74(agg.prMarr[2]); + + setAvkids18to29(agg.avkids[0]); + setAvkids30to54(agg.avkids[1]); + setAvkids55to74(agg.avkids[2]); + + setPopulation18to29(agg.popula[0]); + setPopulation30to54(agg.popula[1]); + setPopulation55to74(agg.popula[2]); + } +} diff --git a/src/main/java/simpaths/data/statistics/HealthStatistics.java b/src/main/java/simpaths/data/statistics/HealthStatistics.java index d418192f3..5a33fa29f 100644 --- a/src/main/java/simpaths/data/statistics/HealthStatistics.java +++ b/src/main/java/simpaths/data/statistics/HealthStatistics.java @@ -3,334 +3,102 @@ import jakarta.persistence.Column; import jakarta.persistence.Entity; import jakarta.persistence.Id; -import jakarta.persistence.Transient; + import microsim.data.db.PanelEntityKey; -import microsim.statistics.CrossSection; -import microsim.statistics.IDoubleSource; -import microsim.statistics.functions.MeanArrayFunction; -import microsim.statistics.functions.PercentileArrayFunction; -import microsim.statistics.functions.SumArrayFunction; -import simpaths.data.filters.AgeGenderCSfilter; -import simpaths.model.Person; -import simpaths.model.SimPathsModel; -import simpaths.model.enums.Gender; +/** + * + * POPULATION HEALTH STATISTICS BY AGE BAND + * + * One row per simulated year, covering the whole population in each of the three age + * bands 18-29, 30-54 and 55-74. + * + * Subjective wellbeing and health-related quality of life, which are reported by gender + * over ages 25 to 64, live in WellbeingByGender. + * + */ @Entity public class HealthStatistics { @Id private PanelEntityKey key = new PanelEntityKey(1L); - @Column(name = "gender") - private String demSex; - - // mental health numeric - @Column(name = "dhm_mean") - private double healthWbScore0to36Avg; - - @Column(name = "dhm_median") - private double healthWbScore0to36P50; - - @Column(name = "dhm_p_10") - private double healthWbScore0to36P10; - - @Column(name = "dhm_p_90") - private double healthWbScore0to36P90; - - @Column(name = "dhm_p_25") - private double healthWbScore0to36P25; - - @Column(name = "dhm_p_75") - private double healthWbScore0to36P75; - - // MCS score numeric - @Column(name = "dhe_mcs_mean") - private double healthMentalMcsAvg; - - @Column(name = "dhe_mcs_median") - private double healthMentalMcsP50; - - @Column(name = "dhe_mcs_p_10") - private double healthMentalMcsP10; - - @Column(name = "dhe_mcs_p_90") - private double healthMentalMcsP90; - - @Column(name = "dhe_mcs_p_25") - private double healthMentalMcsP25; - - @Column(name = "dhe_mcs_p_75") - private double healthMentalMcsP75; - - // PCS score numeric - @Column(name = "dhe_pcs_mean") - private double healthPhysicalPcsAvg; - - @Column(name = "dhe_pcs_median") - private double healthPhysicalPcsP50; - - @Column(name = "dhe_pcs_p_10") - private double healthPhysicalPcsP10; - - @Column(name = "dhe_pcs_p_90") - private double healthPhysicalPcsP90; - - @Column(name = "dhe_pcs_p_25") - private double healthPhysicalPcsP25; - - @Column(name = "dhe_pcs_p_75") - private double healthPhysicalPcsP75; - - // Life Satisfaction numeric - @Column(name = "dls_mean") - private double demLifeSatScore0to10Avg; - - @Column(name = "dls_median") - private double demLifeSatScore0to10P50; - - @Column(name = "dls_p_10") - private double demLifeSatScore0to10P10; - - @Column(name = "dls_p_90") - private double demLifeSatScore0to10P90; - - @Column(name = "dls_p_25") - private double demLifeSatScore0to10P25; - - @Column(name = "dls_p_75") - private double demLifeSatScore0to10P75; - - @Column(name = "qualys") - private double healthLifeYearQualAdj; - - @Column(name = "wellbys") - private double healthLifeYearWbAdj; - - //N - @Column(name = "N") - private int healthNObsSubGroup; - - - public void setGender(String demSex) { - this.demSex = demSex; - } - - public void setHealthWbScore0to36Avg(double healthWbScore0to36Avg) { - this.healthWbScore0to36Avg = healthWbScore0to36Avg; - } - - public void setHealthWbScore0to36P50(double healthWbScore0to36P50) { - this.healthWbScore0to36P50 = healthWbScore0to36P50; - } - - public void setHealthWbScore0to36P10(double healthWbScore0to36P10) { - this.healthWbScore0to36P10 = healthWbScore0to36P10; - } - - public void setHealthWbScore0to36P90(double healthWbScore0to36P90) { - this.healthWbScore0to36P90 = healthWbScore0to36P90; - } - - public void setHealthWbScore0to36P25(double healthWbScore0to36P25) { - this.healthWbScore0to36P25 = healthWbScore0to36P25; - } - - public void setHealthWbScore0to36P75(double healthWbScore0to36P75) { - this.healthWbScore0to36P75 = healthWbScore0to36P75; - } - - public void setHealthMentalMcsAvg(double healthMentalMcsAvg) { - this.healthMentalMcsAvg = healthMentalMcsAvg; - } - - public void setHealthMentalMcsP50(double healthMentalMcsP50) { - this.healthMentalMcsP50 = healthMentalMcsP50; - } + //average health + @Column(name = "health_18_29") + private double healthScore18to29Avg; - public void setHealthMentalMcsP10(double healthMentalMcsP10) { - this.healthMentalMcsP10 = healthMentalMcsP10; - } + @Column(name = "health_30_54") + private double healthScore30to54Avg; - public void setHealthMentalMcsP90(double healthMentalMcsP90) { - this.healthMentalMcsP90 = healthMentalMcsP90; - } + @Column(name = "health_55_74") + private double healthScore55to74Avg; - public void setHealthMentalMcsP25(double healthMentalMcsP25) { - this.healthMentalMcsP25 = healthMentalMcsP25; - } - - public void setHealthMentalMcsP75(double healthMentalMcsP75) { - this.healthMentalMcsP75 = healthMentalMcsP75; - } - - public void setHealthPhysicalPcsAvg(double healthPhysicalPcsAvg) { - this.healthPhysicalPcsAvg = healthPhysicalPcsAvg; - } + //population shares disabled + @Column(name = "pr_disabled_18_29") + private double healthDsbl18to29Share; - public void setHealthPhysicalPcsP50(double healthPhysicalPcsP50) { - this.healthPhysicalPcsP50 = healthPhysicalPcsP50; - } + @Column(name = "pr_disabled_30_54") + private double healthDsbl30to54Share; - public void setHealthPhysicalPcsP10(double healthPhysicalPcsP10) { - this.healthPhysicalPcsP10 = healthPhysicalPcsP10; - } + @Column(name = "pr_disabled_55_74") + private double healthDsbl55to74Share; - public void setHealthPhysicalPcsP90(double healthPhysicalPcsP90) { - this.healthPhysicalPcsP90 = healthPhysicalPcsP90; + public double getHealth18to29() { + return healthScore18to29Avg; } - public void setHealthPhysicalPcsP25(double healthPhysicalPcsP25) { - this.healthPhysicalPcsP25 = healthPhysicalPcsP25; + public void setHealth18to29(double healthScore18to29Avg) { + this.healthScore18to29Avg = healthScore18to29Avg; } - public void setHealthPhysicalPcsP75(double healthPhysicalPcsP75) { - this.healthPhysicalPcsP75 = healthPhysicalPcsP75; + public double getHealth30to54() { + return healthScore30to54Avg; } - public void setDemLifeSatScore0to10Avg(double demLifeSatScore0to10Avg) { - this.demLifeSatScore0to10Avg = demLifeSatScore0to10Avg; + public void setHealth30to54(double healthScore30to54Avg) { + this.healthScore30to54Avg = healthScore30to54Avg; } - public void setDemLifeSatScore0to10P50(double demLifeSatScore0to10P50) { - this.demLifeSatScore0to10P50 = demLifeSatScore0to10P50; + public double getHealth55to74() { + return healthScore55to74Avg; } - public void setDemLifeSatScore0to10P10(double demLifeSatScore0to10P10) { - this.demLifeSatScore0to10P10 = demLifeSatScore0to10P10; + public void setHealth55to74(double healthScore55to74Avg) { + this.healthScore55to74Avg = healthScore55to74Avg; } - public void setDemLifeSatScore0to10P90(double demLifeSatScore0to10P90) { - this.demLifeSatScore0to10P90 = demLifeSatScore0to10P90; + public double getPrDisabled18to29() { + return healthDsbl18to29Share; } - public void setDemLifeSatScore0to10P25(double demLifeSatScore0to10P25) { - this.demLifeSatScore0to10P25 = demLifeSatScore0to10P25; + public void setPrDisabled18to29(double healthDsbl18to29Share) { + this.healthDsbl18to29Share = healthDsbl18to29Share; } - public void setDemLifeSatScore0to10P75(double demLifeSatScore0to10P75) { - this.demLifeSatScore0to10P75 = demLifeSatScore0to10P75; + public double getPrDisabled30to54() { + return healthDsbl30to54Share; } - public void setN(int n) { - healthNObsSubGroup = n; + public void setPrDisabled30to54(double healthDsbl30to54Share) { + this.healthDsbl30to54Share = healthDsbl30to54Share; } - public void setQalys(double healthLifeYearQualAdj) { - this.healthLifeYearQualAdj = healthLifeYearQualAdj; + public double getPrDisabled55to74() { + return healthDsbl55to74Share; } - public void setWellbys(double healthLifeYearWbAdj) { - this.healthLifeYearWbAdj = healthLifeYearWbAdj; + public void setPrDisabled55to74(double healthDsbl55to74Share) { + this.healthDsbl55to74Share = healthDsbl55to74Share; } - public void update(SimPathsModel model, String gender_s) { - - - AgeGenderCSfilter ageGenderCSfilter; - - if (gender_s.equals("Total")) { - ageGenderCSfilter = new AgeGenderCSfilter(25, 64); - } else { - ageGenderCSfilter = new AgeGenderCSfilter(25, 64, Gender.valueOf(gender_s)); - } - - // set gender - setGender(gender_s); - - // dhm score - CrossSection.Double personsDhm = new CrossSection.Double(model.getPersons(), Person.DoublesVariables.Dhm); // Get cross section of simulated individuals and their mental health using the IDoubleSource interface implemented by Person class. - personsDhm.setFilter(ageGenderCSfilter); - - - MeanArrayFunction dhm_mean_f = new MeanArrayFunction(personsDhm); // Create MeanArrayFunction - dhm_mean_f.applyFunction(); - setHealthWbScore0to36Avg(dhm_mean_f.getDoubleValue(IDoubleSource.Variables.Default)); - - PercentileArrayFunction percDhm_f = new PercentileArrayFunction(personsDhm); - percDhm_f.applyFunction(); - - setHealthWbScore0to36P10(percDhm_f.getDoubleValue(PercentileArrayFunction.Variables.P10)); - setHealthWbScore0to36P25(percDhm_f.getDoubleValue(PercentileArrayFunction.Variables.P25)); - setHealthWbScore0to36P50(percDhm_f.getDoubleValue(PercentileArrayFunction.Variables.P50)); - setHealthWbScore0to36P75(percDhm_f.getDoubleValue(PercentileArrayFunction.Variables.P75)); - setHealthWbScore0to36P90(percDhm_f.getDoubleValue(PercentileArrayFunction.Variables.P90)); - - // mcs score - CrossSection.Double personsMCS = new CrossSection.Double(model.getPersons(), Person.DoublesVariables.Dhe_mcs); - personsMCS.setFilter(ageGenderCSfilter); - - - MeanArrayFunction dhe_mcs_mean_f = new MeanArrayFunction(personsMCS); // Create MeanArrayFunction - dhe_mcs_mean_f.applyFunction(); - setHealthMentalMcsAvg(dhe_mcs_mean_f.getDoubleValue(IDoubleSource.Variables.Default)); - - PercentileArrayFunction perc_dhe_mcs_f = new PercentileArrayFunction(personsMCS); - perc_dhe_mcs_f.applyFunction(); - - setHealthMentalMcsP10(perc_dhe_mcs_f.getDoubleValue(PercentileArrayFunction.Variables.P10)); - setHealthMentalMcsP25(perc_dhe_mcs_f.getDoubleValue(PercentileArrayFunction.Variables.P25)); - setHealthMentalMcsP50(perc_dhe_mcs_f.getDoubleValue(PercentileArrayFunction.Variables.P50)); - setHealthMentalMcsP75(perc_dhe_mcs_f.getDoubleValue(PercentileArrayFunction.Variables.P75)); - setHealthMentalMcsP90(perc_dhe_mcs_f.getDoubleValue(PercentileArrayFunction.Variables.P90)); - - // pcs score - CrossSection.Double personsPCS = new CrossSection.Double(model.getPersons(), Person.DoublesVariables.Dhe_pcs); - personsPCS.setFilter(ageGenderCSfilter); - - - MeanArrayFunction dhe_pcs_mean_f = new MeanArrayFunction(personsPCS); // Create MeanArrayFunction - dhe_pcs_mean_f.applyFunction(); - setHealthPhysicalPcsAvg(dhe_pcs_mean_f.getDoubleValue(IDoubleSource.Variables.Default)); - - PercentileArrayFunction perc_dhe_pcs_f = new PercentileArrayFunction(personsPCS); - perc_dhe_pcs_f.applyFunction(); - - setHealthPhysicalPcsP10(perc_dhe_pcs_f.getDoubleValue(PercentileArrayFunction.Variables.P10)); - setHealthPhysicalPcsP25(perc_dhe_pcs_f.getDoubleValue(PercentileArrayFunction.Variables.P25)); - setHealthPhysicalPcsP50(perc_dhe_pcs_f.getDoubleValue(PercentileArrayFunction.Variables.P50)); - setHealthPhysicalPcsP75(perc_dhe_pcs_f.getDoubleValue(PercentileArrayFunction.Variables.P75)); - setHealthPhysicalPcsP90(perc_dhe_pcs_f.getDoubleValue(PercentileArrayFunction.Variables.P90)); - - // Life Satisfaction score - CrossSection.Double personsDls = new CrossSection.Double(model.getPersons(), Person.DoublesVariables.Dls); - personsDls.setFilter(ageGenderCSfilter); - - - MeanArrayFunction dls_mean_f = new MeanArrayFunction(personsDls); // Create MeanArrayFunction - dls_mean_f.applyFunction(); - setDemLifeSatScore0to10Avg(dls_mean_f.getDoubleValue(IDoubleSource.Variables.Default)); - - PercentileArrayFunction perc_dls_f = new PercentileArrayFunction(personsDls); - perc_dls_f.applyFunction(); - - setDemLifeSatScore0to10P10(perc_dls_f.getDoubleValue(PercentileArrayFunction.Variables.P10)); - setDemLifeSatScore0to10P25(perc_dls_f.getDoubleValue(PercentileArrayFunction.Variables.P25)); - setDemLifeSatScore0to10P50(perc_dls_f.getDoubleValue(PercentileArrayFunction.Variables.P50)); - setDemLifeSatScore0to10P75(perc_dls_f.getDoubleValue(PercentileArrayFunction.Variables.P75)); - setDemLifeSatScore0to10P90(perc_dls_f.getDoubleValue(PercentileArrayFunction.Variables.P90)); - - // QALYS as sum of EQ5D - CrossSection.Double personEQ5D = new CrossSection.Double(model.getPersons(), Person.DoublesVariables.He_eq5d); - personEQ5D.setFilter(ageGenderCSfilter); - - SumArrayFunction.Double qalys = new SumArrayFunction.Double(personEQ5D); - qalys.applyFunction(); - setQalys(qalys.getDoubleValue(IDoubleSource.Variables.Default)); - - // WELLBYs as sum of 'points' in 0-10-scale life satisfaction (adjusted) - - SumArrayFunction.Double wellbys = new SumArrayFunction.Double(personsDls); - wellbys.applyFunction(); - - - setWellbys(wellbys.getDoubleValue(IDoubleSource.Variables.Default)); + public void update(AgeBandAggregates agg) { - // count - CrossSection.Integer n_persons = new CrossSection.Integer(model.getPersons(), Person.class, "getPersonCount", true); - n_persons.setFilter(ageGenderCSfilter); + setHealth18to29(agg.health[0]); + setHealth30to54(agg.health[1]); + setHealth55to74(agg.health[2]); - SumArrayFunction.Integer count_f = new SumArrayFunction.Integer(n_persons); - count_f.applyFunction(); - setN(count_f.getIntValue(IDoubleSource.Variables.Default)); + setPrDisabled18to29(agg.prDisa[0]); + setPrDisabled30to54(agg.prDisa[1]); + setPrDisabled55to74(agg.prDisa[2]); } } diff --git a/src/main/java/simpaths/data/statistics/EmploymentStatistics.java b/src/main/java/simpaths/data/statistics/LabourStatistics.java similarity index 60% rename from src/main/java/simpaths/data/statistics/EmploymentStatistics.java rename to src/main/java/simpaths/data/statistics/LabourStatistics.java index 8d510856a..b7a061d71 100644 --- a/src/main/java/simpaths/data/statistics/EmploymentStatistics.java +++ b/src/main/java/simpaths/data/statistics/LabourStatistics.java @@ -15,7 +15,7 @@ import simpaths.model.Person; @Entity -public class EmploymentStatistics { +public class LabourStatistics { @Id private PanelEntityKey key = new PanelEntityKey(1L); @@ -32,6 +32,25 @@ public class EmploymentStatistics { @Column(name = "PropUnemployed") private double labUnempShare; + //average labour status by age band + @Column(name = "work_fulltime_18_29") + private double labWorkFullTime18to29Share; + + @Column(name = "work_fulltime_30_54") + private double labWorkFullTime30to54Share; + + @Column(name = "work_fulltime_55_74") + private double labWorkFullTime55to74Share; + + @Column(name = "work_parttime_18_29") + private double labWorkPartTime18to29Share; + + @Column(name = "work_parttime_30_54") + private double labWorkPartTime30to54Share; + + @Column(name = "work_parttime_55_74") + private double labWorkPartTime55to74Share; + public double getEmpToNotEmp() { return labEmpToNotEmpShare; @@ -65,7 +84,55 @@ public void setPropUnemployed(double propUnemployed) { labUnempShare = propUnemployed; } - public void update(SimPathsModel model) { + public double getWorkFulltime18to29() { + return labWorkFullTime18to29Share; + } + + public void setWorkFulltime18to29(double labWorkFullTime18to29Share) { + this.labWorkFullTime18to29Share = labWorkFullTime18to29Share; + } + + public double getWorkFulltime30to54() { + return labWorkFullTime30to54Share; + } + + public void setWorkFulltime30to54(double labWorkFullTime30to54Share) { + this.labWorkFullTime30to54Share = labWorkFullTime30to54Share; + } + + public double getWorkFulltime55to74() { + return labWorkFullTime55to74Share; + } + + public void setWorkFulltime55to74(double labWorkFullTime55to74Share) { + this.labWorkFullTime55to74Share = labWorkFullTime55to74Share; + } + + public double getWorkParttime18to29() { + return labWorkPartTime18to29Share; + } + + public void setWorkParttime18to29(double labWorkPartTime18to29Share) { + this.labWorkPartTime18to29Share = labWorkPartTime18to29Share; + } + + public double getWorkParttime30to54() { + return labWorkPartTime30to54Share; + } + + public void setWorkParttime30to54(double labWorkPartTime30to54Share) { + this.labWorkPartTime30to54Share = labWorkPartTime30to54Share; + } + + public double getWorkParttime55to74() { + return labWorkPartTime55to74Share; + } + + public void setWorkParttime55to74(double labWorkPartTime55to74Share) { + this.labWorkPartTime55to74Share = labWorkPartTime55to74Share; + } + + public void update(SimPathsModel model, AgeBandAggregates agg) { EmploymentHistoryFilter employmentHistoryEmployed = new EmploymentHistoryFilter(Les_c4.EmployedOrSelfEmployed); EmploymentHistoryFilter employmentHistoryUnemployed = new EmploymentHistoryFilter(Les_c4.NotEmployed); @@ -104,6 +171,13 @@ public void update(SimPathsModel model) { isUnemployed.applyFunction(); setPropUnemployed(isUnemployed.getDoubleValue(IDoubleSource.Variables.Default)); + // labour status by age band + setWorkFulltime18to29(agg.workFT[0]); + setWorkFulltime30to54(agg.workFT[1]); + setWorkFulltime55to74(agg.workFT[2]); + setWorkParttime18to29(agg.workPT[0]); + setWorkParttime30to54(agg.workPT[1]); + setWorkParttime55to74(agg.workPT[2]); } } diff --git a/src/main/java/simpaths/data/statistics/Statistics.java b/src/main/java/simpaths/data/statistics/Statistics.java deleted file mode 100644 index 98d198fd4..000000000 --- a/src/main/java/simpaths/data/statistics/Statistics.java +++ /dev/null @@ -1,166 +0,0 @@ -package simpaths.data.statistics; - -import jakarta.persistence.Column; -import jakarta.persistence.Entity; -import jakarta.persistence.Id; - -import microsim.data.db.PanelEntityKey; - -@Entity -public class Statistics { - - @Id - private PanelEntityKey key = new PanelEntityKey(1L); - - @Column(name = "Gini_coefficient_individual_market_income_nationally") - private double statYMktNatGini; - - @Column(name = "Gini_coefficient_equivalised_household_disposable_income_nationally") - private double statYHhDispEquivNatGini; - - @Column(name = "Median_equivalised_household_disposable_income") - private double yHhDispEquivP50; - - //Percentiles of ydses: - @Column(name = "Ydses_p20") - private double yHhQuintilesC5P20; - - @Column(name = "Ydses_p40") - private double yHhQuintilesC5P40; - - @Column(name = "Ydses_p60") - private double yHhQuintilesC5P60; - - @Column(name = "Ydses_p80") - private double yHhQuintilesC5P80; - - //Percentiles of gross labour income: - @Column(name = "Gross_Labour_Income_p20") - private double yLabP20; - - @Column(name = "Gross_Labour_Income_p40") - private double yLabP40; - - @Column(name = "Gross_Labour_Income_p60") - private double yLabP60; - - @Column(name = "Gross_Labour_Income_p80") - private double yLabP80; - - //Equivalised disposable income - @Column(name = "EDI_p50") - private double edi_p50; - - //Percentiles of SIndex: - @Column(name = "SIndex_p50") - private double sIndex_p50; - - //// Risk-of-poverty threshold is set at 60% of the national median equivalised household disposable income. -// @Column(name = "Risk_of_poverty_threshold") -// private double riskOfPovertyThreshold; - - public void setGiniPersonalGrossEarningsNational(double statYMktNatGini) { - this.statYMktNatGini = statYMktNatGini; - } - - public void setGiniEquivalisedHouseholdDisposableIncomeNational(double statYHhDispEquivNatGini) { - this.statYHhDispEquivNatGini = statYHhDispEquivNatGini; - } - - public double getMedianEquivalisedHouseholdDisposableIncome() { - return yHhDispEquivP50; - } - - public void setMedianEquivalisedHouseholdDisposableIncome(double yHhDispEquivP50) { - this.yHhDispEquivP50 = yHhDispEquivP50; - } - - public double getYHhQuintilesC5P20() { - return yHhQuintilesC5P20; - } - - public void setYHhQuintilesC5P20(double yHhQuintilesC5P20) { - this.yHhQuintilesC5P20 = yHhQuintilesC5P20; - } - - public double getYHhQuintilesC5P40() { - return yHhQuintilesC5P40; - } - - public void setYHhQuintilesC5P40(double yHhQuintilesC5P40) { - this.yHhQuintilesC5P40 = yHhQuintilesC5P40; - } - - public double getYHhQuintilesC5P60() { - return yHhQuintilesC5P60; - } - - public void setYHhQuintilesC5P60(double yHhQuintilesC5P60) { - this.yHhQuintilesC5P60 = yHhQuintilesC5P60; - } - - public double getYHhQuintilesC5P80() { - return yHhQuintilesC5P80; - } - - public void setYHhQuintilesC5P80(double yHhQuintilesC5P80) { - this.yHhQuintilesC5P80 = yHhQuintilesC5P80; - } - - public double getSIndex_p50() { - return sIndex_p50; - } - - public void setSIndex_p50(double sIndex_p50) { - this.sIndex_p50 = sIndex_p50; - } - - public double getYLabP20() { - return yLabP20; - } - - public void setYLabP20(double yLabP20) { - this.yLabP20 = yLabP20; - } - - public double getYLabP40() { - return yLabP40; - } - - public void setYLabP40(double yLabP40) { - this.yLabP40 = yLabP40; - } - - public double getYLabP60() { - return yLabP60; - } - - public void setYLabP60(double yLabP60) { - this.yLabP60 = yLabP60; - } - - public double getYLabP80() { - return yLabP80; - } - - public void setYLabP80(double yLabP80) { - this.yLabP80 = yLabP80; - } - - public double getEdi_p50() { - return edi_p50; - } - - public void setEdi_p50(double edi_p50) { - this.edi_p50 = edi_p50; - } - -// public double getRiskOfPovertyThreshold() { -// return riskOfPovertyThreshold; -// } -// -// public void setRiskOfPovertyThreshold(double riskOfPovertyThreshold) { -// this.riskOfPovertyThreshold = riskOfPovertyThreshold; -// } - -} diff --git a/src/main/java/simpaths/data/statistics/Statistics2.java b/src/main/java/simpaths/data/statistics/Statistics2.java deleted file mode 100644 index df3ae7023..000000000 --- a/src/main/java/simpaths/data/statistics/Statistics2.java +++ /dev/null @@ -1,796 +0,0 @@ -package simpaths.data.statistics; - -import jakarta.persistence.Column; -import jakarta.persistence.Entity; -import jakarta.persistence.Id; - -import microsim.data.db.PanelEntityKey; -import simpaths.data.Parameters; -import simpaths.model.Person; -import simpaths.model.SimPathsModel; -import simpaths.model.enums.Education; -import simpaths.model.enums.Indicator; - -@Entity -public class Statistics2 { - - @Id - private PanelEntityKey key = new PanelEntityKey(1L); - - //population shares in cohabiting relationships - @Column(name = "pr_married_18_29") - private double demMarried18to29Share; - - @Column(name = "pr_married_30_54") - private double demMarried30to54Share; - - @Column(name = "pr_married_55_74") - private double demMarried55to74Share; - - //average dependent children - @Column(name = "avkids_18_29") - private double demNChild18to29Avg; - - @Column(name = "avkids_30_54") - private double demNChild30to54Avg; - - @Column(name = "avkids_55_74") - private double demNChild55to74Avg; - - //average health - @Column(name = "health_18_29") - private double healthScore18to29Avg; - - @Column(name = "health_30_54") - private double healthScore30to54Avg; - - @Column(name = "health_55_74") - private double healthScore55to74Avg; - - //population shares disabled - @Column(name = "pr_disabled_18_29") - private double demDsbl18to29Share; - - @Column(name = "pr_disabled_30_54") - private double demDsbl30to54Share; - - @Column(name = "pr_disabled_55_74") - private double demDsbl55to74Share; - - //average labour status by age and gender - @Column(name = "work_fulltime_18_29") - private double labWorkFullTime18to29Share; - - @Column(name = "work_fulltime_30_54") - private double labWorkFullTime30to54Share; - - @Column(name = "work_fulltime_55_74") - private double labWorkFullTime55to74Share; - - @Column(name = "work_parttime_18_29") - private double labWorkPartTime18to29Share; - - @Column(name = "work_parttime_30_54") - private double labWorkPartTime30to54Share; - - @Column(name = "work_parttime_55_74") - private double labWorkPartTime55to74Share; - - @Column(name = "work_none_18_29") - private double labNoWork18to29Share; - - @Column(name = "work_none_30_54") - private double labNoWork30to54Share; - - @Column(name = "work_none_55_74") - private double labNoWork55to74Share; - - @Column(name = "work_none_18_74") - private double labNoWork18to54Share; - - //employment income - @Column(name = "labourIncome_18_29") - private double statYLab18to29Avg; - - @Column(name = "labourIncome_30_54") - private double statYLab30to54Avg; - - @Column(name = "labourIncome_55_74") - private double statYLab55to74Avg; - - //investment income - @Column(name = "investmentIncome_18_29") - private double statYInvest18to29Avg; - - @Column(name = "investmentIncome_30_54") - private double statYInvest30to54Avg; - - @Column(name = "investmentIncome_55_74") - private double statYInvest55to74Avg; - - //pension income - @Column(name = "pensionIncome_18_29") - private double statYPens18to29Avg; - - @Column(name = "pensionIncome_30_54") - private double statYPens30to54Avg; - - @Column(name = "pensionIncome_55_74") - private double statYPens55to74Avg; - - //disposable income - @Column(name = "disposableIncome_18_29") - private double statYDisp18to29Avg; - - @Column(name = "disposableIncome_30_54") - private double statYDisp30to54Avg; - - @Column(name = "disposableIncome_55_74") - private double statYDisp55to74Avg; - - //investment losses - @Column(name = "investmentLosses_18_29") - private double statInvestLoss18to29Avg; - - @Column(name = "investmentLosses_30_54") - private double statInvestLoss30to54Avg; - - @Column(name = "investmentLosses_55_74") - private double statInvestLoss55to74Avg; - - //disposable income gross of investment losses - @Column(name = "dispInc_grossLosses_18_29") - private double statYDispGrossOfLosses18to29Avg; - - @Column(name = "dispInc_grossLosses_30_54") - private double statYDispGrossOfLosses30to54Avg; - - @Column(name = "dispInc_grossLosses_55_74") - private double statYDispGrossOfLosses55to75Avg; - - //expenditure - @Column(name = "expenditure_18_29") - private double x18to29Avg; - - @Column(name = "expenditure_30_54") - private double x30to54Avg; - - @Column(name = "expenditure_55_74") - private double x55to74Avg; - - @Column(name = "expenditure_18_54") - private double x18to54Avg; - - //consumption to leisure ratios - @Column(name = "cons_to_leis_ratio") - private double xToLeisureRatio; - - //wealth - @Column(name = "wealth_18_29") - private double wealth18to29Avg; - - @Column(name = "wealth_30_54") - private double wealth30to54Avg; - - @Column(name = "wealth_55_74") - private double wealth55to74Avg; - - @Column(name= "population_18_29") - private double demPop18to29N; - - @Column(name= "population_30_54") - private double demPop30to54N; - - @Column(name= "population_55_74") - private double demPop55to74N; - - public double getAaconsToLeisRatio() { - return xToLeisureRatio; - } - - public void setAaconsToLeisRatio(double consToLeis) { - this.xToLeisureRatio = consToLeis; - } - - public double getPopulation18to29() { - return demPop18to29N; - } - - public void setPopulation18to29(double demPop18to29N) { - this.demPop18to29N = demPop18to29N; - } - - public double getPopulation55to74() { - return demPop55to74N; - } - - public void setPopulation30to54(double demPop30to54N) { - this.demPop30to54N = demPop30to54N; - } - - public double getPopulation30to54() { - return demPop30to54N; - } - - public void setPopulation55to74(double demPop55to74N) { - this.demPop55to74N = demPop55to74N; - } - - public double getPrMarried18to29() { - return demMarried18to29Share; - } - - public void setPrMarried18to29(double demMarried18to29Share) { - this.demMarried18to29Share = demMarried18to29Share; - } - - public double getPrMarried30to54() { - return demMarried30to54Share; - } - - public void setPrMarried30to54(double demMarried30to54Share) { - this.demMarried30to54Share = demMarried30to54Share; - } - - public double getPrMarried55to74() { - return demMarried55to74Share; - } - - public void setPrMarried55to74(double demMarried55to74Share) { - this.demMarried55to74Share = demMarried55to74Share; - } - - public double getAvkids18to29() { - return demNChild18to29Avg; - } - - public void setAvkids18to29(double demNChild18to29Avg) { - this.demNChild18to29Avg = demNChild18to29Avg; - } - - public double getAvkids30to54() { - return demNChild30to54Avg; - } - - public void setAvkids30to54(double demNChild30to54Avg) { - this.demNChild30to54Avg = demNChild30to54Avg; - } - - public double getAvkids55to74() { - return demNChild55to74Avg; - } - - public void setAvkids55to74(double demNChild55to74Avg) { - this.demNChild55to74Avg = demNChild55to74Avg; - } - - public double getHealth18to29() { - return healthScore18to29Avg; - } - - public void setHealth18to29(double healthScore18to29Avg) { - this.healthScore18to29Avg = healthScore18to29Avg; - } - - public double getHealth30to54() { - return healthScore30to54Avg; - } - - public void setHealth30to54(double healthScore30to54Avg) { - this.healthScore30to54Avg = healthScore30to54Avg; - } - - public double getHealth55to74() { - return healthScore55to74Avg; - } - - public void setHealth55to74(double healthScore55to74Avg) { - this.healthScore55to74Avg = healthScore55to74Avg; - } - - public double getPrDisabled18to29() { - return demDsbl18to29Share; - } - - public void setPrDisabled18to29(double demDsbl18to29Share) { - this.demDsbl18to29Share = demDsbl18to29Share; - } - - public double getPrDisabled30to54() { - return demDsbl30to54Share; - } - - public void setPrDisabled30to54(double demDsbl30to54Share) { - this.demDsbl30to54Share = demDsbl30to54Share; - } - - public double getPrDisabled55to74() { - return demDsbl55to74Share; - } - - public void setPrDisabled55to74(double demDsbl55to74Share) { - this.demDsbl55to74Share = demDsbl55to74Share; - } - - public double getLabourIncome18to29() { - return statYLab18to29Avg; - } - - public void setLabourIncome18to29(double statYLab18to29Avg) { - this.statYLab18to29Avg = statYLab18to29Avg; - } - - public double getLabourIncome30to54() { - return statYLab30to54Avg; - } - - public void setLabourIncome30to54(double statYLab30to54Avg) { - this.statYLab30to54Avg = statYLab30to54Avg; - } - - public double getLabourIncome55to74() { - return statYLab55to74Avg; - } - - public void setLabourIncome55to74(double statYLab55to74Avg) { - this.statYLab55to74Avg = statYLab55to74Avg; - } - - public double getInvestmentIncome18to29() { - return statYInvest18to29Avg; - } - - public void setInvestmentIncome18to29(double statYInvest18to29Avg) { - this.statYInvest18to29Avg = statYInvest18to29Avg; - } - - public double getInvestmentIncome30to54() { - return statYInvest30to54Avg; - } - - public void setInvestmentIncome30to54(double statYInvest30to54Avg) { - this.statYInvest30to54Avg = statYInvest30to54Avg; - } - - public double getInvestmentIncome55to74() { - return statYInvest55to74Avg; - } - - public void setInvestmentIncome55to74(double statYInvest55to74Avg) { - this.statYInvest55to74Avg = statYInvest55to74Avg; - } - - public double getPensionIncome18to29() { - return statYPens18to29Avg; - } - - public void setPensionIncome18to29(double statYPens18to29Avg) { - this.statYPens18to29Avg = statYPens18to29Avg; - } - - public double getPensionIncome30to54() { - return statYPens30to54Avg; - } - - public void setPensionIncome30to54(double statYPens30to54Avg) { - this.statYPens30to54Avg = statYPens30to54Avg; - } - - public double getPensionIncome55to74() { - return statYPens55to74Avg; - } - - public void setPensionIncome55to74(double statYPens55to74Avg) { - this.statYPens55to74Avg = statYPens55to74Avg; - } - - public double getAadisposableIncome18to29() { - return statYDisp18to29Avg; - } - - public void setAadisposableIncome18to29(double statYDisp18to29Avg) { - this.statYDisp18to29Avg = statYDisp18to29Avg; - } - - public double getAadisposableIncome30to54() { - return statYDisp30to54Avg; - } - - public void setAadisposableIncome30to54(double statYDisp30to54Avg) { - this.statYDisp30to54Avg = statYDisp30to54Avg; - } - - public double getAadisposableIncome55to74() { - return statYDisp55to74Avg; - } - - public void setAadisposableIncome55to74(double statYDisp55to74Avg) { - this.statYDisp55to74Avg = statYDisp55to74Avg; - } - - public double getInvestmentLosses18to29() { - return statInvestLoss18to29Avg; - } - - public void setInvestmentLosses18to29(double statInvestLoss18to29Avg) { - this.statInvestLoss18to29Avg = statInvestLoss18to29Avg; - } - - public double getInvestmentLosses30to54() { - return statInvestLoss30to54Avg; - } - - public void setInvestmentLosses30to54(double statInvestLoss30to54Avg) { - this.statInvestLoss30to54Avg = statInvestLoss30to54Avg; - } - - public double getInvestmentLosses55to74() { - return statInvestLoss55to74Avg; - } - - public void setInvestmentLosses55to74(double statInvestLoss55to74Avg) { - this.statInvestLoss55to74Avg = statInvestLoss55to74Avg; - } - - public double getDispIncomeGrossOfLosses18to29() { - return statYDispGrossOfLosses18to29Avg; - } - - public void setDispIncomeGrossOfLosses18to29(double statYDispGrossOfLosses18to29Avg) { - this.statYDispGrossOfLosses18to29Avg = statYDispGrossOfLosses18to29Avg; - } - - public double getDispIncomeGrossOfLosses30to54() { - return statYDispGrossOfLosses30to54Avg; - } - - public void setDispIncomeGrossOfLosses30to54(double statYDispGrossOfLosses30to54Avg) { - this.statYDispGrossOfLosses30to54Avg = statYDispGrossOfLosses30to54Avg; - } - - public double getDispIncomeGrossOfLosses55to74() { - return statYDispGrossOfLosses55to75Avg; - } - - public void setDispIncomeGrossOfLosses55to74(double statYDispGrossOfLosses55to75Avg) { - this.statYDispGrossOfLosses55to75Avg = statYDispGrossOfLosses55to75Avg; - } - - public double getAaexpenditure18to29() { - return x18to29Avg; - } - - public void setAaexpenditure18to29(double x18to29Avg) { - this.x18to29Avg = x18to29Avg; - } - - public double getAaexpenditure30to54() { - return x30to54Avg; - } - - public void setAaexpenditure30to54(double x30to54Avg) { - this.x30to54Avg = x30to54Avg; - } - - public double getAaexpenditure55to74() { - return x55to74Avg; - } - - public void setAaexpenditure55to74(double x55to74Avg) { - this.x55to74Avg = x55to74Avg; - } - - public double getAaworkNone18to74() { - return labNoWork18to54Share; - } - - public void setAaworkNone18to74(double labNoWork18to54Share) { - this.labNoWork18to54Share = labNoWork18to54Share; - } - - public double getAaexpenditure18to54() { - return x18to54Avg; - } - - public void setAaexpenditure18to54(double x18to54Avg) { - this.x18to54Avg = x18to54Avg; - } - - public double getWealth18to29() { - return wealth18to29Avg; - } - - public void setWealth18to29(double wealth18to29Avg) { - this.wealth18to29Avg = wealth18to29Avg; - } - - public double getWealth30to54() { - return wealth30to54Avg; - } - - public void setWealth30to54(double wealth30to54Avg) { - this.wealth30to54Avg = wealth30to54Avg; - } - - public double getWealth55to74() { - return wealth55to74Avg; - } - - public void setWealth55to74(double wealth55to74Avg) { - this.wealth55to74Avg = wealth55to74Avg; - } - - public double getAworkFulltime18to29() { - return labWorkFullTime18to29Share; - } - - public void setAworkFulltime18to29(double labWorkFullTime18to29Share) { - this.labWorkFullTime18to29Share = labWorkFullTime18to29Share; - } - - public double getAworkFulltime30to54() { - return labWorkFullTime30to54Share; - } - - public void setAworkFulltime30to54(double labWorkFullTime30to54Share) { - this.labWorkFullTime30to54Share = labWorkFullTime30to54Share; - } - - public double getAworkFulltime55to74() { - return labWorkFullTime55to74Share; - } - - public void setAworkFulltime55to74(double labWorkFullTime55to74Share) { - this.labWorkFullTime55to74Share = labWorkFullTime55to74Share; - } - - public double getAworkParttime18to29() { - return labWorkPartTime18to29Share; - } - - public void setAworkParttime18to29(double labWorkPartTime18to29Share) { - this.labWorkPartTime18to29Share = labWorkPartTime18to29Share; - } - - public double getAworkParttime30to54() { - return labWorkPartTime30to54Share; - } - - public void setAworkParttime30to54(double labWorkPartTime30to54Share) { - this.labWorkPartTime30to54Share = labWorkPartTime30to54Share; - } - - public double getAworkParttime55to74() { - return labWorkPartTime55to74Share; - } - - public void setAworkParttime55to74(double labWorkPartTime55to74Share) { - this.labWorkPartTime55to74Share = labWorkPartTime55to74Share; - } - - public double getAaworkNone18to29() { - return labNoWork18to29Share; - } - - public void setAaworkNone18to29(double labNoWork18to29Share) { - this.labNoWork18to29Share = labNoWork18to29Share; - } - - public double getAaworkNone30to54() { - return labNoWork30to54Share; - } - - public void setAaworkNone30to54(double labNoWork30to54Share) { - this.labNoWork30to54Share = labNoWork30to54Share; - } - - public double getAaworkNone55to74() { - return labNoWork55to74Share; - } - - public void setAaworkNone55to74(double labNoWork55to74Share) { - this.labNoWork55to74Share = labNoWork55to74Share; - } - - public void update(SimPathsModel model) { - - // initialise outputs - double[] prMarr = {0.,0.,0.}; - double[] avkids = {0.,0.,0.}; - double[] health = {0.,0.,0.}; - double[] prDisa = {0.,0.,0.}; - double[] workFT = {0.,0.,0.}; - double[] workPT = {0.,0.,0.}; - double[] workNn = {0.,0.,0.,0.}; - double[] labInc = {0.,0.,0.}; - double[] invInc = {0.,0.,0.}; - double[] invLosses = {0.,0.,0.}; - double[] penInc = {0.,0.,0.}; - double[] disInc = {0.,0.,0.}; - double[] grossDisInc = {0.,0.,0.}; - double[] expen = {0.,0.,0.,0.}; - double[] wealth = {0.,0.,0.}; - double[] popula = {0.,0.,0.}; - double ctlNG = 0.0, ctlG = 0.0; - double numberNG = 0.0, numberG = 0.0; - for (Person person : model.getPersons()) { - // loop over entire population - - int ii = -1; - if (person.getDemAge()>=18 && person.getDemAge()<=29) { - ii = 0; - } else if (person.getDemAge()>=30 && person.getDemAge()<=54) { - ii = 1; - } else if (person.getDemAge()>=55 && person.getDemAge()<=74) { - ii = 2; - } - if (ii>=0) { - - double es = person.getBenefitUnit().getEquivalisedWeight(); - - prMarr[ii] += person.getCohabiting(); - avkids[ii] += person.getBenefitUnit().getNumberChildrenAll(); - health[ii] += person.getHealthSelfRatedValue(); - prDisa[ii] += (Indicator.True.equals(person.getHealthDsblLongtermFlag()))? 1.0: 0.0; - labInc[ii] += person.getEarningsWeekly(); - if ((double)person.getLabourSupplyHoursWeekly() > Parameters.MIN_HOURS_FULL_TIME_EMPLOYED) - workFT[ii] += 1.0; - else if ((double)person.getLabourSupplyHoursWeekly() > 1.0) - workPT[ii] += 1.0; - else { - workNn[ii] += 1.0; - workNn[3] += 1.0; - } - - invInc[ii] += person.getBenefitUnit().getInvestmentIncomeAnnual() / 12.0 / es; - penInc[ii] += person.getBenefitUnit().getPensionIncomeAnnual() / 12.0 / es; - disInc[ii] += person.getBenefitUnit().getDisposableIncomeMonthlyNoNull() / es; - if (person.getBenefitUnit().getInvestmentIncomeAnnual()<0.0) { - invLosses[ii] += person.getBenefitUnit().getInvestmentIncomeAnnual() / 12.0 / es; - grossDisInc[ii] += (person.getBenefitUnit().getDisposableIncomeMonthlyNoNull() - - person.getBenefitUnit().getInvestmentIncomeAnnual() / 12.0) / es; - } else { - grossDisInc[ii] += person.getBenefitUnit().getDisposableIncomeMonthlyNoNull() / es; - } - double expenditurePerMonth = person.getBenefitUnit().getDiscretionaryConsumptionPerYear(false) / 12.0 + - person.getBenefitUnit().getXChildCareWeek(false) * Parameters.WEEKS_PER_MONTH + - person.getBenefitUnit().getXCareWeek(false) * Parameters.WEEKS_PER_MONTH; - if (expenditurePerMonth > 0.0) { - expenditurePerMonth /= es; - expen[ii] += Math.log(expenditurePerMonth); - if (person.getDemAge()>=18 && person.getDemAge()<=54) { - expen[3] += Math.log(expenditurePerMonth); - } - } - if (person.getDemAge()>=55 && person.getDemAge()<=60) { - - if (Education.High.equals(person.getEduHighestC4())) { - numberG += 1.0; - ctlG += expenditurePerMonth / Parameters.WEEKS_PER_MONTH / person.getLeisureHoursPerWeek(); - } else { - numberNG += 1.0; - ctlNG += expenditurePerMonth / Parameters.WEEKS_PER_MONTH / person.getLeisureHoursPerWeek(); - } - } - wealth[ii] += person.getBenefitUnit().getWealthTotValue(false) / es; - popula[ii] += 1.0; - } - } - if (numberG>0.1) { - ctlG /= numberG; - } - if (numberNG>0.1) { - ctlNG /= numberNG; - } - for (int ii=0; ii<=2; ii++) { - - if (popula[ii]>=0) { - - labInc[ii] /= (workFT[ii] + workPT[ii]); - prMarr[ii] /= popula[ii]; - avkids[ii] /= popula[ii]; - health[ii] /= popula[ii]; - prDisa[ii] /= popula[ii]; - workFT[ii] /= popula[ii]; - workPT[ii] /= popula[ii]; - workNn[ii] /= popula[ii]; - invInc[ii] /= popula[ii]; - penInc[ii] /= popula[ii]; - disInc[ii] /= popula[ii]; - invLosses[ii] /= popula[ii]; - grossDisInc[ii] /= popula[ii]; - expen[ii] = Math.exp(expen[ii] / popula[ii]); - wealth[ii] /= popula[ii]; - } - } - workNn[3] /= (popula[0]+popula[1]+popula[2]); - expen[3] = Math.exp(expen[3] / (popula[0]+popula[1])); - - // update calibration statistics as differences to target moments - workNn[0] -= 0.3427271; //2019 - pooled UKHLS data (ukhls_pooled_all_obs_02.dta) - workNn[1] -= 0.2045448; - workNn[2] -= 0.6011462; - workNn[3] -= 0.3808046; - - expen[0] -= 165.8951 * Parameters.WEEKS_PER_MONTH; - expen[1] -= 309.2464 * Parameters.WEEKS_PER_MONTH; - expen[2] -= 323.1081 * Parameters.WEEKS_PER_MONTH; - expen[3] -= 255.13679 * Parameters.WEEKS_PER_MONTH; - - disInc[0] -= 295.8024 * Parameters.WEEKS_PER_MONTH; - disInc[1] -= 482.8467 * Parameters.WEEKS_PER_MONTH; - disInc[2] -= 478.0918 * Parameters.WEEKS_PER_MONTH; - - double ctlRatio = ctlG / ctlNG - 1.361384; - - - // map statistics to outputs - setPrMarried18to29(prMarr[0]); - setPrMarried30to54(prMarr[1]); - setPrMarried55to74(prMarr[2]); - - setAvkids18to29(avkids[0]); - setAvkids30to54(avkids[1]); - setAvkids55to74(avkids[2]); - - setHealth18to29(health[0]); - setHealth30to54(health[1]); - setHealth55to74(health[2]); - - setPrDisabled18to29(prDisa[0]); - setPrDisabled30to54(prDisa[1]); - setPrDisabled55to74(prDisa[2]); - - setAworkFulltime18to29(workFT[0]); - setAworkFulltime30to54(workFT[1]); - setAworkFulltime55to74(workFT[2]); - - setAworkParttime18to29(workPT[0]); - setAworkParttime30to54(workPT[1]); - setAworkParttime55to74(workPT[2]); - - setAaworkNone18to29(workNn[0]); - setAaworkNone30to54(workNn[1]); - setAaworkNone55to74(workNn[2]); - setAaworkNone18to74(workNn[3]); - - setLabourIncome18to29(labInc[0]); - setLabourIncome30to54(labInc[1]); - setLabourIncome55to74(labInc[2]); - - setInvestmentIncome18to29(invInc[0]); - setInvestmentIncome30to54(invInc[1]); - setInvestmentIncome55to74(invInc[2]); - - setPensionIncome18to29(penInc[0]); - setPensionIncome30to54(penInc[1]); - setPensionIncome55to74(penInc[2]); - - setAadisposableIncome18to29(disInc[0]); - setAadisposableIncome30to54(disInc[1]); - setAadisposableIncome55to74(disInc[2]); - - setInvestmentLosses18to29(invLosses[0]); - setInvestmentLosses30to54(invLosses[1]); - setInvestmentLosses55to74(invLosses[2]); - - setDispIncomeGrossOfLosses18to29(grossDisInc[0]); - setDispIncomeGrossOfLosses30to54(grossDisInc[1]); - setDispIncomeGrossOfLosses55to74(grossDisInc[2]); - - setAaexpenditure18to29(expen[0]); - setAaexpenditure30to54(expen[1]); - setAaexpenditure55to74(expen[2]); - setAaexpenditure18to54(expen[3]); - - setAaconsToLeisRatio(ctlRatio); - - setWealth18to29(wealth[0]); - setWealth30to54(wealth[1]); - setWealth55to74(wealth[2]); - - setPopulation18to29(popula[0]); - setPopulation30to54(popula[1]); - setPopulation55to74(popula[2]); - } -} diff --git a/src/main/java/simpaths/data/statistics/WealthIncomeStatistics.java b/src/main/java/simpaths/data/statistics/WealthIncomeStatistics.java new file mode 100644 index 000000000..c935af77e --- /dev/null +++ b/src/main/java/simpaths/data/statistics/WealthIncomeStatistics.java @@ -0,0 +1,405 @@ +package simpaths.data.statistics; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; + +import microsim.data.db.PanelEntityKey; + +@Entity +public class WealthIncomeStatistics { + + @Id + private PanelEntityKey key = new PanelEntityKey(1L); + + @Column(name = "Gini_coefficient_individual_market_income_nationally") + private double statYMktNatGini; + + @Column(name = "Gini_coefficient_equivalised_household_disposable_income_nationally") + private double statYHhDispEquivNatGini; + + @Column(name = "Median_equivalised_household_disposable_income") + private double yHhDispEquivP50; + + //Percentiles of ydses: + @Column(name = "Ydses_p20") + private double yHhQuintilesC5P20; + + @Column(name = "Ydses_p40") + private double yHhQuintilesC5P40; + + @Column(name = "Ydses_p60") + private double yHhQuintilesC5P60; + + @Column(name = "Ydses_p80") + private double yHhQuintilesC5P80; + + //Percentiles of gross labour income: + @Column(name = "Gross_Labour_Income_p20") + private double yLabP20; + + @Column(name = "Gross_Labour_Income_p40") + private double yLabP40; + + @Column(name = "Gross_Labour_Income_p60") + private double yLabP60; + + @Column(name = "Gross_Labour_Income_p80") + private double yLabP80; + + //Equivalised disposable income + @Column(name = "EDI_p50") + private double edi_p50; + + //Percentiles of SIndex: + @Column(name = "SIndex_p50") + private double sIndex_p50; + + //employment income, averaged over workers rather than over population, weekly and not equivalised + @Column(name = "labourIncome_perWorker_weekly_18_29") + private double statYLabWeeklyPerWorker18to29Avg; + + @Column(name = "labourIncome_perWorker_weekly_30_54") + private double statYLabWeeklyPerWorker30to54Avg; + + @Column(name = "labourIncome_perWorker_weekly_55_74") + private double statYLabWeeklyPerWorker55to74Avg; + + //investment income + @Column(name = "investmentIncome_18_29") + private double statYInvest18to29Avg; + + @Column(name = "investmentIncome_30_54") + private double statYInvest30to54Avg; + + @Column(name = "investmentIncome_55_74") + private double statYInvest55to74Avg; + + //pension income + @Column(name = "pensionIncome_18_29") + private double statYPens18to29Avg; + + @Column(name = "pensionIncome_30_54") + private double statYPens30to54Avg; + + @Column(name = "pensionIncome_55_74") + private double statYPens55to74Avg; + + //investment losses + @Column(name = "investmentLosses_18_29") + private double statInvestLoss18to29Avg; + + @Column(name = "investmentLosses_30_54") + private double statInvestLoss30to54Avg; + + @Column(name = "investmentLosses_55_74") + private double statInvestLoss55to74Avg; + + //disposable income gross of investment losses + @Column(name = "dispInc_grossLosses_18_29") + private double statYDispGrossOfLosses18to29Avg; + + @Column(name = "dispInc_grossLosses_30_54") + private double statYDispGrossOfLosses30to54Avg; + + @Column(name = "dispInc_grossLosses_55_74") + private double statYDispGrossOfLosses55to74Avg; + + //wealth + @Column(name = "wealth_18_29") + private double wealth18to29Avg; + + @Column(name = "wealth_30_54") + private double wealth30to54Avg; + + @Column(name = "wealth_55_74") + private double wealth55to74Avg; + + //// Risk-of-poverty threshold is set at 60% of the national median equivalised household disposable income. +// @Column(name = "Risk_of_poverty_threshold") +// private double riskOfPovertyThreshold; + + public void setGiniPersonalGrossEarningsNational(double statYMktNatGini) { + this.statYMktNatGini = statYMktNatGini; + } + + public void setGiniEquivalisedHouseholdDisposableIncomeNational(double statYHhDispEquivNatGini) { + this.statYHhDispEquivNatGini = statYHhDispEquivNatGini; + } + + public double getMedianEquivalisedHouseholdDisposableIncome() { + return yHhDispEquivP50; + } + + public void setMedianEquivalisedHouseholdDisposableIncome(double yHhDispEquivP50) { + this.yHhDispEquivP50 = yHhDispEquivP50; + } + + public double getYHhQuintilesC5P20() { + return yHhQuintilesC5P20; + } + + public void setYHhQuintilesC5P20(double yHhQuintilesC5P20) { + this.yHhQuintilesC5P20 = yHhQuintilesC5P20; + } + + public double getYHhQuintilesC5P40() { + return yHhQuintilesC5P40; + } + + public void setYHhQuintilesC5P40(double yHhQuintilesC5P40) { + this.yHhQuintilesC5P40 = yHhQuintilesC5P40; + } + + public double getYHhQuintilesC5P60() { + return yHhQuintilesC5P60; + } + + public void setYHhQuintilesC5P60(double yHhQuintilesC5P60) { + this.yHhQuintilesC5P60 = yHhQuintilesC5P60; + } + + public double getYHhQuintilesC5P80() { + return yHhQuintilesC5P80; + } + + public void setYHhQuintilesC5P80(double yHhQuintilesC5P80) { + this.yHhQuintilesC5P80 = yHhQuintilesC5P80; + } + + public double getSIndex_p50() { + return sIndex_p50; + } + + public void setSIndex_p50(double sIndex_p50) { + this.sIndex_p50 = sIndex_p50; + } + + public double getYLabP20() { + return yLabP20; + } + + public void setYLabP20(double yLabP20) { + this.yLabP20 = yLabP20; + } + + public double getYLabP40() { + return yLabP40; + } + + public void setYLabP40(double yLabP40) { + this.yLabP40 = yLabP40; + } + + public double getYLabP60() { + return yLabP60; + } + + public void setYLabP60(double yLabP60) { + this.yLabP60 = yLabP60; + } + + public double getYLabP80() { + return yLabP80; + } + + public void setYLabP80(double yLabP80) { + this.yLabP80 = yLabP80; + } + + public double getEdi_p50() { + return edi_p50; + } + + public void setEdi_p50(double edi_p50) { + this.edi_p50 = edi_p50; + } + + public double getLabourIncomeWeeklyPerWorker18to29() { + return statYLabWeeklyPerWorker18to29Avg; + } + + public void setLabourIncomeWeeklyPerWorker18to29(double statYLabWeeklyPerWorker18to29Avg) { + this.statYLabWeeklyPerWorker18to29Avg = statYLabWeeklyPerWorker18to29Avg; + } + + public double getLabourIncomeWeeklyPerWorker30to54() { + return statYLabWeeklyPerWorker30to54Avg; + } + + public void setLabourIncomeWeeklyPerWorker30to54(double statYLabWeeklyPerWorker30to54Avg) { + this.statYLabWeeklyPerWorker30to54Avg = statYLabWeeklyPerWorker30to54Avg; + } + + public double getLabourIncomeWeeklyPerWorker55to74() { + return statYLabWeeklyPerWorker55to74Avg; + } + + public void setLabourIncomeWeeklyPerWorker55to74(double statYLabWeeklyPerWorker55to74Avg) { + this.statYLabWeeklyPerWorker55to74Avg = statYLabWeeklyPerWorker55to74Avg; + } + + public double getInvestmentIncome18to29() { + return statYInvest18to29Avg; + } + + public void setInvestmentIncome18to29(double statYInvest18to29Avg) { + this.statYInvest18to29Avg = statYInvest18to29Avg; + } + + public double getInvestmentIncome30to54() { + return statYInvest30to54Avg; + } + + public void setInvestmentIncome30to54(double statYInvest30to54Avg) { + this.statYInvest30to54Avg = statYInvest30to54Avg; + } + + public double getInvestmentIncome55to74() { + return statYInvest55to74Avg; + } + + public void setInvestmentIncome55to74(double statYInvest55to74Avg) { + this.statYInvest55to74Avg = statYInvest55to74Avg; + } + + public double getPensionIncome18to29() { + return statYPens18to29Avg; + } + + public void setPensionIncome18to29(double statYPens18to29Avg) { + this.statYPens18to29Avg = statYPens18to29Avg; + } + + public double getPensionIncome30to54() { + return statYPens30to54Avg; + } + + public void setPensionIncome30to54(double statYPens30to54Avg) { + this.statYPens30to54Avg = statYPens30to54Avg; + } + + public double getPensionIncome55to74() { + return statYPens55to74Avg; + } + + public void setPensionIncome55to74(double statYPens55to74Avg) { + this.statYPens55to74Avg = statYPens55to74Avg; + } + + public double getInvestmentLosses18to29() { + return statInvestLoss18to29Avg; + } + + public void setInvestmentLosses18to29(double statInvestLoss18to29Avg) { + this.statInvestLoss18to29Avg = statInvestLoss18to29Avg; + } + + public double getInvestmentLosses30to54() { + return statInvestLoss30to54Avg; + } + + public void setInvestmentLosses30to54(double statInvestLoss30to54Avg) { + this.statInvestLoss30to54Avg = statInvestLoss30to54Avg; + } + + public double getInvestmentLosses55to74() { + return statInvestLoss55to74Avg; + } + + public void setInvestmentLosses55to74(double statInvestLoss55to74Avg) { + this.statInvestLoss55to74Avg = statInvestLoss55to74Avg; + } + + public double getDispIncomeGrossOfLosses18to29() { + return statYDispGrossOfLosses18to29Avg; + } + + public void setDispIncomeGrossOfLosses18to29(double statYDispGrossOfLosses18to29Avg) { + this.statYDispGrossOfLosses18to29Avg = statYDispGrossOfLosses18to29Avg; + } + + public double getDispIncomeGrossOfLosses30to54() { + return statYDispGrossOfLosses30to54Avg; + } + + public void setDispIncomeGrossOfLosses30to54(double statYDispGrossOfLosses30to54Avg) { + this.statYDispGrossOfLosses30to54Avg = statYDispGrossOfLosses30to54Avg; + } + + public double getDispIncomeGrossOfLosses55to74() { + return statYDispGrossOfLosses55to74Avg; + } + + public void setDispIncomeGrossOfLosses55to74(double statYDispGrossOfLosses55to74Avg) { + this.statYDispGrossOfLosses55to74Avg = statYDispGrossOfLosses55to74Avg; + } + + public double getWealth18to29() { + return wealth18to29Avg; + } + + public void setWealth18to29(double wealth18to29Avg) { + this.wealth18to29Avg = wealth18to29Avg; + } + + public double getWealth30to54() { + return wealth30to54Avg; + } + + public void setWealth30to54(double wealth30to54Avg) { + this.wealth30to54Avg = wealth30to54Avg; + } + + public double getWealth55to74() { + return wealth55to74Avg; + } + + public void setWealth55to74(double wealth55to74Avg) { + this.wealth55to74Avg = wealth55to74Avg; + } + + /** + * + * POPULATE THE INCOME, WEALTH AND CONSUMPTION STATISTICS REPORTED BY AGE BAND + * + * The distributional statistics held by this class are set by SimPathsCollector as + * its own calculation events fire; this method covers only the age-band aggregates. + * + */ + public void update(AgeBandAggregates agg) { + + setLabourIncomeWeeklyPerWorker18to29(agg.labInc[0]); + setLabourIncomeWeeklyPerWorker30to54(agg.labInc[1]); + setLabourIncomeWeeklyPerWorker55to74(agg.labInc[2]); + + setInvestmentIncome18to29(agg.invInc[0]); + setInvestmentIncome30to54(agg.invInc[1]); + setInvestmentIncome55to74(agg.invInc[2]); + + setPensionIncome18to29(agg.penInc[0]); + setPensionIncome30to54(agg.penInc[1]); + setPensionIncome55to74(agg.penInc[2]); + + setInvestmentLosses18to29(agg.invLosses[0]); + setInvestmentLosses30to54(agg.invLosses[1]); + setInvestmentLosses55to74(agg.invLosses[2]); + + setDispIncomeGrossOfLosses18to29(agg.grossDisInc[0]); + setDispIncomeGrossOfLosses30to54(agg.grossDisInc[1]); + setDispIncomeGrossOfLosses55to74(agg.grossDisInc[2]); + + setWealth18to29(agg.wealth[0]); + setWealth30to54(agg.wealth[1]); + setWealth55to74(agg.wealth[2]); + } + +// public double getRiskOfPovertyThreshold() { +// return riskOfPovertyThreshold; +// } +// +// public void setRiskOfPovertyThreshold(double riskOfPovertyThreshold) { +// this.riskOfPovertyThreshold = riskOfPovertyThreshold; +// } + +} diff --git a/src/main/java/simpaths/data/statistics/WellbeingByGender.java b/src/main/java/simpaths/data/statistics/WellbeingByGender.java new file mode 100644 index 000000000..a67fcbca3 --- /dev/null +++ b/src/main/java/simpaths/data/statistics/WellbeingByGender.java @@ -0,0 +1,368 @@ +package simpaths.data.statistics; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import microsim.data.db.PanelEntityKey; +import microsim.statistics.CrossSection; +import microsim.statistics.IDoubleSource; +import microsim.statistics.functions.MeanArrayFunction; +import microsim.statistics.functions.PercentileArrayFunction; +import microsim.statistics.functions.SumArrayFunction; +import simpaths.data.filters.AgeGenderCSfilter; +import simpaths.model.Person; +import simpaths.model.SimPathsModel; +import simpaths.model.enums.Gender; + +/** + * + * SUBJECTIVE WELLBEING AND HEALTH-RELATED QUALITY OF LIFE, BY GENDER + * + * Written once per gender group per simulated year (Total, Male, Female), so the + * output is stacked long rather than wide. All measures cover ages 25 to 64. + * + * Population-wide health statistics reported by age band live in HealthStatistics. + * + */ +@Entity +public class WellbeingByGender { + + @Id + private PanelEntityKey key = new PanelEntityKey(1L); + + @Column(name = "gender") + private String demSex; + + // mental health numeric + @Column(name = "dhm_mean") + private double healthWbScore0to36Avg; + + @Column(name = "dhm_median") + private double healthWbScore0to36P50; + + @Column(name = "dhm_p_10") + private double healthWbScore0to36P10; + + @Column(name = "dhm_p_90") + private double healthWbScore0to36P90; + + @Column(name = "dhm_p_25") + private double healthWbScore0to36P25; + + @Column(name = "dhm_p_75") + private double healthWbScore0to36P75; + + // MCS score numeric + @Column(name = "dhe_mcs_mean") + private double healthMentalMcsAvg; + + @Column(name = "dhe_mcs_median") + private double healthMentalMcsP50; + + @Column(name = "dhe_mcs_p_10") + private double healthMentalMcsP10; + + @Column(name = "dhe_mcs_p_90") + private double healthMentalMcsP90; + + @Column(name = "dhe_mcs_p_25") + private double healthMentalMcsP25; + + @Column(name = "dhe_mcs_p_75") + private double healthMentalMcsP75; + + // PCS score numeric + @Column(name = "dhe_pcs_mean") + private double healthPhysicalPcsAvg; + + @Column(name = "dhe_pcs_median") + private double healthPhysicalPcsP50; + + @Column(name = "dhe_pcs_p_10") + private double healthPhysicalPcsP10; + + @Column(name = "dhe_pcs_p_90") + private double healthPhysicalPcsP90; + + @Column(name = "dhe_pcs_p_25") + private double healthPhysicalPcsP25; + + @Column(name = "dhe_pcs_p_75") + private double healthPhysicalPcsP75; + + // Life Satisfaction numeric + @Column(name = "dls_mean") + private double demLifeSatScore0to10Avg; + + @Column(name = "dls_median") + private double demLifeSatScore0to10P50; + + @Column(name = "dls_p_10") + private double demLifeSatScore0to10P10; + + @Column(name = "dls_p_90") + private double demLifeSatScore0to10P90; + + @Column(name = "dls_p_25") + private double demLifeSatScore0to10P25; + + @Column(name = "dls_p_75") + private double demLifeSatScore0to10P75; + + @Column(name = "qualys") + private double healthLifeYearQualAdj; + + @Column(name = "wellbys") + private double healthLifeYearWbAdj; + + //N + @Column(name = "N") + private int healthNObsSubGroup; + + + public void setGender(String demSex) { + this.demSex = demSex; + } + + /** + * + * ENTITY ID FOR A GENDER GROUP + * + * Three rows are written per simulated year, one per gender group. The entity key is + * part of the database primary key alongside simulation time and run, so the groups + * need distinct ids to be persisted as separate records rather than overwriting + * one another. + * + * @param gender_s the gender group being reported + * @return the id identifying that group + * + */ + private static long genderKeyId(String gender_s) { + + if ("Male".equals(gender_s)) + return 2L; + if ("Female".equals(gender_s)) + return 3L; + return 1L; // Total + } + + public void setHealthWbScore0to36Avg(double healthWbScore0to36Avg) { + this.healthWbScore0to36Avg = healthWbScore0to36Avg; + } + + public void setHealthWbScore0to36P50(double healthWbScore0to36P50) { + this.healthWbScore0to36P50 = healthWbScore0to36P50; + } + + public void setHealthWbScore0to36P10(double healthWbScore0to36P10) { + this.healthWbScore0to36P10 = healthWbScore0to36P10; + } + + public void setHealthWbScore0to36P90(double healthWbScore0to36P90) { + this.healthWbScore0to36P90 = healthWbScore0to36P90; + } + + public void setHealthWbScore0to36P25(double healthWbScore0to36P25) { + this.healthWbScore0to36P25 = healthWbScore0to36P25; + } + + public void setHealthWbScore0to36P75(double healthWbScore0to36P75) { + this.healthWbScore0to36P75 = healthWbScore0to36P75; + } + + public void setHealthMentalMcsAvg(double healthMentalMcsAvg) { + this.healthMentalMcsAvg = healthMentalMcsAvg; + } + + public void setHealthMentalMcsP50(double healthMentalMcsP50) { + this.healthMentalMcsP50 = healthMentalMcsP50; + } + + public void setHealthMentalMcsP10(double healthMentalMcsP10) { + this.healthMentalMcsP10 = healthMentalMcsP10; + } + + public void setHealthMentalMcsP90(double healthMentalMcsP90) { + this.healthMentalMcsP90 = healthMentalMcsP90; + } + + public void setHealthMentalMcsP25(double healthMentalMcsP25) { + this.healthMentalMcsP25 = healthMentalMcsP25; + } + + public void setHealthMentalMcsP75(double healthMentalMcsP75) { + this.healthMentalMcsP75 = healthMentalMcsP75; + } + + public void setHealthPhysicalPcsAvg(double healthPhysicalPcsAvg) { + this.healthPhysicalPcsAvg = healthPhysicalPcsAvg; + } + + public void setHealthPhysicalPcsP50(double healthPhysicalPcsP50) { + this.healthPhysicalPcsP50 = healthPhysicalPcsP50; + } + + public void setHealthPhysicalPcsP10(double healthPhysicalPcsP10) { + this.healthPhysicalPcsP10 = healthPhysicalPcsP10; + } + + public void setHealthPhysicalPcsP90(double healthPhysicalPcsP90) { + this.healthPhysicalPcsP90 = healthPhysicalPcsP90; + } + + public void setHealthPhysicalPcsP25(double healthPhysicalPcsP25) { + this.healthPhysicalPcsP25 = healthPhysicalPcsP25; + } + + public void setHealthPhysicalPcsP75(double healthPhysicalPcsP75) { + this.healthPhysicalPcsP75 = healthPhysicalPcsP75; + } + + public void setDemLifeSatScore0to10Avg(double demLifeSatScore0to10Avg) { + this.demLifeSatScore0to10Avg = demLifeSatScore0to10Avg; + } + + public void setDemLifeSatScore0to10P50(double demLifeSatScore0to10P50) { + this.demLifeSatScore0to10P50 = demLifeSatScore0to10P50; + } + + public void setDemLifeSatScore0to10P10(double demLifeSatScore0to10P10) { + this.demLifeSatScore0to10P10 = demLifeSatScore0to10P10; + } + + public void setDemLifeSatScore0to10P90(double demLifeSatScore0to10P90) { + this.demLifeSatScore0to10P90 = demLifeSatScore0to10P90; + } + + public void setDemLifeSatScore0to10P25(double demLifeSatScore0to10P25) { + this.demLifeSatScore0to10P25 = demLifeSatScore0to10P25; + } + + public void setDemLifeSatScore0to10P75(double demLifeSatScore0to10P75) { + this.demLifeSatScore0to10P75 = demLifeSatScore0to10P75; + } + + public void setN(int n) { + healthNObsSubGroup = n; + } + + public void setQalys(double healthLifeYearQualAdj) { + this.healthLifeYearQualAdj = healthLifeYearQualAdj; + } + + public void setWellbys(double healthLifeYearWbAdj) { + this.healthLifeYearWbAdj = healthLifeYearWbAdj; + } + + public void update(SimPathsModel model, String gender_s) { + + + AgeGenderCSfilter ageGenderCSfilter; + + if (gender_s.equals("Total")) { + ageGenderCSfilter = new AgeGenderCSfilter(25, 64); + } else { + ageGenderCSfilter = new AgeGenderCSfilter(25, 64, Gender.valueOf(gender_s)); + } + + // set gender, and key this record so the three gender groups stay distinct + setGender(gender_s); + key = new PanelEntityKey(genderKeyId(gender_s)); + + // dhm score + CrossSection.Double personsDhm = new CrossSection.Double(model.getPersons(), Person.DoublesVariables.Dhm); // Get cross section of simulated individuals and their mental health using the IDoubleSource interface implemented by Person class. + personsDhm.setFilter(ageGenderCSfilter); + + + MeanArrayFunction dhm_mean_f = new MeanArrayFunction(personsDhm); // Create MeanArrayFunction + dhm_mean_f.applyFunction(); + setHealthWbScore0to36Avg(dhm_mean_f.getDoubleValue(IDoubleSource.Variables.Default)); + + PercentileArrayFunction percDhm_f = new PercentileArrayFunction(personsDhm); + percDhm_f.applyFunction(); + + setHealthWbScore0to36P10(percDhm_f.getDoubleValue(PercentileArrayFunction.Variables.P10)); + setHealthWbScore0to36P25(percDhm_f.getDoubleValue(PercentileArrayFunction.Variables.P25)); + setHealthWbScore0to36P50(percDhm_f.getDoubleValue(PercentileArrayFunction.Variables.P50)); + setHealthWbScore0to36P75(percDhm_f.getDoubleValue(PercentileArrayFunction.Variables.P75)); + setHealthWbScore0to36P90(percDhm_f.getDoubleValue(PercentileArrayFunction.Variables.P90)); + + // mcs score + CrossSection.Double personsMCS = new CrossSection.Double(model.getPersons(), Person.DoublesVariables.Dhe_mcs); + personsMCS.setFilter(ageGenderCSfilter); + + + MeanArrayFunction dhe_mcs_mean_f = new MeanArrayFunction(personsMCS); // Create MeanArrayFunction + dhe_mcs_mean_f.applyFunction(); + setHealthMentalMcsAvg(dhe_mcs_mean_f.getDoubleValue(IDoubleSource.Variables.Default)); + + PercentileArrayFunction perc_dhe_mcs_f = new PercentileArrayFunction(personsMCS); + perc_dhe_mcs_f.applyFunction(); + + setHealthMentalMcsP10(perc_dhe_mcs_f.getDoubleValue(PercentileArrayFunction.Variables.P10)); + setHealthMentalMcsP25(perc_dhe_mcs_f.getDoubleValue(PercentileArrayFunction.Variables.P25)); + setHealthMentalMcsP50(perc_dhe_mcs_f.getDoubleValue(PercentileArrayFunction.Variables.P50)); + setHealthMentalMcsP75(perc_dhe_mcs_f.getDoubleValue(PercentileArrayFunction.Variables.P75)); + setHealthMentalMcsP90(perc_dhe_mcs_f.getDoubleValue(PercentileArrayFunction.Variables.P90)); + + // pcs score + CrossSection.Double personsPCS = new CrossSection.Double(model.getPersons(), Person.DoublesVariables.Dhe_pcs); + personsPCS.setFilter(ageGenderCSfilter); + + + MeanArrayFunction dhe_pcs_mean_f = new MeanArrayFunction(personsPCS); // Create MeanArrayFunction + dhe_pcs_mean_f.applyFunction(); + setHealthPhysicalPcsAvg(dhe_pcs_mean_f.getDoubleValue(IDoubleSource.Variables.Default)); + + PercentileArrayFunction perc_dhe_pcs_f = new PercentileArrayFunction(personsPCS); + perc_dhe_pcs_f.applyFunction(); + + setHealthPhysicalPcsP10(perc_dhe_pcs_f.getDoubleValue(PercentileArrayFunction.Variables.P10)); + setHealthPhysicalPcsP25(perc_dhe_pcs_f.getDoubleValue(PercentileArrayFunction.Variables.P25)); + setHealthPhysicalPcsP50(perc_dhe_pcs_f.getDoubleValue(PercentileArrayFunction.Variables.P50)); + setHealthPhysicalPcsP75(perc_dhe_pcs_f.getDoubleValue(PercentileArrayFunction.Variables.P75)); + setHealthPhysicalPcsP90(perc_dhe_pcs_f.getDoubleValue(PercentileArrayFunction.Variables.P90)); + + // Life Satisfaction score + CrossSection.Double personsDls = new CrossSection.Double(model.getPersons(), Person.DoublesVariables.Dls); + personsDls.setFilter(ageGenderCSfilter); + + + MeanArrayFunction dls_mean_f = new MeanArrayFunction(personsDls); // Create MeanArrayFunction + dls_mean_f.applyFunction(); + setDemLifeSatScore0to10Avg(dls_mean_f.getDoubleValue(IDoubleSource.Variables.Default)); + + PercentileArrayFunction perc_dls_f = new PercentileArrayFunction(personsDls); + perc_dls_f.applyFunction(); + + setDemLifeSatScore0to10P10(perc_dls_f.getDoubleValue(PercentileArrayFunction.Variables.P10)); + setDemLifeSatScore0to10P25(perc_dls_f.getDoubleValue(PercentileArrayFunction.Variables.P25)); + setDemLifeSatScore0to10P50(perc_dls_f.getDoubleValue(PercentileArrayFunction.Variables.P50)); + setDemLifeSatScore0to10P75(perc_dls_f.getDoubleValue(PercentileArrayFunction.Variables.P75)); + setDemLifeSatScore0to10P90(perc_dls_f.getDoubleValue(PercentileArrayFunction.Variables.P90)); + + // QALYS as sum of EQ5D + CrossSection.Double personEQ5D = new CrossSection.Double(model.getPersons(), Person.DoublesVariables.He_eq5d); + personEQ5D.setFilter(ageGenderCSfilter); + + SumArrayFunction.Double qalys = new SumArrayFunction.Double(personEQ5D); + qalys.applyFunction(); + setQalys(qalys.getDoubleValue(IDoubleSource.Variables.Default)); + + // WELLBYs as sum of 'points' in 0-10-scale life satisfaction (adjusted) + + SumArrayFunction.Double wellbys = new SumArrayFunction.Double(personsDls); + wellbys.applyFunction(); + + + setWellbys(wellbys.getDoubleValue(IDoubleSource.Variables.Default)); + + // count + CrossSection.Integer n_persons = new CrossSection.Integer(model.getPersons(), Person.class, "getPersonCount", true); + n_persons.setFilter(ageGenderCSfilter); + + SumArrayFunction.Integer count_f = new SumArrayFunction.Integer(n_persons); + count_f.applyFunction(); + setN(count_f.getIntValue(IDoubleSource.Variables.Default)); + } +} diff --git a/src/main/java/simpaths/experiment/OutputReadme.java b/src/main/java/simpaths/experiment/OutputReadme.java new file mode 100644 index 000000000..56abd28e6 --- /dev/null +++ b/src/main/java/simpaths/experiment/OutputReadme.java @@ -0,0 +1,235 @@ +// define package +package simpaths.experiment; + +// import Java packages +import java.io.File; +import java.io.IOException; +import java.io.PrintWriter; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import microsim.data.ExportCSV; +import microsim.engine.SimulationEngine; +import simpaths.data.Parameters; +import simpaths.model.SimPathsModel; + +/** + * + * WRITES A README ALONGSIDE THE CSV OUTPUT OF A SIMULATION RUN + * + * The README records the configuration the run was executed under - population size, + * simulated years, alignment switches, whether regression coefficients were bootstrapped - + * together with a description of each CSV file written beside it. + * + * Output folders outlive the configuration that produced them, so a run whose settings are + * not recorded next to its results cannot be interpreted with confidence later on. + * + */ +public class OutputReadme { + + private static final Logger log = LogManager.getLogger(OutputReadme.class); + + private static final DateTimeFormatter TIMESTAMP = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + + private OutputReadme() {} + + /** + * + * WRITE README.md INTO THE CSV OUTPUT DIRECTORY + * + * Failure to write the README must never interrupt a simulation, so all errors are + * logged rather than propagated. + * + * @param collector the collector holding the output toggles for this run + * @param model the simulation manager holding the run configuration + * + */ + public static void write(SimPathsCollector collector, SimPathsModel model) { + + Path directory = csvDirectory(); + if (directory != null) + write(collector, model, directory); + } + + /** + * + * WRITE README.md INTO A GIVEN DIRECTORY + * @param collector the collector holding the output toggles for this run + * @param model the simulation manager holding the run configuration + * @param directory the directory to write into, created if it does not exist + * + */ + static void write(SimPathsCollector collector, SimPathsModel model, Path directory) { + + try { + Files.createDirectories(directory); + + try (PrintWriter out = new PrintWriter(Files.newBufferedWriter(directory.resolve("README.md"), + StandardCharsets.UTF_8))) { + writeHeader(out, model); + writeRunConfiguration(out, model); + writeModelOptions(out, model); + writeFileDescriptions(out, collector); + writeConventions(out); + } + } catch (IOException | RuntimeException e) { + log.warn("Could not write output README: " + e.getMessage()); + } + } + + private static Path csvDirectory() { + + // ExportCSV.directory is the directory the CSV files themselves are written to, set + // per experiment by ExperimentManager.setupExperiment(). Reading it here keeps the + // README beside the data rather than beside a path we resolved the same way twice. + if (ExportCSV.directory != null && !ExportCSV.directory.isBlank()) + return new File(ExportCSV.directory).toPath(); + + try { + String outputFolder = SimulationEngine.getInstance().getCurrentExperiment().getOutputFolder(); + if (outputFolder == null) + return null; + return new File(outputFolder, "csv").toPath(); + } catch (RuntimeException e) { + log.warn("Could not resolve the output folder for the README: " + e.getMessage()); + return null; + } + } + + private static void writeHeader(PrintWriter out, SimPathsModel model) { + + out.println("# SimPaths simulation output"); + out.println(); + out.println("Country: **" + model.getCountry() + "** "); + out.println("Written: " + LocalDateTime.now().format(TIMESTAMP)); + out.println(); + out.println("This folder holds the CSV output of a simulation experiment. The settings below"); + out.println("are those it was executed under; they are recorded here because output folders"); + out.println("are kept long after the configuration that produced them has moved on."); + out.println(); + } + + private static void writeRunConfiguration(PrintWriter out, SimPathsModel model) { + + String runsPlanned = SimPathsMultiRun.isMultiRunMode() + ? String.valueOf(SimPathsMultiRun.getMaxNumberOfRuns()) + : "1 (single run)"; + + out.println("## Run configuration"); + out.println(); + out.println("| Setting | Value |"); + out.println("|---|---|"); + out.println("| Runs in this experiment | " + runsPlanned + " |"); + out.println("| Population size | " + model.getPopSize() + " |"); + out.println("| Start year | " + model.getStartYear() + " |"); + out.println("| End year | " + model.getEndYear() + " |"); + out.println("| Random seed | " + model.getRandomSeedIfFixed() + " |"); + out.println("| Base price year | " + Parameters.BASE_PRICE_YEAR + " |"); + out.println(); + } + + private static void writeModelOptions(PrintWriter out, SimPathsModel model) { + + out.println("## Model options"); + out.println(); + out.println("| Option | State |"); + out.println("|---|---|"); + out.println("| Bootstrap all regression coefficients | " + onOff(Parameters.bootstrapAll) + " |"); + out.println("| Intertemporal optimisations | " + onOff(model.isEnableIntertemporalOptimisations()) + " |"); + out.println("| Project mortality | " + onOff(model.getProjectMortality()) + " |"); + out.println("| Alignment: population | " + onOff(model.isAlignPopulation()) + " |"); + out.println("| Alignment: fertility | " + onOff(model.isAlignFertility()) + " |"); + out.println("| Alignment: cohabitation | " + onOff(model.isAlignCohabitation()) + " |"); + out.println("| Alignment: in school | " + onOff(model.isAlignInSchool()) + " |"); + out.println("| Alignment: employment | " + onOff(model.isAlignEmployment()) + " |"); + out.println(); + out.println("Diagnostics for the alignment routines that ran are in `AlignmentStatistics.csv`,"); + out.println("which reports the adjustment factor, the simulated share and the target share each year."); + out.println(); + } + + private static void writeFileDescriptions(PrintWriter out, SimPathsCollector collector) { + + out.println("## Files in this folder"); + out.println(); + out.println("Age bands used by the annual statistics are 18-29, 30-54 and 55-74."); + out.println(); + + describe(out, collector.isPersistWealthIncomeStatistics(), "WealthIncomeStatistics.csv", "one row per year", + "Income and wealth. Gini coefficients for market and equivalised disposable income, " + + "income percentiles, median equivalised disposable income and the S-Index, plus " + + "labour, investment and pension income, investment losses, disposable income gross " + + "of losses, and wealth by age band."); + + describe(out, collector.isPersistDemographicStatistics(), "DemographicStatistics.csv", "one row per year", + "Demographics by age band: share cohabiting, average dependent children, and population " + + "counts. The population counts are the denominator for the age-band statistics " + + "reported in the other files."); + + describe(out, collector.isPersistHealthStatistics(), "HealthStatistics.csv", "one row per year", + "Population health by age band: average self-rated health and the share reporting a " + + "long-term disability."); + + describe(out, collector.isPersistLabourStatistics(), "LabourStatistics.csv", "one row per year", + "Labour market outcomes. Employment and unemployment shares for ages 16-64 and the " + + "transition rates between them, plus full-time and part-time shares by age band."); + + describe(out, collector.isPersistAlignmentStatistics(), "AlignmentStatistics.csv", "one row per year", + "Alignment diagnostics: adjustment factors together with the simulated and target shares " + + "for each aligned process."); + + describe(out, collector.isPersistWellbeingByGender(), "WellbeingByGender.csv", "three rows per year", + "Wellbeing and health-related quality of life for ages 25-64: GHQ-12, SF-12 mental and " + + "physical component scores, life satisfaction, QALYs and WELLBYs. Written once per " + + "gender group each year - Total, Male and Female - identified by the `demSex` column."); + + describe(out, collector.isPersistPersons(), "Person.csv", "one row per person per year", + "Individual-level microdata for the whole simulated population."); + + describe(out, collector.isPersistBenefitUnits(), "BenefitUnit.csv", "one row per benefit unit per year", + "Benefit-unit-level microdata, the unit at which taxes and benefits are assessed."); + + describe(out, collector.isPersistHouseholds(), "Household.csv", "one row per household per year", + "Household-level microdata."); + + out.println(); + } + + private static void describe(PrintWriter out, boolean enabled, String fileName, String shape, String contents) { + + if (!enabled) + return; + out.println("### `" + fileName + "`"); + out.println(); + out.println("*" + shape + "*"); + out.println(); + out.println(contents); + out.println(); + } + + private static void writeConventions(PrintWriter out) { + + out.println("## Reading the files"); + out.println(); + out.println("- Every file opens with `run`, `time` and an `id_` column. `run` identifies the"); + out.println(" simulation run - where several runs share an output folder they all appear in the same"); + out.println(" file - `time` is the simulated year, and the id column is a constant for the annual"); + out.println(" statistics."); + out.println("- Remaining columns are ordered alphabetically by variable name, not by topic."); + out.println("- Financial variables are in real prices of the base price year given above,"); + out.println(" and are monthly and equivalised unless the variable name says otherwise."); + out.println("- Variables carrying `WeeklyPerWorker` are weekly, averaged over workers rather than"); + out.println(" over the population, and are not equivalised."); + out.println(); + } + + private static String onOff(boolean flag) { + return flag ? "on" : "off"; + } +} diff --git a/src/main/java/simpaths/experiment/SimPathsCollector.java b/src/main/java/simpaths/experiment/SimPathsCollector.java index e1e5f2707..ce4348bbd 100644 --- a/src/main/java/simpaths/experiment/SimPathsCollector.java +++ b/src/main/java/simpaths/experiment/SimPathsCollector.java @@ -5,11 +5,14 @@ import java.util.ArrayList; import java.util.Comparator; import java.util.LinkedHashMap; +import java.util.List; import java.util.Map; import simpaths.data.filters.FlexibleInLabourSupplyFilter; -import simpaths.data.statistics.EmploymentStatistics; +import simpaths.data.statistics.LabourStatistics; +import simpaths.data.statistics.AgeBandAggregates; import simpaths.data.statistics.HealthStatistics; +import simpaths.data.statistics.WellbeingByGender; import simpaths.model.BenefitUnit; import simpaths.model.SimPathsModel; import simpaths.model.enums.Quintiles; @@ -32,9 +35,9 @@ import microsim.statistics.IDoubleSource; // import LABOURsim packages import simpaths.data.Parameters; -import simpaths.data.statistics.AlignmentAdjustmentFactors; -import simpaths.data.statistics.Statistics; -import simpaths.data.statistics.Statistics2; +import simpaths.data.statistics.AlignmentStatistics; +import simpaths.data.statistics.WealthIncomeStatistics; +import simpaths.data.statistics.DemographicStatistics; import simpaths.model.Person; import simpaths.model.enums.Region; @@ -55,16 +58,19 @@ public class SimPathsCollector extends AbstractSimulationCollectorManager implem private boolean calculateGiniCoefficients = false; @GUIparameter(description="Calculate extended set of population characteristics (useful for validation)") - private boolean persistStatistics2 = true; + private boolean persistDemographicStatistics = true; - @GUIparameter(description="Report alignment adjustment factors (AlignmentAdjustmentFactors1.csv)") - private boolean persistAlignmentAdjustmentFactors = true; + @GUIparameter(description="Report alignment adjustment factors (AlignmentStatistics.csv)") + private boolean persistAlignmentStatistics = true; - private boolean persistEmploymentStatistics = true; + private boolean persistLabourStatistics = true; - @GUIparameter(description="Report health statistics") + @GUIparameter(description="Report population health statistics by age band (HealthStatistics.csv)") private boolean persistHealthStatistics = true; + @GUIparameter(description="Report wellbeing statistics by gender (WellbeingByGender.csv)") + private boolean persistWellbeingByGender = true; + @GUIparameter(description="Toggle to turn database persistence on/off") private boolean exportToDatabase = false; @@ -72,7 +78,7 @@ public class SimPathsCollector extends AbstractSimulationCollectorManager implem private boolean exportToCSV = true; @GUIparameter(description="Toggle to turn persistence of statistics on/off") - private boolean persistStatistics = true; + private boolean persistWealthIncomeStatistics = true; @GUIparameter(description="Toggle to turn persistence of persons on/off") private boolean persistPersons = true; @@ -93,15 +99,21 @@ public class SimPathsCollector extends AbstractSimulationCollectorManager implem private SimPathsModel model; - private Statistics stats; + private WealthIncomeStatistics wealthIncomeStats; + + private DemographicStatistics demographicStats; + + private AlignmentStatistics alignmentStats; + + private LabourStatistics labourStats; - private Statistics2 stats2; + private HealthStatistics healthStats; - private AlignmentAdjustmentFactors alignmentAdjustmentFactors; + private WellbeingByGender wellbeingByGender; - private EmploymentStatistics statsEmployment; + private AgeBandAggregates ageBandAggregates; - private HealthStatistics statsHealth; + private double ageBandAggregatesTime = Double.NaN; private GiniPersonalGrossEarnings giniPersonalGrossEarnings; @@ -119,16 +131,18 @@ public class SimPathsCollector extends AbstractSimulationCollectorManager implem private DataExport exportHouseholds; - private DataExport exportStatistics; + private DataExport exportWealthIncomeStatistics; - private DataExport exportStatistics2; + private DataExport exportDemographicStatistics; - private DataExport exportAlignmentAdjustmentFactors; + private DataExport exportAlignmentStatistics; - private DataExport exportStatisticsEmployment; + private DataExport exportLabourStatistics; private DataExport exportHealthStatistics; + private DataExport exportWellbeingByGender; + protected MultiTraceFunction.Double fGiniPersonalGrossEarningsNational; protected Map fGiniPersonalGrossEarningsRegionalMap; @@ -160,11 +174,12 @@ public enum Processes { DumpPersons, DumpBenefitUnits, DumpHouseholds, - DumpStatistics, - DumpStatistics2, - DumpAlignmentAdjustmentFactors, - DumpStatisticsEmployment, - DumpHealthStatistics + DumpWealthIncomeStatistics, + DumpDemographicStatistics, + DumpAlignmentStatistics, + DumpLabourStatistics, + DumpHealthStatistics, + DumpWellbeingByGender } @@ -208,43 +223,52 @@ public void onEvent(Enum type) { log.error(e.getMessage()); } break; - case DumpStatistics: + case DumpWealthIncomeStatistics: + wealthIncomeStats.update(ageBands()); try { - exportStatistics.export(); + exportWealthIncomeStatistics.export(); } catch (Exception e) { log.error(e.getMessage()); } break; - case DumpStatistics2: - stats2.update(model); + case DumpDemographicStatistics: + demographicStats.update(ageBands()); try { - exportStatistics2.export(); + exportDemographicStatistics.export(); } catch (Exception e) { log.error(e.getMessage()); } break; - case DumpAlignmentAdjustmentFactors: - alignmentAdjustmentFactors.update(model); + case DumpAlignmentStatistics: + alignmentStats.update(model); try { - exportAlignmentAdjustmentFactors.export(); + exportAlignmentStatistics.export(); } catch (Exception e) { log.error(e.getMessage()); } break; - case DumpStatisticsEmployment: - statsEmployment.update(model); + case DumpLabourStatistics: + labourStats.update(model, ageBands()); try { - exportStatisticsEmployment.export(); + exportLabourStatistics.export(); } catch (Exception e) { log.error(e.getMessage()); } break; case DumpHealthStatistics: + healthStats.update(ageBands()); + try { + exportHealthStatistics.export(); + } catch (Exception e) { + log.error(e.getMessage()); + } + break; + case DumpWellbeingByGender: String[] genders = {"Total", "Male", "Female"}; for (String gender_s: genders) { - statsHealth.update(model, gender_s); + wellbeingByGender.update(model, gender_s); try { - exportHealthStatistics.export(); + exportWellbeingByGender.export(); } catch (Exception e) { log.error(e.getMessage()); } @@ -263,11 +287,12 @@ public void buildObjects() { model = (SimPathsModel) getManager(); - stats = new Statistics(); - stats2 = new Statistics2(); - alignmentAdjustmentFactors = new AlignmentAdjustmentFactors(); - statsEmployment = new EmploymentStatistics(); - statsHealth = new HealthStatistics(); + wealthIncomeStats = new WealthIncomeStatistics(); + demographicStats = new DemographicStatistics(); + alignmentStats = new AlignmentStatistics(); + labourStats = new LabourStatistics(); + healthStats = new HealthStatistics(); + wellbeingByGender = new WellbeingByGender(); //For export to database or .csv files. if(persistPersons) @@ -276,18 +301,23 @@ public void buildObjects() { exportBenefitUnits = new DataExport(model.getBenefitUnits(), exportToDatabase, exportToCSV); if (persistHouseholds) exportHouseholds = new DataExport(model.getHouseholds(), exportToDatabase, exportToCSV); - if (persistStatistics) - exportStatistics = new DataExport(stats, exportToDatabase, exportToCSV); - if (persistStatistics2) - exportStatistics2 = new DataExport(stats2, exportToDatabase, exportToCSV); - if (persistAlignmentAdjustmentFactors) - exportAlignmentAdjustmentFactors = new DataExport(alignmentAdjustmentFactors, exportToDatabase, exportToCSV); - if (persistEmploymentStatistics) - exportStatisticsEmployment = new DataExport(statsEmployment, exportToDatabase, exportToCSV); + if (persistWealthIncomeStatistics) + exportWealthIncomeStatistics = new DataExport(List.of(wealthIncomeStats), exportToDatabase, exportToCSV); + if (persistDemographicStatistics) + exportDemographicStatistics = new DataExport(List.of(demographicStats), exportToDatabase, exportToCSV); + if (persistAlignmentStatistics) + exportAlignmentStatistics = new DataExport(List.of(alignmentStats), exportToDatabase, exportToCSV); + if (persistLabourStatistics) + exportLabourStatistics = new DataExport(List.of(labourStats), exportToDatabase, exportToCSV); if (persistHealthStatistics) - exportHealthStatistics = new DataExport(statsHealth, exportToDatabase, exportToCSV); + exportHealthStatistics = new DataExport(List.of(healthStats), exportToDatabase, exportToCSV); + if (persistWellbeingByGender) + exportWellbeingByGender = new DataExport(List.of(wellbeingByGender), exportToDatabase, exportToCSV); + if (exportToCSV) + OutputReadme.write(this, model); + if (calculateGiniCoefficients) { giniPersonalGrossEarnings = new GiniPersonalGrossEarnings(); @@ -314,6 +344,27 @@ public void buildObjects() { } + /** + * + * EVALUATE THE AGE-BAND POPULATION AGGREGATES SHARED BY THE ANNUAL STATISTICS OUTPUTS + * + * WealthIncomeStatistics, DemographicStatistics, LabourStatistics and HealthStatistics all report + * subsets of the same aggregates, and each is toggled independently. Caching on the + * simulated time keeps the population traversal to once per year whichever + * combination of those outputs is enabled, without imposing an order on their events. + * + */ + private AgeBandAggregates ageBands() { + + double time = SimulationEngine.getInstance().getTime(); + if (ageBandAggregates == null || ageBandAggregatesTime != time) { + ageBandAggregates = AgeBandAggregates.compute(model); + ageBandAggregatesTime = time; + } + return ageBandAggregates; + } + + @Override public void buildSchedule() { @@ -330,27 +381,31 @@ public void buildSchedule() { getEngine().getEventQueue().scheduleRepeat(new SingleTargetEvent(this, Processes.CalculateGiniCoefficients), model.getStartYear() + dataDumpStartTime, ordering, dataDumpTimePeriod); } - if (persistStatistics) { - getEngine().getEventQueue().scheduleRepeat(new SingleTargetEvent(this, Processes.DumpStatistics), model.getStartYear() + dataDumpStartTime, ordering, dataDumpTimePeriod); -// getEngine().getEventQueue().scheduleOnce(new SingleTargetEvent(this, Processes.DumpStatistics), model.getEndYear(), -2); //Ensures the database is persisted on the last time-step + if (persistWealthIncomeStatistics) { + getEngine().getEventQueue().scheduleRepeat(new SingleTargetEvent(this, Processes.DumpWealthIncomeStatistics), model.getStartYear() + dataDumpStartTime, ordering, dataDumpTimePeriod); +// getEngine().getEventQueue().scheduleOnce(new SingleTargetEvent(this, Processes.DumpWealthIncomeStatistics), model.getEndYear(), -2); //Ensures the database is persisted on the last time-step } - if (persistStatistics2) { - getEngine().getEventQueue().scheduleRepeat(new SingleTargetEvent(this, Processes.DumpStatistics2), model.getStartYear() + dataDumpStartTime, ordering, dataDumpTimePeriod); + if (persistDemographicStatistics) { + getEngine().getEventQueue().scheduleRepeat(new SingleTargetEvent(this, Processes.DumpDemographicStatistics), model.getStartYear() + dataDumpStartTime, ordering, dataDumpTimePeriod); } - if (persistAlignmentAdjustmentFactors) { - getEngine().getEventQueue().scheduleRepeat(new SingleTargetEvent(this, Processes.DumpAlignmentAdjustmentFactors), model.getStartYear() + dataDumpStartTime, ordering, dataDumpTimePeriod); + if (persistAlignmentStatistics) { + getEngine().getEventQueue().scheduleRepeat(new SingleTargetEvent(this, Processes.DumpAlignmentStatistics), model.getStartYear() + dataDumpStartTime, ordering, dataDumpTimePeriod); } - if (persistEmploymentStatistics) { - getEngine().getEventQueue().scheduleRepeat(new SingleTargetEvent(this, Processes.DumpStatisticsEmployment), model.getStartYear() + dataDumpStartTime, ordering, dataDumpTimePeriod); + if (persistLabourStatistics) { + getEngine().getEventQueue().scheduleRepeat(new SingleTargetEvent(this, Processes.DumpLabourStatistics), model.getStartYear() + dataDumpStartTime, ordering, dataDumpTimePeriod); } if (persistHealthStatistics){ getEngine().getEventQueue().scheduleRepeat(new SingleTargetEvent(this, Processes.DumpHealthStatistics), model.getStartYear() + dataDumpStartTime, ordering, dataDumpTimePeriod); } + if (persistWellbeingByGender){ + getEngine().getEventQueue().scheduleRepeat(new SingleTargetEvent(this, Processes.DumpWellbeingByGender), model.getStartYear() + dataDumpStartTime, ordering, dataDumpTimePeriod); + } + if (persistPersons) { getEngine().getEventQueue().scheduleRepeat(new SingleTargetEvent(this, Processes.DumpPersons), model.getStartYear() + dataDumpStartTime, ordering, dataDumpTimePeriod); } @@ -382,20 +437,20 @@ public void update() { percentileFunctionGrossLabourIncomes = new PercentileArrayFunction(personsGrossLabourIncomesCS); percentileFunctionGrossLabourIncomes.updateSource(); - stats.setYLabP20(percentileFunctionGrossLabourIncomes.getDoubleValue(PercentileArrayFunction.Variables.P20)); - stats.setYLabP40(percentileFunctionGrossLabourIncomes.getDoubleValue(PercentileArrayFunction.Variables.P40)); - stats.setYLabP60(percentileFunctionGrossLabourIncomes.getDoubleValue(PercentileArrayFunction.Variables.P60)); - stats.setYLabP80(percentileFunctionGrossLabourIncomes.getDoubleValue(PercentileArrayFunction.Variables.P80)); + wealthIncomeStats.setYLabP20(percentileFunctionGrossLabourIncomes.getDoubleValue(PercentileArrayFunction.Variables.P20)); + wealthIncomeStats.setYLabP40(percentileFunctionGrossLabourIncomes.getDoubleValue(PercentileArrayFunction.Variables.P40)); + wealthIncomeStats.setYLabP60(percentileFunctionGrossLabourIncomes.getDoubleValue(PercentileArrayFunction.Variables.P60)); + wealthIncomeStats.setYLabP80(percentileFunctionGrossLabourIncomes.getDoubleValue(PercentileArrayFunction.Variables.P80)); for (Person person : model.getPersons()) { double covidModuleGrossLabourIncomeBaseline = person.getCovidYLabGross(); - if (covidModuleGrossLabourIncomeBaseline <= stats.getYLabP20()) { + if (covidModuleGrossLabourIncomeBaseline <= wealthIncomeStats.getYLabP20()) { person.setCovidYLabGrossXt5(Quintiles.Q1); - } else if (covidModuleGrossLabourIncomeBaseline <= stats.getYLabP40()) { + } else if (covidModuleGrossLabourIncomeBaseline <= wealthIncomeStats.getYLabP40()) { person.setCovidYLabGrossXt5(Quintiles.Q2); - } else if (covidModuleGrossLabourIncomeBaseline <= stats.getYLabP60()) { + } else if (covidModuleGrossLabourIncomeBaseline <= wealthIncomeStats.getYLabP60()) { person.setCovidYLabGrossXt5(Quintiles.Q3); - } else if (covidModuleGrossLabourIncomeBaseline <= stats.getYLabP80()) { + } else if (covidModuleGrossLabourIncomeBaseline <= wealthIncomeStats.getYLabP80()) { person.setCovidYLabGrossXt5(Quintiles.Q4); } else { person.setCovidYLabGrossXt5(Quintiles.Q5); @@ -445,10 +500,10 @@ public void update() { // System.out.println("P50 value from the percentile function: " + p50HouseholdsGrossIncome + " P20: " + p20HouseholdsGrossIncome + " P40: " + p40HouseholdsGrossIncome + // " P60: " + p60HouseholdsGrossIncome + " P80: " + p80HouseholdsGrossIncome); - stats.setYHhQuintilesC5P20(p20HouseholdsGrossIncome); - stats.setYHhQuintilesC5P40(p40HouseholdsGrossIncome); - stats.setYHhQuintilesC5P60(p60HouseholdsGrossIncome); - stats.setYHhQuintilesC5P80(p80HouseholdsGrossIncome); + wealthIncomeStats.setYHhQuintilesC5P20(p20HouseholdsGrossIncome); + wealthIncomeStats.setYHhQuintilesC5P40(p40HouseholdsGrossIncome); + wealthIncomeStats.setYHhQuintilesC5P60(p60HouseholdsGrossIncome); + wealthIncomeStats.setYHhQuintilesC5P80(p80HouseholdsGrossIncome); if (initialDistributionCalculated) { for (BenefitUnit benefitUnit : model.getBenefitUnits()) { @@ -479,7 +534,7 @@ public void update() { percentileFunctionHouseholdsEDI = new PercentileArrayFunction(householdsEDICS); percentileFunctionHouseholdsEDI.updateSource(); p50HouseholdsEDI = percentileFunctionHouseholdsEDI.getDoubleValue(PercentileArrayFunction.Variables.P50); - stats.setEdi_p50(p50HouseholdsEDI); + wealthIncomeStats.setEdi_p50(p50HouseholdsEDI); // System.out.println("Median EDI (collector) "+p50HouseholdsEDI); } @@ -572,7 +627,7 @@ public void update() { log.info("giniWeightedPersonalGrossEarningsRegionalMap for " + region + " = " + giniWeightedPersonalGrossEarningsRegionalMap.get(region) + ", weightedAbsDiffEquivalisedIncomeRegional.get(region) = " + weightedAbsDiffPersonalGrossEarningsRegional.get(region) + ", totalPersonWeightForRegion = " + totalPersonWeightForRegion + ", totalWeightedPersonalGrossEarningsForRegion = " + totalWeightedPersonalGrossEarningsForRegion); } giniWeightedPersonalGrossEarningsNational = weightedAbsDiffPersonalGrossEarningsNational / (2. * totalPersonWeightNational * totalWeightedPersonalGrossEarningsNational); - stats.setGiniPersonalGrossEarningsNational(giniWeightedPersonalGrossEarningsNational); + wealthIncomeStats.setGiniPersonalGrossEarningsNational(giniWeightedPersonalGrossEarningsNational); log.info("giniWeightedPersonalGrossEarningsNational = " + giniWeightedPersonalGrossEarningsNational + ", weightedAbsDiffPersonalGrossEarningsNational = " + weightedAbsDiffPersonalGrossEarningsNational + ", totalPersonWeightNational = " + totalPersonWeightNational + ", totalWeightedPersonalGrossEarningsNational = " + totalWeightedPersonalGrossEarningsNational); } @@ -675,7 +730,7 @@ public void update() { log.info("giniHouseholdDisposableIncomeRegional for " + region + " = " + giniWeightedEquivalisedHouseholdDisposableIncomeRegionalMap.get(region) + ", weightedAbsDiffEquivalisedIncomeRegional.get(region) = " + weightedAbsDiffEquivalisedIncomeRegional.get(region) + ", totalHouseholdWeightForRegion = " + totalHouseholdWeightForRegion + ", totalWeightedEquivalisedHouseholdIncomeForRegion = " + totalWeightedEquivalisedHouseholdIncomeForRegion); } giniWeightedEquivalisedHouseholdDisposableIncomeNational = weightedAbsDiffEquivalisedIncomeNational / (2. * totalHouseholdWeightNational * totalWeightedEquivalisedHouseholdIncomeNational); - stats.setGiniEquivalisedHouseholdDisposableIncomeNational(giniWeightedEquivalisedHouseholdDisposableIncomeNational); + wealthIncomeStats.setGiniEquivalisedHouseholdDisposableIncomeNational(giniWeightedEquivalisedHouseholdDisposableIncomeNational); log.info("giniWeightedEquivalisedHouseholdDisposableIncomeNational = " + giniWeightedEquivalisedHouseholdDisposableIncomeNational + ", weightedAbsDiffEquivalisedIncomeNational = " + weightedAbsDiffEquivalisedIncomeNational + ", totalHouseholdWeightNational = " + totalHouseholdWeightNational + ", totalWeightedEquivalisedHouseholdIncomeNational = " + totalWeightedEquivalisedHouseholdIncomeNational); } @@ -746,8 +801,8 @@ public int compare(Pair pair1, Pair pa double atRiskOfPovertyThreshold = median * 0.6; // log.info("atRiskOfPovertyThreshold = " + atRiskOfPovertyThreshold); - stats.setMedianEquivalisedHouseholdDisposableIncome(median); //Save median household equivalised disposable income in statistics object -// stats.setRiskOfPovertyThreshold(atRiskOfPovertyThreshold); //Risk-of-poverty threshold is set at 60% of the national median equivalised household disposable income. + wealthIncomeStats.setMedianEquivalisedHouseholdDisposableIncome(median); //Save median household equivalised disposable income in statistics object +// wealthIncomeStats.setRiskOfPovertyThreshold(atRiskOfPovertyThreshold); //Risk-of-poverty threshold is set at 60% of the national median equivalised household disposable income. // System.out.println("Median EDI " + median + " Poverty threshold " + atRiskOfPovertyThreshold); //For use in charts @@ -819,17 +874,17 @@ public void setDataDumpTimePeriod(Double dataDumpTimePeriod) { this.dataDumpTimePeriod = dataDumpTimePeriod; } - public Statistics getStats() { - return stats; + public WealthIncomeStatistics getWealthIncomeStats() { + return wealthIncomeStats; } - public void setStats(Statistics stats) { - this.stats = stats; + public void setWealthIncomeStats(WealthIncomeStatistics wealthIncomeStats) { + this.wealthIncomeStats = wealthIncomeStats; } - public Statistics2 getStats2() { return stats2; } + public DemographicStatistics getDemographicStats() { return demographicStats; } - public void setStats2(Statistics2 stats2) { this.stats2 = stats2; } + public void setDemographicStats(DemographicStatistics demographicStats) { this.demographicStats = demographicStats; } public boolean isExportToDatabase() { return exportToDatabase; @@ -847,12 +902,12 @@ public void setExportToCSV(boolean exportToCSV) { this.exportToCSV = exportToCSV; } - public boolean isPersistStatistics() { - return persistStatistics; + public boolean isPersistWealthIncomeStatistics() { + return persistWealthIncomeStatistics; } - public void setPersistStatistics(boolean persistStatistics) { - this.persistStatistics = persistStatistics; + public void setPersistWealthIncomeStatistics(boolean persistWealthIncomeStatistics) { + this.persistWealthIncomeStatistics = persistWealthIncomeStatistics; } public boolean isCalculateGiniCoefficients() { @@ -863,26 +918,34 @@ public void setCalculateGiniCoefficients(boolean calculateGiniCoefficients) { this.calculateGiniCoefficients = calculateGiniCoefficients; } - public boolean isPersistStatistics2() { - return persistStatistics2; + public boolean isPersistDemographicStatistics() { + return persistDemographicStatistics; } - public void setPersistStatistics2(boolean val) { - persistStatistics2 = val; + public void setPersistDemographicStatistics(boolean val) { + persistDemographicStatistics = val; } - public boolean isPersistAlignmentAdjustmentFactors() { - return persistAlignmentAdjustmentFactors; + public boolean isPersistAlignmentStatistics() { + return persistAlignmentStatistics; } - public void setPersistAlignmentAdjustmentFactors(boolean val) { - persistAlignmentAdjustmentFactors = val; + public void setPersistAlignmentStatistics(boolean val) { + persistAlignmentStatistics = val; } public void calculateAtRiskOfPoverty() { calculateEquivalisedHouseholdDisposableIncome(); } + public boolean isPersistLabourStatistics() { + return persistLabourStatistics; + } + + public void setPersistLabourStatistics(boolean persistLabourStatistics) { + this.persistLabourStatistics = persistLabourStatistics; + } + public boolean isPersistHealthStatistics() { return persistHealthStatistics; } @@ -891,4 +954,12 @@ public void setPersistHealthStatistics(boolean persistHealthStatistics) { this.persistHealthStatistics = persistHealthStatistics; } + public boolean isPersistWellbeingByGender() { + return persistWellbeingByGender; + } + + public void setPersistWellbeingByGender(boolean persistWellbeingByGender) { + this.persistWellbeingByGender = persistWellbeingByGender; + } + } diff --git a/src/main/java/simpaths/experiment/SimPathsMultiRun.java b/src/main/java/simpaths/experiment/SimPathsMultiRun.java index 871ede862..5594d02e2 100644 --- a/src/main/java/simpaths/experiment/SimPathsMultiRun.java +++ b/src/main/java/simpaths/experiment/SimPathsMultiRun.java @@ -42,6 +42,7 @@ public class SimPathsMultiRun extends MultiRun { private static int startYear; private static int endYear = 2020; private static int maxNumberOfRuns = 25; + private static boolean multiRunMode = false; private static Long randomSeed = 615L; public static boolean executeWithGui = true; @@ -77,6 +78,8 @@ public class SimPathsMultiRun extends MultiRun { */ public static void main(String[] args) { + multiRunMode = true; + // process Yaml config file if (!parseYamlConfig(args)) { // if parseYamlConfig returns false (indicating bad filename passed), exit main @@ -587,6 +590,14 @@ else if (counter==2) } } + public static int getMaxNumberOfRuns() { + return maxNumberOfRuns; + } + + public static boolean isMultiRunMode() { + return multiRunMode; + } + @Override public boolean nextModel() { counter++; diff --git a/src/main/java/simpaths/model/BenefitUnit.java b/src/main/java/simpaths/model/BenefitUnit.java index f86df3192..92c14b28d 100644 --- a/src/main/java/simpaths/model/BenefitUnit.java +++ b/src/main/java/simpaths/model/BenefitUnit.java @@ -1919,14 +1919,14 @@ protected void calculateBUIncome() { } public void updateIncomeQuintile() { - if (collector.getStats() != null) { - if (getI_yNonBenHhGrossAsinh() <= collector.getStats().getYHhQuintilesC5P20()) { + if (collector.getWealthIncomeStats() != null) { + if (getI_yNonBenHhGrossAsinh() <= collector.getWealthIncomeStats().getYHhQuintilesC5P20()) { yHhQuintilesMonthC5 = Ydses_c5.Q1; - } else if (getI_yNonBenHhGrossAsinh() <= collector.getStats().getYHhQuintilesC5P40()) { + } else if (getI_yNonBenHhGrossAsinh() <= collector.getWealthIncomeStats().getYHhQuintilesC5P40()) { yHhQuintilesMonthC5 = Ydses_c5.Q2; - } else if (getI_yNonBenHhGrossAsinh() <= collector.getStats().getYHhQuintilesC5P60()) { + } else if (getI_yNonBenHhGrossAsinh() <= collector.getWealthIncomeStats().getYHhQuintilesC5P60()) { yHhQuintilesMonthC5 = Ydses_c5.Q3; - } else if (getI_yNonBenHhGrossAsinh() <= collector.getStats().getYHhQuintilesC5P80()) { + } else if (getI_yNonBenHhGrossAsinh() <= collector.getWealthIncomeStats().getYHhQuintilesC5P80()) { yHhQuintilesMonthC5 = Ydses_c5.Q4; } else { yHhQuintilesMonthC5 = Ydses_c5.Q5; diff --git a/src/main/java/simpaths/model/LabourMarket.java b/src/main/java/simpaths/model/LabourMarket.java index 638ad5b73..817c58312 100644 --- a/src/main/java/simpaths/model/LabourMarket.java +++ b/src/main/java/simpaths/model/LabourMarket.java @@ -3,7 +3,7 @@ import java.util.*; import java.util.random.RandomGenerator; -import simpaths.data.statistics.Statistics; +import simpaths.data.statistics.WealthIncomeStatistics; import simpaths.experiment.SimPathsCollector; import simpaths.model.enums.*; @@ -311,14 +311,14 @@ public void updateGrossLabourIncomeBaseline_Xt5(LinkedHashSet personsInB for (Person person : personsInBenefitUnit) { if (person != null && person.getCovidYLabGrossXt5() == null) { double covidModuleGrossLabourIncomeBaseline = person.getCovidYLabGross(); - Statistics stats = ((SimPathsCollector) SimulationEngine.getInstance().getManager(SimPathsCollector.class.getCanonicalName())).getStats(); - if (covidModuleGrossLabourIncomeBaseline <= stats.getYLabP20()) { + WealthIncomeStatistics wealthIncomeStats = ((SimPathsCollector) SimulationEngine.getInstance().getManager(SimPathsCollector.class.getCanonicalName())).getWealthIncomeStats(); + if (covidModuleGrossLabourIncomeBaseline <= wealthIncomeStats.getYLabP20()) { person.setCovidYLabGrossXt5(Quintiles.Q1); - } else if (covidModuleGrossLabourIncomeBaseline <= stats.getYLabP40()) { + } else if (covidModuleGrossLabourIncomeBaseline <= wealthIncomeStats.getYLabP40()) { person.setCovidYLabGrossXt5(Quintiles.Q2); - } else if (covidModuleGrossLabourIncomeBaseline <= stats.getYLabP60()) { + } else if (covidModuleGrossLabourIncomeBaseline <= wealthIncomeStats.getYLabP60()) { person.setCovidYLabGrossXt5(Quintiles.Q3); - } else if (covidModuleGrossLabourIncomeBaseline <= stats.getYLabP80()) { + } else if (covidModuleGrossLabourIncomeBaseline <= wealthIncomeStats.getYLabP80()) { person.setCovidYLabGrossXt5(Quintiles.Q4); } else { person.setCovidYLabGrossXt5(Quintiles.Q5); diff --git a/src/main/java/simpaths/model/SimPathsModel.java b/src/main/java/simpaths/model/SimPathsModel.java index 2210185c3..16a3e2f35 100644 --- a/src/main/java/simpaths/model/SimPathsModel.java +++ b/src/main/java/simpaths/model/SimPathsModel.java @@ -3164,6 +3164,12 @@ public void setAlignInSchool(boolean flag) { public boolean isAlignInSchool() { return alignInSchool; } + public boolean isAlignPopulation() { return alignPopulation; } + + public boolean isAlignEducation() { return alignEducation; } + + public boolean isEnableIntertemporalOptimisations() { return enableIntertemporalOptimisations; } + public double getInSchoolAdjustment() { if (!alignInSchool) { return 0.0; diff --git a/src/main/resources/META-INF/persistence.xml b/src/main/resources/META-INF/persistence.xml index 0f15f9f4f..755ff9c17 100644 --- a/src/main/resources/META-INF/persistence.xml +++ b/src/main/resources/META-INF/persistence.xml @@ -57,11 +57,12 @@ simpaths.model.Household simpaths.model.Person simpaths.model.BenefitUnit - simpaths.data.statistics.Statistics - simpaths.data.statistics.Statistics2 - simpaths.data.statistics.AlignmentAdjustmentFactors + simpaths.data.statistics.WealthIncomeStatistics + simpaths.data.statistics.DemographicStatistics + simpaths.data.statistics.AlignmentStatistics simpaths.data.statistics.HealthStatistics - simpaths.data.statistics.EmploymentStatistics + simpaths.data.statistics.LabourStatistics + simpaths.data.statistics.WellbeingByGender false diff --git a/src/test/java/simpaths/data/statistics/EmploymentStatisticsTest.java b/src/test/java/simpaths/data/statistics/LabourStatisticsTest.java similarity index 97% rename from src/test/java/simpaths/data/statistics/EmploymentStatisticsTest.java rename to src/test/java/simpaths/data/statistics/LabourStatisticsTest.java index a20fe1b3c..bac63c338 100644 --- a/src/test/java/simpaths/data/statistics/EmploymentStatisticsTest.java +++ b/src/test/java/simpaths/data/statistics/LabourStatisticsTest.java @@ -15,8 +15,8 @@ import static org.junit.jupiter.api.Assertions.*; -@DisplayName("Calculating employment statistics") -class EmploymentStatisticsTest { +@DisplayName("Calculating labour statistics") +class LabourStatisticsTest { private static List testPopulation; diff --git a/src/test/java/simpaths/integrationtest/RunSimPathsIntegrationTest.java b/src/test/java/simpaths/integrationtest/RunSimPathsIntegrationTest.java index 04f57fbe6..ef359ee6b 100644 --- a/src/test/java/simpaths/integrationtest/RunSimPathsIntegrationTest.java +++ b/src/test/java/simpaths/integrationtest/RunSimPathsIntegrationTest.java @@ -68,38 +68,45 @@ public static void loadResults() throws IOException { } @Test - public void compareStatistics1() throws IOException { + public void compareWealthIncomeStatistics() throws IOException { compareFiles( - latestOutputDir.resolve("csv/Statistics1.csv"), - Paths.get("src/test/java/simpaths/integrationtest/expected/Statistics1.csv") + latestOutputDir.resolve("csv/WealthIncomeStatistics.csv"), + Paths.get("src/test/java/simpaths/integrationtest/expected/WealthIncomeStatistics.csv") ); } @Test - public void compareStatistics21() throws IOException { + public void compareDemographicStatistics() throws IOException { compareFiles( - latestOutputDir.resolve("csv/Statistics21.csv"), - Paths.get("src/test/java/simpaths/integrationtest/expected/Statistics21.csv") + latestOutputDir.resolve("csv/DemographicStatistics.csv"), + Paths.get("src/test/java/simpaths/integrationtest/expected/DemographicStatistics.csv") ); } @Test - public void verifyAlignmentAdjustmentFactorsExported() { + public void verifyAlignmentStatisticsExported() { assertTrue( - Files.exists(latestOutputDir.resolve("csv/AlignmentAdjustmentFactors1.csv")), - "Expected output file is missing: " + latestOutputDir.resolve("csv/AlignmentAdjustmentFactors1.csv") + Files.exists(latestOutputDir.resolve("csv/AlignmentStatistics.csv")), + "Expected output file is missing: " + latestOutputDir.resolve("csv/AlignmentStatistics.csv") ); } @Test - public void compareHealthStatistics1() throws IOException { + public void compareWellbeingByGender() throws IOException { compareFiles( - latestOutputDir.resolve("csv/HealthStatistics1.csv"), - Paths.get("src/test/java/simpaths/integrationtest/expected/HealthStatistics1.csv") + latestOutputDir.resolve("csv/WellbeingByGender.csv"), + Paths.get("src/test/java/simpaths/integrationtest/expected/WellbeingByGender.csv") ); } @Test - public void compareEmploymentStatistics1() throws IOException { + public void compareHealthStatistics() throws IOException { compareFiles( - latestOutputDir.resolve("csv/EmploymentStatistics1.csv"), - Paths.get("src/test/java/simpaths/integrationtest/expected/EmploymentStatistics1.csv") + latestOutputDir.resolve("csv/HealthStatistics.csv"), + Paths.get("src/test/java/simpaths/integrationtest/expected/HealthStatistics.csv") + ); + } + @Test + public void compareLabourStatistics() throws IOException { + compareFiles( + latestOutputDir.resolve("csv/LabourStatistics.csv"), + Paths.get("src/test/java/simpaths/integrationtest/expected/LabourStatistics.csv") ); } } diff --git a/src/test/java/simpaths/integrationtest/expected/AlignmentAdjustmentFactors1.csv b/src/test/java/simpaths/integrationtest/expected/AlignmentStatistics.csv similarity index 83% rename from src/test/java/simpaths/integrationtest/expected/AlignmentAdjustmentFactors1.csv rename to src/test/java/simpaths/integrationtest/expected/AlignmentStatistics.csv index c8bd93e17..86c34a868 100644 --- a/src/test/java/simpaths/integrationtest/expected/AlignmentAdjustmentFactors1.csv +++ b/src/test/java/simpaths/integrationtest/expected/AlignmentStatistics.csv @@ -1,4 +1,4 @@ -run,time,id_AlignmentAdjustmentFactors1,empShareSimACFemales,empShareSimACMales,empShareSimCouples,empShareSimSingleDepFemales,empShareSimSingleDepMales,empShareSimSingleFemales,empShareSimSingleMales,empShareTgtACFemales,empShareTgtACMales,empShareTgtCouples,empShareTgtSingleDepFemales,empShareTgtSingleDepMales,empShareTgtSingleFemales,empShareTgtSingleMales,fertilityAdjFactor,fertilityRateSim,fertilityRateTgt,inSchoolAdjFactor,inSchoolShareSim,inSchoolShareTgt,partnershipAdjFactor,shareCohabitingSim,shareCohabitingTgt,utilityAdjACFemales,utilityAdjACMales,utilityAdjCouples,utilityAdjSingleDepFemales,utilityAdjSingleDepMales,utilityAdjSingleFemales,utilityAdjSingleMales +run,time,id_AlignmentStatistics,empShareSimACFemales,empShareSimACMales,empShareSimCouples,empShareSimSingleDepFemales,empShareSimSingleDepMales,empShareSimSingleFemales,empShareSimSingleMales,empShareTgtACFemales,empShareTgtACMales,empShareTgtCouples,empShareTgtSingleDepFemales,empShareTgtSingleDepMales,empShareTgtSingleFemales,empShareTgtSingleMales,fertilityAdjFactor,fertilityRateSim,fertilityRateTgt,inSchoolAdjFactor,inSchoolShareSim,inSchoolShareTgt,partnershipAdjFactor,shareCohabitingSim,shareCohabitingTgt,utilityAdjACFemales,utilityAdjACMales,utilityAdjCouples,utilityAdjSingleDepFemales,utilityAdjSingleDepMales,utilityAdjSingleFemales,utilityAdjSingleMales 1,2019.0,1,0.5623931623931624,0.5619047619047619,0.8590878148400273,0.3333333333333333,0.44308943089430897,0.43822697265011,0.5445244410761653,0.5403293808853606,0.5311791259117856,0.8735970003111929,0.3943366638089926,0.465356415881109,0.4438849669010334,0.4705375056413739,0.0,0.05029585798816568,0.05113363440615968,0.0,0.281711358843025,0.3023858368396759,0.0,0.5387792565396972,0.632472038269043,0.0,0.0,0.0,0.0,0.0,0.0,0.0 1,2020.0,1,0.4490644490644491,0.5430711610486891,0.9006183745583038,0.4628975265017668,0.4928571428571429,0.3298311444652908,0.42654700047236654,0.5501985392408713,0.5109522836960044,0.8754389771797882,0.3941959194429085,0.4620365639995361,0.4428142056392469,0.4648045911203806,0.0,0.04911932522947159,0.04996578478889472,0.0,0.2927051671732523,0.2760101854801178,1.5821116748810904,0.6229102972744422,0.6234807968139648,0.0,0.0,0.0,0.0,0.0,0.0,0.0 1,2021.0,1,0.4762845849802372,0.5282685512367491,0.9200176108012914,0.48757763975155277,0.49616858237547895,0.38979118329466356,0.45855811672388425,0.5382718801505548,0.5130523068280014,0.8776418122289941,0.3980978816455363,0.4641592336214714,0.4451259300414946,0.4776386065456221,0.0,0.051702709420830224,0.04833442666835588,0.0,0.3293541475359657,0.2792655229568481,0.7051182620476528,0.6309994170606904,0.6310330629348755,0.0,0.0,0.0,0.0,0.0,0.0,0.0 diff --git a/src/test/java/simpaths/integrationtest/expected/DemographicStatistics.csv b/src/test/java/simpaths/integrationtest/expected/DemographicStatistics.csv new file mode 100644 index 000000000..6adeef164 --- /dev/null +++ b/src/test/java/simpaths/integrationtest/expected/DemographicStatistics.csv @@ -0,0 +1,9 @@ +run,time,id_DemographicStatistics,demMarried18to29Share,demMarried30to54Share,demMarried55to74Share,demNChild18to29Avg,demNChild30to54Avg,demNChild55to74Avg,demPop18to29N,demPop30to54N,demPop55to74N +1,2019.0,1,0.2620357634112792,0.6720496894409937,0.5969519343493552,0.29332874828060523,0.9503105590062112,0.07409144196951935,2908.0,6440.0,4265.0 +1,2020.0,1,0.43235704323570434,0.7603370260571072,0.6448706099815157,0.32391910739191077,0.9753471680449368,0.08133086876155268,2868.0,6409.0,4328.0 +1,2021.0,1,0.4281172730483928,0.7752529182879377,0.6561363636363636,0.3288590604026846,0.9708949416342413,0.08613636363636364,2831.0,6425.0,4400.0 +1,2022.0,1,0.37104708362614197,0.7549883990719257,0.6552583862194016,0.3236120871398454,0.9540603248259861,0.08794197642792384,2846.0,6465.0,4412.0 +2,2019.0,1,0.26082474226804125,0.6719428926132837,0.5978439184438715,0.2934707903780069,0.9497206703910615,0.07429107101007734,2910.0,6444.0,4267.0 +2,2020.0,1,0.4287704632532219,0.7569714908864309,0.6478190630048465,0.3333333333333333,0.9691540738432778,0.08331410108469882,2871.0,6419.0,4333.0 +2,2021.0,1,0.43522408963585435,0.7727272727272727,0.6577272727272727,0.34978991596638653,0.9652133580705009,0.09045454545454545,2856.0,6468.0,4400.0 +2,2022.0,1,0.3675333801827126,0.7488386497367606,0.6598546775658493,0.3323963457484188,0.9377516258903685,0.09150772025431426,2846.0,6458.0,4404.0 \ No newline at end of file diff --git a/src/test/java/simpaths/integrationtest/expected/EmploymentStatistics1.csv b/src/test/java/simpaths/integrationtest/expected/EmploymentStatistics1.csv deleted file mode 100644 index d72487772..000000000 --- a/src/test/java/simpaths/integrationtest/expected/EmploymentStatistics1.csv +++ /dev/null @@ -1,9 +0,0 @@ -run,time,id_EmploymentStatistics1,labEmpShare,labEmpToNotEmpShare,labNotEmpToEmpShare,labUnempShare -1,2019.0,1,0.712445288628293,0.0,0.0,0.15533900404657694 -1,2020.0,1,0.7179465983301645,0.07705459933888066,0.40707497360084477,0.1521864925188063 -1,2021.0,1,0.7499176548089591,0.01987647389107243,0.3590568060021436,0.10828392621870883 -1,2022.0,1,0.7638605372744346,0.024143799191661347,0.29681717246484085,0.09969788519637462 -2,2019.0,1,0.7128238983330583,0.0,0.0,0.15514111239478462 -2,2020.0,1,0.7114559260482007,0.08077709611451943,0.38862307283359915,0.15673489600528226 -2,2021.0,1,0.7444735549369575,0.021012200632625395,0.3481822836661546,0.1171606353364991 -2,2022.0,1,0.7544748671843073,0.026426039316790204,0.2877648667122351,0.10608908868001635 \ No newline at end of file diff --git a/src/test/java/simpaths/integrationtest/expected/HealthStatistics.csv b/src/test/java/simpaths/integrationtest/expected/HealthStatistics.csv new file mode 100644 index 000000000..fe656cfa7 --- /dev/null +++ b/src/test/java/simpaths/integrationtest/expected/HealthStatistics.csv @@ -0,0 +1,9 @@ +run,time,id_HealthStatistics,healthDsbl18to29Share,healthDsbl30to54Share,healthDsbl55to74Share,healthScore18to29Avg,healthScore30to54Avg,healthScore55to74Avg +1,2019.0,1,0.05811554332874828,0.09130434782608696,0.06236811254396248,3.69050894085282,3.4482919254658384,3.092379835873388 +1,2020.0,1,0.05788005578800558,0.0962708690903417,0.07024029574861368,3.584030683403068,3.3867998127633014,3.0499075785582255 +1,2021.0,1,0.06464146944542565,0.09867704280155642,0.06431818181818182,3.4906393500529846,3.3063035019455254,2.9979545454545455 +1,2022.0,1,0.06640899508081517,0.1048723897911833,0.06799637352674524,3.409697821503865,3.279969064191802,2.9290571169537625 +2,2019.0,1,0.05807560137457045,0.09109248913718188,0.0625732364659011,3.689347079037801,3.450651769087523,3.089289899226623 +2,2020.0,1,0.05886450714036921,0.09736719115126967,0.07085160396953612,3.582723789620341,3.3782520641844522,3.039464574198015 +2,2021.0,1,0.06197478991596639,0.10482374768089053,0.06681818181818182,3.502450980392157,3.3140074211502784,2.9813636363636364 +2,2022.0,1,0.06430077301475755,0.10405698358624961,0.06970935513169846,3.4205903021784962,3.2890987921957264,2.9302906448683017 \ No newline at end of file diff --git a/src/test/java/simpaths/integrationtest/expected/LabourStatistics.csv b/src/test/java/simpaths/integrationtest/expected/LabourStatistics.csv new file mode 100644 index 000000000..172d59ffe --- /dev/null +++ b/src/test/java/simpaths/integrationtest/expected/LabourStatistics.csv @@ -0,0 +1,9 @@ +run,time,id_LabourStatistics,labEmpShare,labEmpToNotEmpShare,labNotEmpToEmpShare,labUnempShare,labWorkFullTime18to29Share,labWorkFullTime30to54Share,labWorkFullTime55to74Share,labWorkPartTime18to29Share,labWorkPartTime30to54Share,labWorkPartTime55to74Share +1,2019.0,1,0.712445288628293,0.0,0.0,0.15533900404657694,0.561554332874828,0.6751552795031056,0.2797186400937866,0.09353507565337002,0.140527950310559,0.08253223915592028 +1,2020.0,1,0.7179465983301645,0.07705459933888066,0.40707497360084477,0.1521864925188063,0.49860529986053,0.7409892338898424,0.3213955637707948,0.14783821478382148,0.09549071618037135,0.06076709796672828 +1,2021.0,1,0.7499176548089591,0.01987647389107243,0.3590568060021436,0.10828392621870883,0.5231367008124338,0.7875486381322957,0.35659090909090907,0.13952666902154715,0.0840466926070039,0.06159090909090909 +1,2022.0,1,0.7638605372744346,0.024143799191661347,0.29681717246484085,0.09969788519637462,0.5144061841180604,0.7993812838360402,0.38077969174977333,0.15706254392129304,0.08785769528228925,0.06414324569356301 +2,2019.0,1,0.7128238983330583,0.0,0.0,0.15514111239478462,0.5618556701030928,0.675667287399131,0.28005624560581205,0.09347079037800687,0.1404407200496586,0.0824935551910007 +2,2020.0,1,0.7114559260482007,0.08077709611451943,0.38862307283359915,0.15673489600528226,0.49773598049460116,0.7378096276678611,0.32333256404338795,0.14071752002786486,0.09066832840006231,0.05746595891991692 +2,2021.0,1,0.7444735549369575,0.021012200632625395,0.3481822836661546,0.1171606353364991,0.5301120448179272,0.7824675324675324,0.3575,0.13025210084033614,0.08039579468150897,0.06 +2,2022.0,1,0.7544748671843073,0.026426039316790204,0.2877648667122351,0.10608908868001635,0.5017568517217147,0.7867760916692474,0.3807901907356948,0.15706254392129304,0.0901207804273769,0.06153496821071753 \ No newline at end of file diff --git a/src/test/java/simpaths/integrationtest/expected/Statistics1.csv b/src/test/java/simpaths/integrationtest/expected/Statistics1.csv deleted file mode 100644 index ea493bb5a..000000000 --- a/src/test/java/simpaths/integrationtest/expected/Statistics1.csv +++ /dev/null @@ -1,9 +0,0 @@ -run,time,id_Statistics1,edi_p50,sIndex_p50,statYHhDispEquivNatGini,statYMktNatGini,yHhDispEquivP50,yHhQuintilesC5P20,yHhQuintilesC5P40,yHhQuintilesC5P60,yHhQuintilesC5P80,yLabP20,yLabP40,yLabP60,yLabP80 -1,2019.0,1,15256.953965109053,0.0,0.0,0.0,15456.781759590931,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0 -1,2020.0,1,16104.945563508783,0.0,0.0,0.0,16126.300224195558,6.002947624785629,7.393700990590142,8.079014685308639,8.651826215326523,612.4114548496958,1474.3612945063908,2411.3833648998984,4025.4346348418517 -1,2021.0,1,16385.814429547543,0.0,0.0,0.0,16393.484440168773,6.187762449635658,7.484289740368494,8.14086559630633,8.671098665364262,760.8172378594519,1551.7095560857783,2503.912353211683,4197.566114529848 -1,2022.0,1,16782.87492911042,0.0,0.0,0.0,16782.87492911042,6.293766459041295,7.502899645998462,8.164467732206273,8.71487982351668,770.627494589693,1587.3827728740323,2574.51763269026,4296.795323809868 -2,2019.0,1,15256.926298340906,0.0,0.0,0.0,15450.417507924612,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0 -2,2020.0,1,16548.090983426686,0.0,0.0,0.0,16568.972587139775,5.830499134973755,7.416147336481695,8.167623512530024,8.779955942560406,636.0411789419483,1641.868120592153,2759.2643832565886,4755.702696078421 -2,2021.0,1,16957.07532931993,0.0,0.0,0.0,16971.051592235908,6.173956857055614,7.526098789480431,8.239050226188564,8.815165417981701,806.1156747516713,1797.0008067319648,2948.1225531249656,4966.012600053224 -2,2022.0,1,17161.756607262356,0.0,0.0,0.0,17162.857530412257,6.240633521617911,7.529866008624863,8.244648578675816,8.83927348961132,839.4128779658494,1828.8078853712534,3016.315905493322,5065.409902121303 \ No newline at end of file diff --git a/src/test/java/simpaths/integrationtest/expected/Statistics21.csv b/src/test/java/simpaths/integrationtest/expected/Statistics21.csv deleted file mode 100644 index 69bbd043d..000000000 --- a/src/test/java/simpaths/integrationtest/expected/Statistics21.csv +++ /dev/null @@ -1,9 +0,0 @@ -run,time,id_Statistics21,demDsbl18to29Share,demDsbl30to54Share,demDsbl55to74Share,demMarried18to29Share,demMarried30to54Share,demMarried55to74Share,demNChild18to29Avg,demNChild30to54Avg,demNChild55to74Avg,demPop18to29N,demPop30to54N,demPop55to74N,healthScore18to29Avg,healthScore30to54Avg,healthScore55to74Avg,labNoWork18to29Share,labNoWork18to54Share,labNoWork30to54Share,labNoWork55to74Share,labWorkFullTime18to29Share,labWorkFullTime30to54Share,labWorkFullTime55to74Share,labWorkPartTime18to29Share,labWorkPartTime30to54Share,labWorkPartTime55to74Share,statInvestLoss18to29Avg,statInvestLoss30to54Avg,statInvestLoss55to74Avg,statYDisp18to29Avg,statYDisp30to54Avg,statYDisp55to74Avg,statYDispGrossOfLosses18to29Avg,statYDispGrossOfLosses30to54Avg,statYDispGrossOfLosses55to75Avg,statYInvest18to29Avg,statYInvest30to54Avg,statYInvest55to74Avg,statYLab18to29Avg,statYLab30to54Avg,statYLab55to74Avg,statYPens18to29Avg,statYPens30to54Avg,statYPens55to74Avg,wealth18to29Avg,wealth30to54Avg,wealth55to74Avg,x18to29Avg,x18to54Avg,x30to54Avg,x55to74Avg,xToLeisureRatio -1,2019.0,1,0.05811554332874828,0.09130434782608696,0.06236811254396248,0.2620357634112792,0.6720496894409937,0.5969519343493552,0.29332874828060523,0.9503105590062112,0.07409144196951935,2908.0,6440.0,4265.0,3.69050894085282,3.4482919254658384,3.092379835873388,0.0021834914718019127,-0.0201199603173437,-0.02022802981366459,0.036602920750293144,0.561554332874828,0.6751552795031056,0.2797186400937866,0.09353507565337002,0.140527950310559,0.08253223915592028,0.0,0.0,0.0,-220.98483429553175,-459.2130693789786,-563.0006789520651,1065.2273871330394,1640.3078493710213,1515.844915690792,0.0,0.0,0.0,NaN,NaN,NaN,0.0,0.0,0.0,0.0,0.0,0.0,-720.34744375,-1108.3894350892856,-1343.6696142857143,-1403.9432562499999,NaN -1,2020.0,1,0.05788005578800558,0.0962708690903417,0.07024029574861368,0.43235704323570434,0.7603370260571072,0.6448706099815157,0.32391910739191077,0.9753471680449368,0.08133086876155268,2868.0,6409.0,4328.0,3.584030683403068,3.3867998127633014,3.0499075785582255,0.010829385355648535,-0.03269728651231163,-0.04102475007021375,0.016691138262476923,0.49860529986053,0.7409892338898424,0.3213955637707948,0.14783821478382148,0.09549071618037135,0.06076709796672828,0.0,0.0,0.0,NaN,NaN,NaN,NaN,NaN,NaN,0.0,0.0,0.0,NaN,NaN,NaN,0.0,0.0,0.0,0.0,0.0,0.0,-720.1253033385323,-1107.798049097802,-1342.878666623434,-1403.849348866661,-2.028132400574429 -1,2021.0,1,0.06464146944542565,0.09867704280155642,0.06431818181818182,0.4281172730483928,0.7752529182879377,0.6561363636363636,0.3288590604026846,0.9708949416342413,0.08613636363636364,2831.0,6425.0,4400.0,3.4906393500529846,3.3063035019455254,2.9979545454545455,-0.005390469833980949,-0.062995578324546,-0.07614013073929962,-0.019328018181818174,0.5231367008124338,0.7875486381322957,0.35659090909090907,0.13952666902154715,0.0840466926070039,0.06159090909090909,0.0,0.0,0.0,NaN,NaN,NaN,NaN,NaN,NaN,0.0,0.0,0.0,NaN,NaN,NaN,0.0,0.0,0.0,0.0,0.0,0.0,-720.0899303464081,-1107.7609427130571,-1342.8446440133123,-1403.8590083215859,-1.008014791168376 -1,2022.0,1,0.06640899508081517,0.1048723897911833,0.06799637352674524,0.37104708362614197,0.7549883990719257,0.6552583862194016,0.3236120871398454,0.9540603248259861,0.08794197642792384,2846.0,6465.0,4412.0,3.409697821503865,3.279969064191802,2.9290571169537625,-0.014195828039353486,-0.08108879441813016,-0.09178377911832947,-0.046069137443336294,0.5144061841180604,0.7993812838360402,0.38077969174977333,0.15706254392129304,0.08785769528228925,0.06414324569356301,0.0,0.0,0.0,NaN,NaN,NaN,NaN,NaN,NaN,0.0,0.0,0.0,NaN,NaN,NaN,0.0,0.0,0.0,0.0,0.0,0.0,-720.0559086346597,-1107.7736659958553,-1342.8864123967285,-1403.8032525174654,2.932715935579048 -2,2019.0,1,0.05807560137457045,0.09109248913718188,0.0625732364659011,0.26082474226804125,0.6719428926132837,0.5978439184438715,0.2934707903780069,0.9497206703910615,0.07429107101007734,2910.0,6444.0,4267.0,3.689347079037801,3.450651769087523,3.089289899226623,0.0019464395189003336,-0.020478632743557712,-0.020652807448789584,0.036303999203187276,0.5618556701030928,0.675667287399131,0.28005624560581205,0.09347079037800687,0.1404407200496586,0.0824935551910007,0.0,0.0,0.0,-220.29699124714057,-458.1635502021104,-560.3573828031367,1065.9152301814306,1641.3573685478896,1518.4882118397204,0.0,0.0,0.0,NaN,NaN,NaN,0.0,0.0,0.0,0.0,0.0,0.0,-720.34744375,-1108.3894350892856,-1343.6696142857143,-1403.9432562499999,NaN -2,2020.0,1,0.05886450714036921,0.09736719115126967,0.07085160396953612,0.4287704632532219,0.7569714908864309,0.6478190630048465,0.3333333333333333,0.9691540738432778,0.08331410108469882,2871.0,6419.0,4333.0,3.582723789620341,3.3782520641844522,3.039464574198015,0.01881939947753397,-0.026844385656610126,-0.03302275606792335,0.018055277036695183,0.49773598049460116,0.7378096276678611,0.32333256404338795,0.14071752002786486,0.09066832840006231,0.05746595891991692,0.0,0.0,0.0,NaN,NaN,NaN,NaN,NaN,NaN,0.0,0.0,0.0,NaN,NaN,NaN,0.0,0.0,0.0,0.0,0.0,0.0,-720.1061329211112,-1107.7901177566039,-1342.8783564911928,-1403.8521133348154,-0.934928925220003 -2,2021.0,1,0.06197478991596639,0.10482374768089053,0.06681818181818182,0.43522408963585435,0.7727272727272727,0.6577272727272727,0.34978991596638653,0.9652133580705009,0.09045454545454545,2856.0,6468.0,4400.0,3.502450980392157,3.3140074211502784,2.9813636363636364,-0.0030912456582632974,-0.058741061672981654,-0.06740812714904143,-0.018646199999999946,0.5301120448179272,0.7824675324675324,0.3575,0.13025210084033614,0.08039579468150897,0.06,0.0,0.0,0.0,NaN,NaN,NaN,NaN,NaN,NaN,0.0,0.0,0.0,NaN,NaN,NaN,0.0,0.0,0.0,0.0,0.0,0.0,-720.0816849235309,-1107.7588054826192,-1342.8460180938152,-1403.8623267615933,-0.7409292189495101 -2,2022.0,1,0.06430077301475755,0.10405698358624961,0.06970935513169846,0.3675333801827126,0.7488386497367606,0.6598546775658493,0.3323963457484188,0.9377516258903685,0.09150772025431426,2846.0,6458.0,4404.0,3.4205903021784962,3.2890987921957264,2.9302906448683017,-0.0015464956430077392,-0.07280926880653632,-0.08144167209662434,-0.0434713589464123,0.5017568517217147,0.7867760916692474,0.3807901907356948,0.15706254392129304,0.0901207804273769,0.06153496821071753,0.0,0.0,0.0,NaN,NaN,NaN,NaN,NaN,NaN,0.0,0.0,0.0,NaN,NaN,NaN,0.0,0.0,0.0,0.0,0.0,0.0,-720.0678755503312,-1107.7917313250355,-1342.9076642208443,-1403.8193231941357,2.4759561851061003 \ No newline at end of file diff --git a/src/test/java/simpaths/integrationtest/expected/WealthIncomeStatistics.csv b/src/test/java/simpaths/integrationtest/expected/WealthIncomeStatistics.csv new file mode 100644 index 000000000..2f5376ca9 --- /dev/null +++ b/src/test/java/simpaths/integrationtest/expected/WealthIncomeStatistics.csv @@ -0,0 +1,9 @@ +run,time,id_WealthIncomeStatistics,edi_p50,sIndex_p50,statInvestLoss18to29Avg,statInvestLoss30to54Avg,statInvestLoss55to74Avg,statYDispGrossOfLosses18to29Avg,statYDispGrossOfLosses30to54Avg,statYDispGrossOfLosses55to74Avg,statYHhDispEquivNatGini,statYInvest18to29Avg,statYInvest30to54Avg,statYInvest55to74Avg,statYLabWeeklyPerWorker18to29Avg,statYLabWeeklyPerWorker30to54Avg,statYLabWeeklyPerWorker55to74Avg,statYMktNatGini,statYPens18to29Avg,statYPens30to54Avg,statYPens55to74Avg,wealth18to29Avg,wealth30to54Avg,wealth55to74Avg,yHhDispEquivP50,yHhQuintilesC5P20,yHhQuintilesC5P40,yHhQuintilesC5P60,yHhQuintilesC5P80,yLabP20,yLabP40,yLabP60,yLabP80 +1,2019.0,1,15256.953965109053,0.0,0.0,0.0,0.0,1065.2273871330394,1640.3078493710213,1515.844915690792,0.0,0.0,0.0,0.0,NaN,NaN,NaN,0.0,0.0,0.0,0.0,0.0,0.0,0.0,15456.781759590931,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0 +1,2020.0,1,16104.945563508783,0.0,0.0,0.0,0.0,NaN,NaN,NaN,0.0,0.0,0.0,0.0,NaN,NaN,NaN,0.0,0.0,0.0,0.0,0.0,0.0,0.0,16126.300224195558,6.002947624785629,7.393700990590142,8.079014685308639,8.651826215326523,612.4114548496958,1474.3612945063908,2411.3833648998984,4025.4346348418517 +1,2021.0,1,16385.814429547543,0.0,0.0,0.0,0.0,NaN,NaN,NaN,0.0,0.0,0.0,0.0,NaN,NaN,NaN,0.0,0.0,0.0,0.0,0.0,0.0,0.0,16393.484440168773,6.187762449635658,7.484289740368494,8.14086559630633,8.671098665364262,760.8172378594519,1551.7095560857783,2503.912353211683,4197.566114529848 +1,2022.0,1,16782.87492911042,0.0,0.0,0.0,0.0,NaN,NaN,NaN,0.0,0.0,0.0,0.0,NaN,NaN,NaN,0.0,0.0,0.0,0.0,0.0,0.0,0.0,16782.87492911042,6.293766459041295,7.502899645998462,8.164467732206273,8.71487982351668,770.627494589693,1587.3827728740323,2574.51763269026,4296.795323809868 +2,2019.0,1,15256.926298340906,0.0,0.0,0.0,0.0,1065.9152301814306,1641.3573685478896,1518.4882118397204,0.0,0.0,0.0,0.0,NaN,NaN,NaN,0.0,0.0,0.0,0.0,0.0,0.0,0.0,15450.417507924612,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0 +2,2020.0,1,16548.090983426686,0.0,0.0,0.0,0.0,NaN,NaN,NaN,0.0,0.0,0.0,0.0,NaN,NaN,NaN,0.0,0.0,0.0,0.0,0.0,0.0,0.0,16568.972587139775,5.830499134973755,7.416147336481695,8.167623512530024,8.779955942560406,636.0411789419483,1641.868120592153,2759.2643832565886,4755.702696078421 +2,2021.0,1,16957.07532931993,0.0,0.0,0.0,0.0,NaN,NaN,NaN,0.0,0.0,0.0,0.0,NaN,NaN,NaN,0.0,0.0,0.0,0.0,0.0,0.0,0.0,16971.051592235908,6.173956857055614,7.526098789480431,8.239050226188564,8.815165417981701,806.1156747516713,1797.0008067319648,2948.1225531249656,4966.012600053224 +2,2022.0,1,17161.756607262356,0.0,0.0,0.0,0.0,NaN,NaN,NaN,0.0,0.0,0.0,0.0,NaN,NaN,NaN,0.0,0.0,0.0,0.0,0.0,0.0,0.0,17162.857530412257,6.240633521617911,7.529866008624863,8.244648578675816,8.83927348961132,839.4128779658494,1828.8078853712534,3016.315905493322,5065.409902121303 \ No newline at end of file diff --git a/src/test/java/simpaths/integrationtest/expected/HealthStatistics1.csv b/src/test/java/simpaths/integrationtest/expected/WellbeingByGender.csv similarity index 90% rename from src/test/java/simpaths/integrationtest/expected/HealthStatistics1.csv rename to src/test/java/simpaths/integrationtest/expected/WellbeingByGender.csv index 0231b38a6..82d0073af 100644 --- a/src/test/java/simpaths/integrationtest/expected/HealthStatistics1.csv +++ b/src/test/java/simpaths/integrationtest/expected/WellbeingByGender.csv @@ -1,25 +1,25 @@ -run,time,id_HealthStatistics1,demLifeSatScore0to10Avg,demLifeSatScore0to10P10,demLifeSatScore0to10P25,demLifeSatScore0to10P50,demLifeSatScore0to10P75,demLifeSatScore0to10P90,demSex,healthLifeYearQualAdj,healthLifeYearWbAdj,healthMentalMcsAvg,healthMentalMcsP10,healthMentalMcsP25,healthMentalMcsP50,healthMentalMcsP75,healthMentalMcsP90,healthNObsSubGroup,healthPhysicalPcsAvg,healthPhysicalPcsP10,healthPhysicalPcsP25,healthPhysicalPcsP50,healthPhysicalPcsP75,healthPhysicalPcsP90,healthWbScore0to36Avg,healthWbScore0to36P10,healthWbScore0to36P25,healthWbScore0to36P50,healthWbScore0to36P75,healthWbScore0to36P90 +run,time,id_WellbeingByGender,demLifeSatScore0to10Avg,demLifeSatScore0to10P10,demLifeSatScore0to10P25,demLifeSatScore0to10P50,demLifeSatScore0to10P75,demLifeSatScore0to10P90,demSex,healthLifeYearQualAdj,healthLifeYearWbAdj,healthMentalMcsAvg,healthMentalMcsP10,healthMentalMcsP25,healthMentalMcsP50,healthMentalMcsP75,healthMentalMcsP90,healthNObsSubGroup,healthPhysicalPcsAvg,healthPhysicalPcsP10,healthPhysicalPcsP25,healthPhysicalPcsP50,healthPhysicalPcsP75,healthPhysicalPcsP90,healthWbScore0to36Avg,healthWbScore0to36P10,healthWbScore0to36P25,healthWbScore0to36P50,healthWbScore0to36P75,healthWbScore0to36P90 1,2019.0,1,6.798653101737303,3.33,5.0,8.0,8.33,8.33,Total,8313.63015908381,68496.43000000333,47.53391960297742,33.416,42.19,49.52,54.79,57.73,10075,51.020747394541296,36.17,47.59,54.51,57.49,59.64,11.50302729528536,6.0,8.0,10.0,13.0,19.0 -1,2019.0,1,6.82559311740912,3.33,5.0,8.0,8.33,8.33,Male,4178.113558218262,33718.430000001055,48.500955465587225,35.652,43.66,50.86,55.197500000000005,58.15,4940,51.79769838056671,39.08,49.0,54.77,57.49,59.31,10.857489878542511,6.0,8.0,10.0,12.0,17.0 -1,2019.0,1,6.77273612463507,3.33,5.0,8.0,8.33,8.33,Female,4135.516600865757,34778.000000001084,46.60360662122688,31.608,40.8,48.87,54.2,57.33,5135,50.27330087633859,34.18,45.74,54.03,57.49,59.89,12.124050632911393,6.0,8.0,11.0,14.0,21.0 +1,2019.0,2,6.82559311740912,3.33,5.0,8.0,8.33,8.33,Male,4178.113558218262,33718.430000001055,48.500955465587225,35.652,43.66,50.86,55.197500000000005,58.15,4940,51.79769838056671,39.08,49.0,54.77,57.49,59.31,10.857489878542511,6.0,8.0,10.0,12.0,17.0 +1,2019.0,3,6.77273612463507,3.33,5.0,8.0,8.33,8.33,Female,4135.516600865757,34778.000000001084,46.60360662122688,31.608,40.8,48.87,54.2,57.33,5135,50.27330087633859,34.18,45.74,54.03,57.49,59.89,12.124050632911393,6.0,8.0,11.0,14.0,21.0 1,2020.0,1,6.6145358041802025,3.7666336552029334,5.222159166466565,6.730759901862367,8.16637791131063,9.45956341274334,Total,8122.408872271123,66667.90637033226,45.9036620843742,32.76041987699348,39.42547467103069,46.32998491503522,52.888089341889014,58.779144471354584,10079,51.31536563011669,37.478675114637504,45.4553496715998,52.34846463570141,58.468540748836105,63.46259609758929,12.66146844857907,5.742978242682843,8.794527073422076,12.317437126483158,16.18488573396826,20.002347795486234 -1,2020.0,1,6.626325011114707,3.805744796504718,5.292521016604588,6.7436549444174805,8.140813216794122,9.448738725825232,Male,4089.7518389310344,32753.924529939995,47.16004134094487,34.72060242044466,40.92513830937019,47.45773118565858,53.81664007943717,59.635697316209274,4943,51.99935691965081,39.0965689792193,46.155821046703046,52.75851350330392,58.80571549778201,63.8502526991901,11.932659642546787,5.297281267527709,8.216250042609923,11.647003163264127,15.335487311411011,18.97702901756019 -1,2020.0,1,6.603189610668323,3.7461330212911594,5.148107115427289,6.7153196174055685,8.192784063571331,9.471154701795063,Female,4032.657033340079,33913.98184039251,44.69449489877612,31.334291564943996,38.157549899920284,45.15466063075943,51.82796605067129,57.61215428517951,5136,50.65707728428983,35.87646489659886,44.56246883163646,51.917407081210044,58.11668037935321,63.08832636686682,13.362890163574518,6.19336925077437,9.441079561386836,12.977554167910503,16.89382985102585,20.978926770896074 +1,2020.0,2,6.626325011114707,3.805744796504718,5.292521016604588,6.7436549444174805,8.140813216794122,9.448738725825232,Male,4089.7518389310344,32753.924529939995,47.16004134094487,34.72060242044466,40.92513830937019,47.45773118565858,53.81664007943717,59.635697316209274,4943,51.99935691965081,39.0965689792193,46.155821046703046,52.75851350330392,58.80571549778201,63.8502526991901,11.932659642546787,5.297281267527709,8.216250042609923,11.647003163264127,15.335487311411011,18.97702901756019 +1,2020.0,3,6.603189610668323,3.7461330212911594,5.148107115427289,6.7153196174055685,8.192784063571331,9.471154701795063,Female,4032.657033340079,33913.98184039251,44.69449489877612,31.334291564943996,38.157549899920284,45.15466063075943,51.82796605067129,57.61215428517951,5136,50.65707728428983,35.87646489659886,44.56246883163646,51.917407081210044,58.11668037935321,63.08832636686682,13.362890163574518,6.19336925077437,9.441079561386836,12.977554167910503,16.89382985102585,20.978926770896074 1,2021.0,1,6.5222927706096,3.7469835665545466,5.113044957174414,6.623159508759464,8.041717774878956,9.328211659799557,Total,8096.196668036661,66018.64742411037,45.54746641294028,32.31852237750864,38.737626985901215,45.76872131058666,52.6294155605232,58.569598289166564,10122,51.26474097970102,37.60122377972728,44.6935806234142,51.8099927671697,58.51170540311931,64.18246240949702,12.98757358999948,5.8693887796774,9.116717165428327,12.870246031355961,16.707034224456343,20.137186664732607 -1,2021.0,1,6.5694254240231515,3.8153242557425067,5.1620397662654325,6.649155572315157,8.116038508840568,9.37361552478929,Male,4058.6888328447476,32544.93355061069,46.81247320429826,33.89614142565395,40.147248295719656,46.90815491644721,53.63108731160957,59.65171914846296,4954,51.793648586585846,38.77406223488162,45.43154483050416,52.24645705249242,58.61413723923415,64.28537298829596,12.387089121208165,5.229441939909284,8.664920962457028,12.254443553189454,15.99149261425805,19.568465645701277 -1,2021.0,1,6.477111817627612,3.6937443889126107,5.056094367099051,6.593838701895033,7.993064887881597,9.28307001508771,Female,4037.5078351919246,33473.713873499495,44.33484186874802,30.889891657638252,37.103434260026845,44.46887183076261,51.53754644630418,57.611274719576464,5168,50.75773473269862,36.39337770404074,43.869495427280725,51.424246600182215,58.45777202228101,64.11381856190593,13.563192796344737,6.518139639649819,9.60220807934132,13.448251770272885,17.30606691578576,20.613047135102782 +1,2021.0,2,6.5694254240231515,3.8153242557425067,5.1620397662654325,6.649155572315157,8.116038508840568,9.37361552478929,Male,4058.6888328447476,32544.93355061069,46.81247320429826,33.89614142565395,40.147248295719656,46.90815491644721,53.63108731160957,59.65171914846296,4954,51.793648586585846,38.77406223488162,45.43154483050416,52.24645705249242,58.61413723923415,64.28537298829596,12.387089121208165,5.229441939909284,8.664920962457028,12.254443553189454,15.99149261425805,19.568465645701277 +1,2021.0,3,6.477111817627612,3.6937443889126107,5.056094367099051,6.593838701895033,7.993064887881597,9.28307001508771,Female,4037.5078351919246,33473.713873499495,44.33484186874802,30.889891657638252,37.103434260026845,44.46887183076261,51.53754644630418,57.611274719576464,5168,50.75773473269862,36.39337770404074,43.869495427280725,51.424246600182215,58.45777202228101,64.11381856190593,13.563192796344737,6.518139639649819,9.60220807934132,13.448251770272885,17.30606691578576,20.613047135102782 1,2022.0,1,6.401185224198616,3.54632887593383,5.007558847756282,6.478126122329171,7.932630989459,9.277236047293357,Total,8055.120017825496,65388.107065188866,45.29476323491611,31.97699305809483,38.41425265579782,45.31415411026712,52.287672761226446,58.456176063291956,10215,50.67054381167444,36.77207169335179,43.83812325359572,51.05997472811838,57.976514356253766,64.18762560802196,12.955737215660866,5.89808767833304,9.184442131562873,12.836152984267516,16.561955459285652,20.098243862935597 -1,2022.0,1,6.4290135914374735,3.5715034387955353,5.03452951678226,6.485968053842665,7.981190587397736,9.30111510378737,Male,4035.599491459403,32112.92288923018,46.453062541046535,33.08818703890031,39.50237519628214,46.46183454526969,53.28456253986283,59.70723415284969,4995,51.319880527582285,37.856978479799395,44.62058942061295,51.59406347610837,58.37692717827564,64.43537283616588,12.388478345653247,5.496178605570909,8.659068689740018,12.30185496683114,15.967183132997553,19.618875501883863 -1,2022.0,1,6.3745563555476625,3.51813624039372,4.986831325616345,6.471192912333419,7.89121015616893,9.255761072800821,Female,4019.5205263660555,33275.1841759588,44.186390623015534,30.79567712475875,37.3692282477194,44.27431955941836,51.148027750056514,57.15288205087101,5220,50.04919574731371,35.638919023138314,43.129504074001474,50.4852031840156,57.531175477436705,63.92891160244788,13.498545272306128,6.375311299843487,9.718276608109147,13.433192476547895,17.081848295620524,20.646393770025483 +1,2022.0,2,6.4290135914374735,3.5715034387955353,5.03452951678226,6.485968053842665,7.981190587397736,9.30111510378737,Male,4035.599491459403,32112.92288923018,46.453062541046535,33.08818703890031,39.50237519628214,46.46183454526969,53.28456253986283,59.70723415284969,4995,51.319880527582285,37.856978479799395,44.62058942061295,51.59406347610837,58.37692717827564,64.43537283616588,12.388478345653247,5.496178605570909,8.659068689740018,12.30185496683114,15.967183132997553,19.618875501883863 +1,2022.0,3,6.3745563555476625,3.51813624039372,4.986831325616345,6.471192912333419,7.89121015616893,9.255761072800821,Female,4019.5205263660555,33275.1841759588,44.186390623015534,30.79567712475875,37.3692282477194,44.27431955941836,51.148027750056514,57.15288205087101,5220,50.04919574731371,35.638919023138314,43.129504074001474,50.4852031840156,57.531175477436705,63.92891160244788,13.498545272306128,6.375311299843487,9.718276608109147,13.433192476547895,17.081848295620524,20.646393770025483 2,2019.0,1,6.799095596985654,3.33,5.0,8.0,8.33,8.33,Total,8323.349559890836,68562.08000000333,47.54007040856779,33.425,42.19,49.52,54.79,57.73,10084,51.027703292344626,36.18,47.605000000000004,54.51,57.49,59.64,11.495934153113843,6.0,8.0,10.0,13.0,19.0 -2,2019.0,1,6.828700485044678,3.33,5.0,8.0,8.33,8.33,Male,4185.2461878088,33788.410000001066,48.517956750202266,35.67,43.66,50.864999999999995,55.197500000000005,58.15,4948,51.791240905416245,39.079,49.0,54.77,57.49,59.31,10.851657235246565,6.0,8.0,10.0,12.0,17.0 -2,2019.0,1,6.770574376947251,3.33,5.0,8.0,8.33,8.33,Female,4138.103372082248,34773.67000000108,46.59797897196263,31.616000000000003,40.7925,48.835,54.2,57.33,5136,50.29211448598103,34.271,45.74,54.03,57.49,59.89,12.116627725856699,6.0,8.0,11.0,14.0,21.0 +2,2019.0,2,6.828700485044678,3.33,5.0,8.0,8.33,8.33,Male,4185.2461878088,33788.410000001066,48.517956750202266,35.67,43.66,50.864999999999995,55.197500000000005,58.15,4948,51.791240905416245,39.079,49.0,54.77,57.49,59.31,10.851657235246565,6.0,8.0,10.0,12.0,17.0 +2,2019.0,3,6.770574376947251,3.33,5.0,8.0,8.33,8.33,Female,4138.103372082248,34773.67000000108,46.59797897196263,31.616000000000003,40.7925,48.835,54.2,57.33,5136,50.29211448598103,34.271,45.74,54.03,57.49,59.89,12.116627725856699,6.0,8.0,11.0,14.0,21.0 2,2020.0,1,6.648530322680276,3.798533559017458,5.246134187086383,6.765453938693191,8.214569954104112,9.49823605832067,Total,8160.4061836057535,67116.91360745739,45.991701701356305,32.821783768474845,39.46337166342815,46.35006053636001,53.02093548662156,58.835433726929615,10095,51.43349873065682,37.64004187077226,45.519442039907084,52.44430441596412,58.54493146361481,63.58032620081715,12.892174155904131,5.941239718920905,9.038052603027833,12.5620019419938,16.389742385253584,20.209999590600944 -2,2020.0,1,6.701790056047846,3.8879612847729885,5.348863402779376,6.817344664927628,8.229292733365684,9.52210708506867,Male,4098.052433782941,33214.071517773125,47.22725312217155,34.73279764915407,41.05400091483066,47.54452840037397,53.86249506436657,59.6908719208839,4956,51.91222279039014,38.991161795543036,46.05860571906381,52.68552387774127,58.71408535918422,63.78253241142672,12.097710182919613,5.465500783867313,8.409656342447645,11.84821669424816,15.415124248299,19.13567886379256 -2,2020.0,1,6.59716717059433,3.752745435962728,5.154152833450976,6.70958205757793,8.192529032539117,9.475260339214275,Female,4062.3537498227943,33902.842089684265,44.80014831712622,31.299839260810792,38.281225119575815,45.25936507693766,51.93654439169077,57.74689782848656,5139,50.9718220542527,36.21785989238145,44.927755197291994,52.18264236825294,58.36347553214964,63.3381980500193,13.658347234345719,6.517946352244499,9.782443927008583,13.29594414577838,17.16487199584773,21.22896603027014 +2,2020.0,2,6.701790056047846,3.8879612847729885,5.348863402779376,6.817344664927628,8.229292733365684,9.52210708506867,Male,4098.052433782941,33214.071517773125,47.22725312217155,34.73279764915407,41.05400091483066,47.54452840037397,53.86249506436657,59.6908719208839,4956,51.91222279039014,38.991161795543036,46.05860571906381,52.68552387774127,58.71408535918422,63.78253241142672,12.097710182919613,5.465500783867313,8.409656342447645,11.84821669424816,15.415124248299,19.13567886379256 +2,2020.0,3,6.59716717059433,3.752745435962728,5.154152833450976,6.70958205757793,8.192529032539117,9.475260339214275,Female,4062.3537498227943,33902.842089684265,44.80014831712622,31.299839260810792,38.281225119575815,45.25936507693766,51.93654439169077,57.74689782848656,5139,50.9718220542527,36.21785989238145,44.927755197291994,52.18264236825294,58.36347553214964,63.3381980500193,13.658347234345719,6.517946352244499,9.782443927008583,13.29594414577838,17.16487199584773,21.22896603027014 2,2021.0,1,6.543622162505094,3.759619546098582,5.121913967602025,6.639665858915044,8.078018325915554,9.379385188037874,Total,8170.742853978519,66646.79172511438,45.66433657305526,32.2783763109786,38.75001696416544,45.93394452397699,52.728236626436455,58.816950072179814,10185,51.37913373198122,37.690595761284115,44.81398580446605,51.90789105639666,58.616224624987254,64.2969476955009,13.160682550119915,6.089182435380993,9.317543500369755,13.004206215272106,16.83160166075644,20.348590202118842 -2,2021.0,1,6.657157614619,3.9182854178622737,5.241671091889814,6.734349607962663,8.193423030523004,9.49907670738414,Male,4078.8049978223776,33179.273551261096,46.88179038815436,33.95801530547186,40.18265752644181,47.10757828233879,53.7389213705499,59.832392960034284,4984,51.70070626542735,38.66872891633799,45.27327488441025,52.143815860572644,58.6172123807197,64.26907799896426,12.342281263956684,5.25333979351767,8.69566156338442,12.152905215940784,15.954811701066731,19.431618027815112 -2,2021.0,1,6.434823721179303,3.6304954156760614,5.006471773535255,6.53950940822727,7.95171628270851,9.244363122571073,Female,4091.9378561561552,33467.518173853554,44.497678273795216,31.152780389457796,37.37119565186458,44.587586027958096,51.74656051939534,57.790287702589886,5201,51.07097808754774,36.67967659212947,44.30961700664472,51.710953000123375,58.61375768552169,64.35825044963545,13.944937887600723,6.990085938764234,10.019933967044906,13.824034718075643,17.676844518046806,21.04284772386968 +2,2021.0,2,6.657157614619,3.9182854178622737,5.241671091889814,6.734349607962663,8.193423030523004,9.49907670738414,Male,4078.8049978223776,33179.273551261096,46.88179038815436,33.95801530547186,40.18265752644181,47.10757828233879,53.7389213705499,59.832392960034284,4984,51.70070626542735,38.66872891633799,45.27327488441025,52.143815860572644,58.6172123807197,64.26907799896426,12.342281263956684,5.25333979351767,8.69566156338442,12.152905215940784,15.954811701066731,19.431618027815112 +2,2021.0,3,6.434823721179303,3.6304954156760614,5.006471773535255,6.53950940822727,7.95171628270851,9.244363122571073,Female,4091.9378561561552,33467.518173853554,44.497678273795216,31.152780389457796,37.37119565186458,44.587586027958096,51.74656051939534,57.790287702589886,5201,51.07097808754774,36.67967659212947,44.30961700664472,51.710953000123375,58.61375768552169,64.35825044963545,13.944937887600723,6.990085938764234,10.019933967044906,13.824034718075643,17.676844518046806,21.04284772386968 2,2022.0,1,6.422530301228616,3.567045021723244,5.018949307494145,6.5006126900173165,7.968163955817291,9.36005244409676,Total,8069.978544968903,65516.23160283311,45.39006629988342,32.13476815782205,38.485497090286245,45.43250946903605,52.36685903564573,58.658397454827714,10201,50.816144262451935,36.92588711180947,43.967963308102156,51.12902979554389,58.13982139115227,64.38654372823234,13.102582115937842,5.972624565972184,9.359476981473925,12.974736708970008,16.75451833313364,20.322167717340353 -2,2022.0,1,6.501507587713831,3.6871914122693825,5.102129857087533,6.5712483891632445,8.063766482550893,9.411801933240216,Male,4031.9488916075647,32468.528893042872,46.424855013441565,33.09232617331043,39.443339949434446,46.42731238817039,53.353545563711705,59.791645448759056,4994,51.327451881364965,37.808682839109395,44.68437318998229,51.63989404620108,58.35449264113929,64.5550790330754,12.363495262825747,5.3868137004586245,8.712696243693003,12.275061895645393,15.887417721041539,19.58237169617407 -2,2022.0,1,6.346783696906115,3.476421024953447,4.9610548905438465,6.424417563296172,7.878961120312511,9.25776431775805,Female,4038.0296533613423,33047.702709790145,44.39760714192097,31.008895421922286,37.57002955098009,44.41981942832151,51.372739832757176,57.574655909529824,5207,50.32575243436401,35.79914602648014,43.3369846264226,50.62236595608817,57.971243311547525,64.2449987903387,13.811435533345538,6.610256942038325,10.03501268667642,13.757555933616562,17.46888711595809,20.976262367027243 \ No newline at end of file +2,2022.0,2,6.501507587713831,3.6871914122693825,5.102129857087533,6.5712483891632445,8.063766482550893,9.411801933240216,Male,4031.9488916075647,32468.528893042872,46.424855013441565,33.09232617331043,39.443339949434446,46.42731238817039,53.353545563711705,59.791645448759056,4994,51.327451881364965,37.808682839109395,44.68437318998229,51.63989404620108,58.35449264113929,64.5550790330754,12.363495262825747,5.3868137004586245,8.712696243693003,12.275061895645393,15.887417721041539,19.58237169617407 +2,2022.0,3,6.346783696906115,3.476421024953447,4.9610548905438465,6.424417563296172,7.878961120312511,9.25776431775805,Female,4038.0296533613423,33047.702709790145,44.39760714192097,31.008895421922286,37.57002955098009,44.41981942832151,51.372739832757176,57.574655909529824,5207,50.32575243436401,35.79914602648014,43.3369846264226,50.62236595608817,57.971243311547525,64.2449987903387,13.811435533345538,6.610256942038325,10.03501268667642,13.757555933616562,17.46888711595809,20.976262367027243 \ No newline at end of file