From 21d2181ac49ecfcfe4841a29a1a5f1eee0295739 Mon Sep 17 00:00:00 2001 From: Andy Baxter Date: Mon, 17 Mar 2025 14:05:33 +0000 Subject: [PATCH 01/28] Person EQ5D column added --- src/main/java/simpaths/model/Person.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main/java/simpaths/model/Person.java b/src/main/java/simpaths/model/Person.java index 1a88bcba0..a08177d2a 100644 --- a/src/main/java/simpaths/model/Person.java +++ b/src/main/java/simpaths/model/Person.java @@ -135,6 +135,9 @@ public class Person implements EventListener, IDoubleSource, IIntSource, Weight, private Integer dls; //life satisfaction - score 1-7 @Transient private Double dls_temp; @Transient private Integer dls_lag1; //life satisfaction - score 1-7 lag 1 + @Column(name="deq5d") + private Double deq5d; + @Column(name="dhh_owned") private Boolean dhhOwned; // Person is a homeowner, true / false @Transient private Boolean receivesBenefitsFlag_L1; // Lag(1) of whether person receives benefits @Transient private Boolean receivesBenefitsFlag; // Does person receive benefits @@ -5122,4 +5125,12 @@ public Long getIdFather() { public boolean getToBePartnered() {return toBePartnered;} public static void setPersonIdCounter(long id) {personIdCounter=id;} + + public Double getDeq5d() { + return deq5d; + } + + public void setDeq5d(Double deq5d) { + this.deq5d = deq5d; + } } From e83cd2a8b23ed95b7bdc2cdb7fe2bbed81548729 Mon Sep 17 00:00:00 2001 From: Andy Baxter Date: Mon, 17 Mar 2025 14:09:33 +0000 Subject: [PATCH 02/28] EQ5D enum added --- src/main/java/simpaths/model/Person.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/simpaths/model/Person.java b/src/main/java/simpaths/model/Person.java index a08177d2a..002fb9fcf 100644 --- a/src/main/java/simpaths/model/Person.java +++ b/src/main/java/simpaths/model/Person.java @@ -2256,6 +2256,7 @@ public enum DoublesVariables { Dehmf_c3_Low, Dehsp_c3_Low_L1, //Partner's education == Low at lag(1) Dehsp_c3_Medium_L1, //Partner's education == Medium at lag(1) + Deq5d, //EQ5D quality of life score Dgn, //Gender: returns 1 if male Dgn_baseline, Dgn_Dag, @@ -2936,6 +2937,9 @@ public double getDoubleValue(Enum variableID) { case Dehsp_c3_Low_L1 -> { return (Education.Low.equals(dehsp_c3_lag1)) ? 1. : 0.; } + case Deq5d -> { + return getDeq5d(); + } case Dhhtp_c4_CoupleChildren_L1 -> { return (Dhhtp_c4.CoupleChildren.equals(getDhhtp_c4_lag1())) ? 1.0 : 0.0; } From d2ea2f917709563b8a4fcf7c01a2ffff62c0654d Mon Sep 17 00:00:00 2001 From: Andy Baxter Date: Mon, 17 Mar 2025 14:13:54 +0000 Subject: [PATCH 03/28] Added polynomials and interactions for pcs and mcs --- src/main/java/simpaths/model/Person.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/main/java/simpaths/model/Person.java b/src/main/java/simpaths/model/Person.java index 002fb9fcf..2ccec7239 100644 --- a/src/main/java/simpaths/model/Person.java +++ b/src/main/java/simpaths/model/Person.java @@ -2298,8 +2298,12 @@ public enum DoublesVariables { Dls_L1, //Life satisfaction status lag(1) Dhe_mcs, //Mental well-being status Dhe_mcs_L1, //Mental well-being status lag(1) + Dhe_mcs_sq, //MCS score squared + Dhe_mcs_times_pcs, //MCS times PCS Dhe_pcs, //Physical well-being status Dhe_pcs_L1, //Physical well-being status lag(1) + Dhe_pcs_sq, //PCS score squared + Dhe_pcs_cb, //PCS score cubed Dhmghq_L1, Dlltsd, //Long-term sick or disabled Dlltsd_L1, //Long-term sick or disabled lag(1) @@ -2864,6 +2868,12 @@ public double getDoubleValue(Enum variableID) { return dhe_mcs_lag1; } else return 0.; } + case Dhe_mcs_sq -> { + return dhe_mcs * dhe_mcs; + } + case Dhe_mcs_times_pcs -> { + return dhe_mcs * dhe_pcs; + } case Dhe_pcs -> { return dhe_pcs; } @@ -2872,6 +2882,12 @@ public double getDoubleValue(Enum variableID) { return dhe_pcs_lag1; } else return 0.; } + case Dhe_pcs_sq -> { + return dhe_pcs * dhe_pcs; + } + case Dhe_pcs_cb -> { + return dhe_pcs * dhe_pcs * dhe_pcs; + } case Dls -> { return dls; } From 6d89d8a4b31e485c180f2e0dfc9acc4f104f7825 Mon Sep 17 00:00:00 2001 From: Andy Baxter Date: Mon, 17 Mar 2025 14:36:13 +0000 Subject: [PATCH 04/28] eq5d coefficient excel sheet --- input/reg_eq5d.xlsx | Bin 0 -> 9423 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 input/reg_eq5d.xlsx diff --git a/input/reg_eq5d.xlsx b/input/reg_eq5d.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..13d991c9139986e44d517ec97d5e51e14fa70e62 GIT binary patch literal 9423 zcmeHt^;;a<()C~gf?IHB2o~He5Fp6l79>D$4THNAB)ASv@Idh3I=H(82=0X79`u{! zp8KA2a_;vR+}ra!-9JpP+TD9s)vCR!l|cxI_<%_@rVS#0CbDW@&(A`?^k5Zpl?~xe^i!f+wPW>lt5r zHF1`E8qh!K6bkgsx34H_F5&PG6is5UkK;{QSu%R+pRPZXMGU9$TzKN5pRY`VSz^fUEBU>dl1c)6OaVS0`}*to+m!Z=$-Ha}#*sG=rLG?EFL1s!p0>Tf?r)=}^A6cx z>H8++xi_|{8+dRG`R2=c{|Eqhct8Ls|1B(QG}vj+V7?{~i#jw|SQJDlXGRt?uI|yMR>_nM+5y2z^S1txgh% zAnn`Yb2~7*)lM}4uzT@sFqFGO4GS{j^mZSRcCMDGB3XR+aPIe9Eui9O2tiUbuepDg%^NQ%EskAn7+(N!7T^b589(%_0ZzO3E& z(KO!~NWnLZ=b-}fdlM-HeU3)vb7fwAHq_@oNHo+e1S~6zG93hI+zm`@+D;|Ypm=v) z&lJ=9RB52n@FV$y+5FZ^60z*!MmYcgS6?ghRRj9z8fXJ?H&TNoMmRMXDPC zYFB~uu7HXFyrb@0ka7QQZ^l4z=C$yW<9#8V*rdX_>Hsfy1S^}RLL=VN#3L4F zRx27qMv90sf&_d$*`gBWPELiTJes-gVU1ya(DynuD&-l=wz2 z99nU8#9!r=Z@|A3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+>3Y560R8FqIAf_ Date: Mon, 17 Mar 2025 17:02:15 +0000 Subject: [PATCH 05/28] add enum and prediction call in person --- src/main/java/simpaths/model/Person.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main/java/simpaths/model/Person.java b/src/main/java/simpaths/model/Person.java index 2ccec7239..0fb52e809 100644 --- a/src/main/java/simpaths/model/Person.java +++ b/src/main/java/simpaths/model/Person.java @@ -679,6 +679,7 @@ public enum Processes { HealthPCS2, LifeSatisfaction1, LifeSatisfaction2, + QolEQ5D, InSchool, LeavingSchool, PartnershipDissolution, @@ -759,6 +760,9 @@ public void onEvent(Enum type) { case HealthMentalHM1HM2Cases -> { healthMentalHM1HM2Cases(); } + case QolEQ5D -> { + qolEQ5D(); + } case InSchool -> { // log.debug("In Education for person " + this.getKey().getId()); inSchool(); @@ -1033,6 +1037,14 @@ protected void lifeSatisfaction2() { } } + protected void qolEQ5D() { + + double eq5dPrediction; + eq5dPrediction = Parameters.getRegEQ5D().getScore(this, Person.DoublesVariables.class); + deq5d = eq5dPrediction > 1 ? 1.0 : eq5dPrediction; + + } + /* Case-based measure of psychological distress, Steps 1 and 2 modelled together */ From 5001f248ccc2b7c0ce85744b560aa5e362060816 Mon Sep 17 00:00:00 2001 From: Andy Baxter Date: Mon, 17 Mar 2025 17:03:00 +0000 Subject: [PATCH 06/28] add regression processes --- src/main/java/simpaths/data/ManagerRegressions.java | 3 +++ src/main/java/simpaths/data/Parameters.java | 11 +++++++++++ src/main/java/simpaths/data/RegressionName.java | 2 ++ 3 files changed, 16 insertions(+) diff --git a/src/main/java/simpaths/data/ManagerRegressions.java b/src/main/java/simpaths/data/ManagerRegressions.java index 327ca403d..b0ee9ee3e 100644 --- a/src/main/java/simpaths/data/ManagerRegressions.java +++ b/src/main/java/simpaths/data/ManagerRegressions.java @@ -64,6 +64,9 @@ public static LinearRegression getLinearRegression(RegressionName regression) { case LifeSatisfaction2Females -> { return Parameters.getRegLifeSatisfaction2Females(); } + case HealthEQ5D -> { + return Parameters.getRegEQ5D(); + } case SocialCareS1b -> { return Parameters.getRegCareHoursS1b(); } diff --git a/src/main/java/simpaths/data/Parameters.java b/src/main/java/simpaths/data/Parameters.java index 0cf1db62c..06930218f 100644 --- a/src/main/java/simpaths/data/Parameters.java +++ b/src/main/java/simpaths/data/Parameters.java @@ -472,6 +472,7 @@ else if(numberOfChildren <= 5) { private static MultiKeyCoefficientMap coeffCovarianceDLS2Males; private static MultiKeyCoefficientMap coeffCovarianceDLS2Females; + private static MultiKeyCoefficientMap coeffCovarianceEQ5D; //Education private static MultiKeyCoefficientMap coeffCovarianceEducationE1a; @@ -707,6 +708,8 @@ else if(numberOfChildren <= 5) { private static LinearRegression regLifeSatisfaction2Males; private static LinearRegression regLifeSatisfaction2Females; + private static LinearRegression regHealthEQ5D; + //Education private static BinomialRegression regEducationE1a; private static BinomialRegression regEducationE1b; @@ -972,6 +975,7 @@ public static void loadParameters(Country country, int maxAgeModel, boolean enab int columnsLifeSatisfaction1 = -1; int columnsLifeSatisfaction2Males = -1; int columnsLifeSatisfaction2Females = -1; + int columnsHealthEQ5D = -1; int columnsSocialCareS1a = -1; int columnsSocialCareS1b = -1; int columnsSocialCareS2a = -1; @@ -1132,6 +1136,7 @@ else if(country.equals(Country.UK)) { columnsLifeSatisfaction1 = 30; columnsLifeSatisfaction2Males = 9; columnsLifeSatisfaction2Females = 9; + columnsHealthEQ5D = 8; columnsSocialCareS1a = 17; columnsSocialCareS1b = 18; columnsSocialCareS2a = 32; @@ -1351,6 +1356,8 @@ else if(country.equals(Country.UK)) { coeffCovarianceDLS2Males = ExcelAssistant.loadCoefficientMap("input/reg_health_wellbeing.xlsx", countryString + "_DLS2_Males", 1, columnsLifeSatisfaction2Males); coeffCovarianceDLS2Females = ExcelAssistant.loadCoefficientMap("input/reg_health_wellbeing.xlsx", countryString + "_DLS2_Females", 1, columnsLifeSatisfaction2Females); + coeffCovarianceEQ5D = ExcelAssistant.loadCoefficientMap("input/reg_eq5d.xlsx", countryString + "_EQ5D", 1, columnsHealthEQ5D); + //Life satisfaction // coeffCovarianceDLS1 = ExcelAssistant.loadCoefficientMap("input/reg_lifesatisfaction.xlsx", countryString + "_DLS1", 1, columnsLifeSatisfaction1); @@ -1570,6 +1577,8 @@ else if (country.equals(Country.IT)) { regLifeSatisfaction2Males = new LinearRegression(coeffCovarianceDLS2Males); regLifeSatisfaction2Females = new LinearRegression(coeffCovarianceDLS2Females); + regHealthEQ5D = new LinearRegression(coeffCovarianceEQ5D); + //Education regEducationE1a = new BinomialRegression(RegressionType.Probit, Indicator.class, coeffCovarianceEducationE1a); regEducationE1b = new BinomialRegression(RegressionType.Probit, Indicator.class, coeffCovarianceEducationE1b); @@ -2075,6 +2084,8 @@ public static void setEmploymentsFurloughedFlex(MultiKeyCoefficientMap employmen public static BinomialRegression getRegEducationE1b() {return regEducationE1b;} public static OrderedRegression getRegEducationE2a() {return regEducationE2a;} + public static LinearRegression getRegEQ5D() { return regHealthEQ5D; }; + public static BinomialRegression getRegPartnershipU1a() {return regPartnershipU1a;} public static BinomialRegression getRegPartnershipU1b() {return regPartnershipU1b;} public static BinomialRegression getRegPartnershipU2b() {return regPartnershipU2b;} diff --git a/src/main/java/simpaths/data/RegressionName.java b/src/main/java/simpaths/data/RegressionName.java index 07b9e2a1d..3d1605086 100644 --- a/src/main/java/simpaths/data/RegressionName.java +++ b/src/main/java/simpaths/data/RegressionName.java @@ -41,6 +41,8 @@ public enum RegressionName { LifeSatisfaction2Males(RegressionType.Linear), LifeSatisfaction2Females(RegressionType.Linear), + HealthEQ5D(RegressionType.Linear), + RMSE(RegressionType.Linear), SocialCareS1a(RegressionType.Probit), From dc9b52006cf574a9d3923cc571321696e01f38f7 Mon Sep 17 00:00:00 2001 From: Andy Baxter Date: Mon, 17 Mar 2025 17:03:12 +0000 Subject: [PATCH 07/28] corrected spelling in excel --- input/reg_eq5d.xlsx | Bin 9423 -> 9424 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/input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XoY3Afa*@ExoT(#+)cYbJsI9RJc+YtGUNdyJdf_ zw!rf?NGleH;gD%AE7}oK`v}7ng%q$fVy~g{9mIm-9`kpltlgES#UnV)?QUNO!sr?i z8>yr}w@^y7NY~rSSiVtM_bE!aASa7gjCcPk)6U;1X(_C6rtm!^vo7cR@+WMwgFnCCtJ>HVu43#UD#48r)d%8?1l-LD=vHYkrqa_cG7uzvso`C0wp1!E(`$gQWjF z2*%5K5+q5OjKi1VC`#t9bT-W;cDSjESST_&kJ9y+ve~rt&uI_?oA4Eiq1mRLGCPoUa3lcd}wsG0m>#^MAXz#8_}h^@=#y4-Fzwb5dYKEjhw zY|5%y7wht6_gi}Eu?a1o!{c9EL^@t57up*>T=4%#5g(A7b75(5_iju%ZuvkV<30e@dh!!Q)Z-vz%z$$Oi2-Be23;gmf&5S%E!h2*XaHh)N>UBA6) zyVZ{QAmkmLl*wQ@+Vk7U6Ufd}oh=21}Q(;Z$C#e9>;`jy& zaD)*@a0d+aNJK{@qa#v(nYsrsilGJp(pj8D3I6puFv9-%pjReN!CkBUOvkuWHlu?$ zx(}9*#-?eaChcSR{0V;FJiYXzhFo^LqJYYr(To}(PMPvvvNl+egYTc?Nxj=)O|0Aa zb?-Q^ReNr|ls-MRA7VfQ3w*3>7~-V7r4NtWH7aNEY!Sw3nA~oYdFD?%|LD4(z3*ZU z1#!&qZ(_R07U_g|0+czv_!{L8lc5Y1vxFZ&0|f(Qd*q9g$s$q#bdww-EgKq(Q|>SX z0065E000;O000000000000000r;}tOMF9s000yK r000000000000000=aVKRCj|zM7fnTzQY2IXb(5zgBL+Dl00000E8Xt# From 3456e7ef92463e2f43b3416df92e3f5e23f1c581 Mon Sep 17 00:00:00 2001 From: Andy Baxter Date: Mon, 17 Mar 2025 17:06:53 +0000 Subject: [PATCH 08/28] add update eq5d --- src/main/java/simpaths/model/SimPathsModel.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/simpaths/model/SimPathsModel.java b/src/main/java/simpaths/model/SimPathsModel.java index 45b550267..5894ff0c0 100644 --- a/src/main/java/simpaths/model/SimPathsModel.java +++ b/src/main/java/simpaths/model/SimPathsModel.java @@ -588,6 +588,8 @@ public void buildSchedule() { yearlySchedule.addCollectionEvent(persons, Person.Processes.HealthPCS2); yearlySchedule.addCollectionEvent(persons, Person.Processes.LifeSatisfaction2); + addCollectionEventToAllYears(persons, Person.Processes.QolEQ5D); + // mortality (migration) and population alignment at year's end addCollectionEventToAllYears(persons, Person.Processes.ConsiderMortality); addEventToAllYears(Processes.PopulationAlignment); From c8ff3e4ad9dd7b9585ffe34533f6b1f6e5e2fba9 Mon Sep 17 00:00:00 2001 From: Andy Baxter Date: Mon, 17 Mar 2025 17:26:43 +0000 Subject: [PATCH 09/28] add lower bound to eq5d score --- src/main/java/simpaths/model/Person.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/simpaths/model/Person.java b/src/main/java/simpaths/model/Person.java index 0fb52e809..501572d32 100644 --- a/src/main/java/simpaths/model/Person.java +++ b/src/main/java/simpaths/model/Person.java @@ -1041,7 +1041,15 @@ protected void qolEQ5D() { double eq5dPrediction; eq5dPrediction = Parameters.getRegEQ5D().getScore(this, Person.DoublesVariables.class); - deq5d = eq5dPrediction > 1 ? 1.0 : eq5dPrediction; + if (eq5dPrediction > 1) { + deq5d = 1.0; + } + else if (eq5dPrediction < -0.594) { + deq5d = -0.594; + } + else { + deq5d = eq5dPrediction; + } } From c359970a8951fa1ea2a4c79643a612d4c86150ce Mon Sep 17 00:00:00 2001 From: Andy Baxter Date: Tue, 18 Mar 2025 10:23:26 +0000 Subject: [PATCH 10/28] add some (failing) person tests --- src/main/java/simpaths/model/Person.java | 11 ++++++- src/test/java/simpaths/model/PersonTest.java | 30 ++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 src/test/java/simpaths/model/PersonTest.java diff --git a/src/main/java/simpaths/model/Person.java b/src/main/java/simpaths/model/Person.java index 501572d32..35591b930 100644 --- a/src/main/java/simpaths/model/Person.java +++ b/src/main/java/simpaths/model/Person.java @@ -851,7 +851,7 @@ private void updateUnemploymentState() { //******************************************************** // method to adjust for one year increment //******************************************************** - private void aging() { + void aging() { // iterate years in cohabiting partnership Person partner = getPartner(); @@ -4153,6 +4153,15 @@ public double getDhe_pcs() { return val; } + + public void setDhe_mcs(Double dhe_mcs) { + this.dhe_mcs = dhe_mcs; + } + + public void setDhe_pcs(Double dhe_pcs) { + this.dhe_pcs = dhe_pcs; + } + public void populateSocialCareReceipt(SocialCareReceiptState state) { if (SocialCareReceiptState.NoFormal.equals(state)) { needSocialCare = Indicator.True; diff --git a/src/test/java/simpaths/model/PersonTest.java b/src/test/java/simpaths/model/PersonTest.java new file mode 100644 index 000000000..6c11607bd --- /dev/null +++ b/src/test/java/simpaths/model/PersonTest.java @@ -0,0 +1,30 @@ +package simpaths.model; + +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.*; + +public class PersonTest { + + Person testPerson = new Person(true); + + @Test + public void agePerson() { + testPerson.setDag(25); + testPerson.aging(); + assertEquals(26, testPerson.getDag()); + } + + @Test + public void calculateEQ5D() { + + testPerson.setDhe_mcs(1.); + testPerson.setDhe_pcs(1.); + + testPerson.qolEQ5D(); + + assertEquals(1.0, testPerson.getDeq5d()); + + } + +} From fe728b817e0d1e7ed885d25b24425510a90eef2c Mon Sep 17 00:00:00 2001 From: Andy Baxter Date: Tue, 18 Mar 2025 11:26:09 +0000 Subject: [PATCH 11/28] Further testing for person eq5d - correct calcs --- src/test/java/simpaths/model/PersonTest.java | 46 +++++++++++++++----- 1 file changed, 35 insertions(+), 11 deletions(-) diff --git a/src/test/java/simpaths/model/PersonTest.java b/src/test/java/simpaths/model/PersonTest.java index 6c11607bd..f811fdd87 100644 --- a/src/test/java/simpaths/model/PersonTest.java +++ b/src/test/java/simpaths/model/PersonTest.java @@ -1,30 +1,54 @@ package simpaths.model; import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.Nested; +import simpaths.data.Parameters; +import simpaths.model.enums.Country; + import static org.junit.jupiter.api.Assertions.*; +@DisplayName("Testing methods on a Person in absence of a Model") public class PersonTest { Person testPerson = new Person(true); - @Test - public void agePerson() { - testPerson.setDag(25); - testPerson.aging(); - assertEquals(26, testPerson.getDag()); + @BeforeAll + static void setupParams() { + Parameters.loadParameters(Country.UK, 100, false, false, false, false, false, false, false, 2020, 2020, 2020, 1.,1., false, false); } - @Test - public void calculateEQ5D() { + @Nested + @DisplayName("Testing EQ5D calculations") + class Eq5dTests { + + @Test + public void calculateEQ5Dlow() { + + + testPerson.setDhe_mcs(1.); + testPerson.setDhe_pcs(1.); + + testPerson.qolEQ5D(); - testPerson.setDhe_mcs(1.); - testPerson.setDhe_pcs(1.); + assertEquals(-0.594, testPerson.getDeq5d()); - testPerson.qolEQ5D(); + } + @Test + public void calculateEQ5Dhigh() { - assertEquals(1.0, testPerson.getDeq5d()); + + testPerson.setDhe_mcs(100.); + testPerson.setDhe_pcs(100.); + + testPerson.qolEQ5D(); + + assertEquals(1, testPerson.getDeq5d()); + + } } + } From 0726f149f11d418751f9cab5ba22be27c61c8e08 Mon Sep 17 00:00:00 2001 From: Andy Baxter Date: Tue, 18 Mar 2025 12:28:38 +0000 Subject: [PATCH 12/28] adding franks coefficients option --- input/reg_eq5d.xlsx | Bin 9424 -> 10546 bytes src/main/java/simpaths/data/Parameters.java | 4 +++- src/main/java/simpaths/model/Person.java | 20 ++++++++++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/input/reg_eq5d.xlsx b/input/reg_eq5d.xlsx index 510ff79b00e7c1eb416d3089df238851d2470144..744768a8337af66e7df3bf8aa5777431f9d4af5f 100644 GIT binary patch delta 4776 zcmZvgbyQSc+r|fm?v$7rq`PY<31R5&ZV;qFX&9wJkQllV1|)?+KthllLItE0B$bj9 z5fBEM7oY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#;B0g>(TTxnMvVQevZgmu4nBUwPuzO^pKE>^kj8e}_f^bUW;u6Qvq{>(N5=d@2V%)1`y`cf&sxuTh1l2BCh;l4Bygi$eqX*e zc?*Um;tff3*}|N28WO17$VxjI2eB!LylHT~6Cj|VFG*5tm1T0kE^zcqwJW3}P21wV z-WvvLdgfNq8q&Hi-4}azgenXyZCo=&-`7vcWoqCkD1IL9yqCNF@S%D=&P6hm*}H7L zMjztBWQ3|HQxAQ!J}AF{-b$+zqI^&HQ9Ieac)iFGb_eM@1|E=C z+3ozGQ`-1_a31@-+e`)y_xCy~T!8xISU)?pM9ImYv EUROMODpolicySchedule = new TreeMap(); @@ -1356,7 +1358,7 @@ else if(country.equals(Country.UK)) { coeffCovarianceDLS2Males = ExcelAssistant.loadCoefficientMap("input/reg_health_wellbeing.xlsx", countryString + "_DLS2_Males", 1, columnsLifeSatisfaction2Males); coeffCovarianceDLS2Females = ExcelAssistant.loadCoefficientMap("input/reg_health_wellbeing.xlsx", countryString + "_DLS2_Females", 1, columnsLifeSatisfaction2Females); - coeffCovarianceEQ5D = ExcelAssistant.loadCoefficientMap("input/reg_eq5d.xlsx", countryString + "_EQ5D", 1, columnsHealthEQ5D); + coeffCovarianceEQ5D = ExcelAssistant.loadCoefficientMap("input/reg_eq5d.xlsx", countryString + "_EQ5D_" + eq5dConversionParameters, 1, columnsHealthEQ5D); //Life satisfaction diff --git a/src/main/java/simpaths/model/Person.java b/src/main/java/simpaths/model/Person.java index 35591b930..c59784ad9 100644 --- a/src/main/java/simpaths/model/Person.java +++ b/src/main/java/simpaths/model/Person.java @@ -2320,10 +2320,15 @@ public enum DoublesVariables { Dhe_mcs_L1, //Mental well-being status lag(1) Dhe_mcs_sq, //MCS score squared Dhe_mcs_times_pcs, //MCS times PCS + Dhe_mcs_c_times_pcs_c, //Centralised MCS times PCS + Dhe_mcs_c, //MCS centralised by subtracting population mean + Dhe_mcs_c_sq, //Square of centralised MCS Dhe_pcs, //Physical well-being status Dhe_pcs_L1, //Physical well-being status lag(1) Dhe_pcs_sq, //PCS score squared Dhe_pcs_cb, //PCS score cubed + Dhe_pcs_c, //MCS centralised by subtracting population mean + Dhe_pcs_c_sq, //Square of centralised MCS Dhmghq_L1, Dlltsd, //Long-term sick or disabled Dlltsd_L1, //Long-term sick or disabled lag(1) @@ -2891,9 +2896,18 @@ public double getDoubleValue(Enum variableID) { case Dhe_mcs_sq -> { return dhe_mcs * dhe_mcs; } + case Dhe_mcs_c -> { + return dhe_mcs - 51.5; + } + case Dhe_mcs_c_sq -> { + return Math.pow(dhe_mcs - 51.5, 2); + } case Dhe_mcs_times_pcs -> { return dhe_mcs * dhe_pcs; } + case Dhe_mcs_c_times_pcs_c -> { + return (dhe_mcs - 51.5) * (dhe_pcs - 49.9); + } case Dhe_pcs -> { return dhe_pcs; } @@ -2908,6 +2922,12 @@ public double getDoubleValue(Enum variableID) { case Dhe_pcs_cb -> { return dhe_pcs * dhe_pcs * dhe_pcs; } + case Dhe_pcs_c -> { + return dhe_pcs - 49.9; + } + case Dhe_pcs_c_sq -> { + return Math.pow(dhe_pcs - 49.9, 2); + } case Dls -> { return dls; } From 35a6dad3f86a7ac61c3f1d4bdc6494b7d4fcda45 Mon Sep 17 00:00:00 2001 From: Andy Baxter Date: Tue, 18 Mar 2025 12:28:56 +0000 Subject: [PATCH 13/28] updated tests (running in wrong order) --- src/test/java/simpaths/model/PersonTest.java | 83 +++++++++++++++----- 1 file changed, 64 insertions(+), 19 deletions(-) diff --git a/src/test/java/simpaths/model/PersonTest.java b/src/test/java/simpaths/model/PersonTest.java index f811fdd87..1e312ed8a 100644 --- a/src/test/java/simpaths/model/PersonTest.java +++ b/src/test/java/simpaths/model/PersonTest.java @@ -1,15 +1,12 @@ package simpaths.model; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.*; import simpaths.data.Parameters; import simpaths.model.enums.Country; import static org.junit.jupiter.api.Assertions.*; -@DisplayName("Testing methods on a Person in absence of a Model") +@DisplayName("Person methods in absence of a Model") public class PersonTest { Person testPerson = new Person(true); @@ -20,34 +17,82 @@ static void setupParams() { } @Nested - @DisplayName("Testing EQ5D calculations") + @DisplayName("EQ5D calculations") + @TestMethodOrder(MethodOrderer.DisplayName.class) class Eq5dTests { - @Test - public void calculateEQ5Dlow() { + @Nested + @DisplayName("1. Lawrence and Fleishman coefficients") + class LawrenceCoefficients { + @Test + public void calculateEQ5Dlow() { - testPerson.setDhe_mcs(1.); - testPerson.setDhe_pcs(1.); - testPerson.qolEQ5D(); + testPerson.setDhe_mcs(1.); + testPerson.setDhe_pcs(1.); - assertEquals(-0.594, testPerson.getDeq5d()); + testPerson.qolEQ5D(); - } - @Test - public void calculateEQ5Dhigh() { + assertEquals(-0.594, testPerson.getDeq5d()); + + } + + @Test + public void calculateEQ5Dhigh() { - testPerson.setDhe_mcs(100.); - testPerson.setDhe_pcs(100.); + testPerson.setDhe_mcs(100.); + testPerson.setDhe_pcs(100.); - testPerson.qolEQ5D(); + testPerson.qolEQ5D(); - assertEquals(1, testPerson.getDeq5d()); + assertEquals(1, testPerson.getDeq5d()); + + } } + + @Nested + @DisplayName("2. Franks coefficients") + class FranksCoefficients { + + @BeforeAll + public static void setupFranksCoefficients() { + + Parameters.eq5dConversionParameters = "franks"; + + Parameters.loadParameters(Country.UK, 100, false, false, false, false, false, false, false, 2020, 2020, 2020, 1.,1., false, false); + + } + + @Test + public void calculateEQ5Dlow(){ + + testPerson.setDhe_mcs(1.); + testPerson.setDhe_pcs(1.); + + testPerson.qolEQ5D(); + + assertEquals(-0.594, testPerson.getDeq5d()); + + } + + @Test + public void calculateEQ5Dhigh(){ + + testPerson.setDhe_mcs(100.); + testPerson.setDhe_pcs(100.); + + testPerson.qolEQ5D(); + + // The maximum possible value given by the Franks coefficients + assertEquals(0.9035601, testPerson.getDeq5d()); + + } + + } } From 28519b0744ca43e78af25d45e8ece5769eb2dda7 Mon Sep 17 00:00:00 2001 From: Andy Baxter Date: Tue, 18 Mar 2025 12:30:39 +0000 Subject: [PATCH 14/28] correct order for EQ5D tests --- src/test/java/simpaths/model/PersonTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/simpaths/model/PersonTest.java b/src/test/java/simpaths/model/PersonTest.java index 1e312ed8a..893dd31fb 100644 --- a/src/test/java/simpaths/model/PersonTest.java +++ b/src/test/java/simpaths/model/PersonTest.java @@ -18,7 +18,7 @@ static void setupParams() { @Nested @DisplayName("EQ5D calculations") - @TestMethodOrder(MethodOrderer.DisplayName.class) + @TestClassOrder(ClassOrderer.DisplayName.class) class Eq5dTests { @Nested From 90e458bc413895716a984713b46268d99689113e Mon Sep 17 00:00:00 2001 From: Andy Baxter Date: Tue, 18 Mar 2025 13:09:18 +0000 Subject: [PATCH 15/28] EQ5D tests trigger events rather than call update methods directly --- src/test/java/simpaths/model/PersonTest.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/test/java/simpaths/model/PersonTest.java b/src/test/java/simpaths/model/PersonTest.java index 893dd31fb..9d8d35f14 100644 --- a/src/test/java/simpaths/model/PersonTest.java +++ b/src/test/java/simpaths/model/PersonTest.java @@ -32,7 +32,7 @@ public void calculateEQ5Dlow() { testPerson.setDhe_mcs(1.); testPerson.setDhe_pcs(1.); - testPerson.qolEQ5D(); + testPerson.onEvent(Person.Processes.QolEQ5D); assertEquals(-0.594, testPerson.getDeq5d()); @@ -45,7 +45,7 @@ public void calculateEQ5Dhigh() { testPerson.setDhe_mcs(100.); testPerson.setDhe_pcs(100.); - testPerson.qolEQ5D(); + testPerson.onEvent(Person.Processes.QolEQ5D); assertEquals(1, testPerson.getDeq5d()); @@ -73,7 +73,7 @@ public void calculateEQ5Dlow(){ testPerson.setDhe_mcs(1.); testPerson.setDhe_pcs(1.); - testPerson.qolEQ5D(); + testPerson.onEvent(Person.Processes.QolEQ5D); assertEquals(-0.594, testPerson.getDeq5d()); @@ -85,7 +85,7 @@ public void calculateEQ5Dhigh(){ testPerson.setDhe_mcs(100.); testPerson.setDhe_pcs(100.); - testPerson.qolEQ5D(); + testPerson.onEvent(Person.Processes.QolEQ5D); // The maximum possible value given by the Franks coefficients assertEquals(0.9035601, testPerson.getDeq5d()); From 9af6fe0b15c72646508211b3cf8e3a1f373cd012 Mon Sep 17 00:00:00 2001 From: Andy Baxter Date: Tue, 18 Mar 2025 13:55:03 +0000 Subject: [PATCH 16/28] refactored `deq5d` to `he_eq5d` and similar --- src/main/java/simpaths/model/Person.java | 32 +++++++++---------- .../java/simpaths/model/SimPathsModel.java | 2 +- src/test/java/simpaths/model/PersonTest.java | 16 +++++----- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/main/java/simpaths/model/Person.java b/src/main/java/simpaths/model/Person.java index c59784ad9..28a8c196e 100644 --- a/src/main/java/simpaths/model/Person.java +++ b/src/main/java/simpaths/model/Person.java @@ -135,8 +135,8 @@ public class Person implements EventListener, IDoubleSource, IIntSource, Weight, private Integer dls; //life satisfaction - score 1-7 @Transient private Double dls_temp; @Transient private Integer dls_lag1; //life satisfaction - score 1-7 lag 1 - @Column(name="deq5d") - private Double deq5d; + @Column(name="he_eq5d") + private Double he_eq5d; @Column(name="dhh_owned") private Boolean dhhOwned; // Person is a homeowner, true / false @Transient private Boolean receivesBenefitsFlag_L1; // Lag(1) of whether person receives benefits @@ -670,6 +670,7 @@ public enum Processes { Fertility, GiveBirth, Health, + HealthEQ5D, HealthMentalHM1, //Predict level of mental health on the GHQ-12 Likert scale (Step 1) HealthMentalHM2, //Modify the prediction from Step 1 by applying increments / decrements for exposure HealthMentalHM1HM2Cases, //Case-based prediction for psychological distress, Steps 1 and 2 together @@ -679,7 +680,6 @@ public enum Processes { HealthPCS2, LifeSatisfaction1, LifeSatisfaction2, - QolEQ5D, InSchool, LeavingSchool, PartnershipDissolution, @@ -760,8 +760,8 @@ public void onEvent(Enum type) { case HealthMentalHM1HM2Cases -> { healthMentalHM1HM2Cases(); } - case QolEQ5D -> { - qolEQ5D(); + case HealthEQ5D -> { + healthEQ5D(); } case InSchool -> { // log.debug("In Education for person " + this.getKey().getId()); @@ -1037,18 +1037,18 @@ protected void lifeSatisfaction2() { } } - protected void qolEQ5D() { + protected void healthEQ5D() { double eq5dPrediction; eq5dPrediction = Parameters.getRegEQ5D().getScore(this, Person.DoublesVariables.class); if (eq5dPrediction > 1) { - deq5d = 1.0; + he_eq5d = 1.0; } else if (eq5dPrediction < -0.594) { - deq5d = -0.594; + he_eq5d = -0.594; } else { - deq5d = eq5dPrediction; + he_eq5d = eq5dPrediction; } } @@ -2276,7 +2276,7 @@ public enum DoublesVariables { Dehmf_c3_Low, Dehsp_c3_Low_L1, //Partner's education == Low at lag(1) Dehsp_c3_Medium_L1, //Partner's education == Medium at lag(1) - Deq5d, //EQ5D quality of life score + He_eq5d, //EQ5D quality of life score Dgn, //Gender: returns 1 if male Dgn_baseline, Dgn_Dag, @@ -2993,8 +2993,8 @@ public double getDoubleValue(Enum variableID) { case Dehsp_c3_Low_L1 -> { return (Education.Low.equals(dehsp_c3_lag1)) ? 1. : 0.; } - case Deq5d -> { - return getDeq5d(); + case He_eq5d -> { + return getHe_eq5d(); } case Dhhtp_c4_CoupleChildren_L1 -> { return (Dhhtp_c4.CoupleChildren.equals(getDhhtp_c4_lag1())) ? 1.0 : 0.0; @@ -5195,11 +5195,11 @@ public Long getIdFather() { public static void setPersonIdCounter(long id) {personIdCounter=id;} - public Double getDeq5d() { - return deq5d; + public Double getHe_eq5d() { + return he_eq5d; } - public void setDeq5d(Double deq5d) { - this.deq5d = deq5d; + public void setHe_eq5d(Double he_eq5d) { + this.he_eq5d = he_eq5d; } } diff --git a/src/main/java/simpaths/model/SimPathsModel.java b/src/main/java/simpaths/model/SimPathsModel.java index 5894ff0c0..d48751e57 100644 --- a/src/main/java/simpaths/model/SimPathsModel.java +++ b/src/main/java/simpaths/model/SimPathsModel.java @@ -588,7 +588,7 @@ public void buildSchedule() { yearlySchedule.addCollectionEvent(persons, Person.Processes.HealthPCS2); yearlySchedule.addCollectionEvent(persons, Person.Processes.LifeSatisfaction2); - addCollectionEventToAllYears(persons, Person.Processes.QolEQ5D); + addCollectionEventToAllYears(persons, Person.Processes.HealthEQ5D); // mortality (migration) and population alignment at year's end addCollectionEventToAllYears(persons, Person.Processes.ConsiderMortality); diff --git a/src/test/java/simpaths/model/PersonTest.java b/src/test/java/simpaths/model/PersonTest.java index 9d8d35f14..b8e6c5434 100644 --- a/src/test/java/simpaths/model/PersonTest.java +++ b/src/test/java/simpaths/model/PersonTest.java @@ -32,9 +32,9 @@ public void calculateEQ5Dlow() { testPerson.setDhe_mcs(1.); testPerson.setDhe_pcs(1.); - testPerson.onEvent(Person.Processes.QolEQ5D); + testPerson.onEvent(Person.Processes.HealthEQ5D); - assertEquals(-0.594, testPerson.getDeq5d()); + assertEquals(-0.594, testPerson.getHe_eq5d()); } @@ -45,9 +45,9 @@ public void calculateEQ5Dhigh() { testPerson.setDhe_mcs(100.); testPerson.setDhe_pcs(100.); - testPerson.onEvent(Person.Processes.QolEQ5D); + testPerson.onEvent(Person.Processes.HealthEQ5D); - assertEquals(1, testPerson.getDeq5d()); + assertEquals(1, testPerson.getHe_eq5d()); } @@ -73,9 +73,9 @@ public void calculateEQ5Dlow(){ testPerson.setDhe_mcs(1.); testPerson.setDhe_pcs(1.); - testPerson.onEvent(Person.Processes.QolEQ5D); + testPerson.onEvent(Person.Processes.HealthEQ5D); - assertEquals(-0.594, testPerson.getDeq5d()); + assertEquals(-0.594, testPerson.getHe_eq5d()); } @@ -85,10 +85,10 @@ public void calculateEQ5Dhigh(){ testPerson.setDhe_mcs(100.); testPerson.setDhe_pcs(100.); - testPerson.onEvent(Person.Processes.QolEQ5D); + testPerson.onEvent(Person.Processes.HealthEQ5D); // The maximum possible value given by the Franks coefficients - assertEquals(0.9035601, testPerson.getDeq5d()); + assertEquals(0.9035601, testPerson.getHe_eq5d()); } From fcfd42a30b26a75c71c92c1f66b94e701414eb3d Mon Sep 17 00:00:00 2001 From: Andrew Baxter Date: Wed, 19 Mar 2025 12:02:03 +0000 Subject: [PATCH 17/28] Make aging private --- src/main/java/simpaths/model/Person.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/simpaths/model/Person.java b/src/main/java/simpaths/model/Person.java index 28a8c196e..2d5085a5e 100644 --- a/src/main/java/simpaths/model/Person.java +++ b/src/main/java/simpaths/model/Person.java @@ -851,7 +851,7 @@ private void updateUnemploymentState() { //******************************************************** // method to adjust for one year increment //******************************************************** - void aging() { + private void aging() { // iterate years in cohabiting partnership Person partner = getPartner(); From 9b5549715f69a77fb189f626f3864374a17f3e73 Mon Sep 17 00:00:00 2001 From: Andy Baxter Date: Wed, 19 Mar 2025 12:09:47 +0000 Subject: [PATCH 18/28] change `healthEQ5D` method to private --- src/main/java/simpaths/model/Person.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/simpaths/model/Person.java b/src/main/java/simpaths/model/Person.java index 2d5085a5e..99dd66e38 100644 --- a/src/main/java/simpaths/model/Person.java +++ b/src/main/java/simpaths/model/Person.java @@ -1037,7 +1037,7 @@ protected void lifeSatisfaction2() { } } - protected void healthEQ5D() { + private void healthEQ5D() { double eq5dPrediction; eq5dPrediction = Parameters.getRegEQ5D().getScore(this, Person.DoublesVariables.class); From e955154312c4fe596ad475055217b998884c1d5d Mon Sep 17 00:00:00 2001 From: Andy Baxter Date: Wed, 19 Mar 2025 14:56:17 +0000 Subject: [PATCH 19/28] construct person in setup --- src/test/java/simpaths/model/PersonTest.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/test/java/simpaths/model/PersonTest.java b/src/test/java/simpaths/model/PersonTest.java index b8e6c5434..a51290aec 100644 --- a/src/test/java/simpaths/model/PersonTest.java +++ b/src/test/java/simpaths/model/PersonTest.java @@ -9,10 +9,11 @@ @DisplayName("Person methods in absence of a Model") public class PersonTest { - Person testPerson = new Person(true); + static Person testPerson; @BeforeAll static void setupParams() { + testPerson = new Person(true); Parameters.loadParameters(Country.UK, 100, false, false, false, false, false, false, false, 2020, 2020, 2020, 1.,1., false, false); } From e88c371928c46c0ab7dfa8cae4c6a9ae5d29d70a Mon Sep 17 00:00:00 2001 From: Andy Baxter Date: Wed, 19 Mar 2025 14:56:27 +0000 Subject: [PATCH 20/28] rename setup --- src/test/java/simpaths/model/PersonTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/simpaths/model/PersonTest.java b/src/test/java/simpaths/model/PersonTest.java index a51290aec..2f57fe189 100644 --- a/src/test/java/simpaths/model/PersonTest.java +++ b/src/test/java/simpaths/model/PersonTest.java @@ -12,7 +12,7 @@ public class PersonTest { static Person testPerson; @BeforeAll - static void setupParams() { + static void setup() { testPerson = new Person(true); Parameters.loadParameters(Country.UK, 100, false, false, false, false, false, false, false, 2020, 2020, 2020, 1.,1., false, false); } From 92f9364a8a85dc15b4cb035be6769d3515277071 Mon Sep 17 00:00:00 2001 From: Andy Baxter Date: Wed, 19 Mar 2025 14:56:57 +0000 Subject: [PATCH 21/28] clearer test naming --- src/test/java/simpaths/model/PersonTest.java | 24 ++++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/test/java/simpaths/model/PersonTest.java b/src/test/java/simpaths/model/PersonTest.java index 2f57fe189..2a9cf7df8 100644 --- a/src/test/java/simpaths/model/PersonTest.java +++ b/src/test/java/simpaths/model/PersonTest.java @@ -6,7 +6,7 @@ import static org.junit.jupiter.api.Assertions.*; -@DisplayName("Person methods in absence of a Model") +@DisplayName("Person class") public class PersonTest { static Person testPerson; @@ -18,16 +18,17 @@ static void setup() { } @Nested - @DisplayName("EQ5D calculations") + @DisplayName("EQ5D process") @TestClassOrder(ClassOrderer.DisplayName.class) class Eq5dTests { @Nested - @DisplayName("1. Lawrence and Fleishman coefficients") - class LawrenceCoefficients { + @DisplayName("1. With default parameters") + class WithDefaultParameters { @Test - public void calculateEQ5Dlow() { + @DisplayName("Calculates low score correctly using Lawrence and Fleishman coefficients") + public void calculatesLowScoreCorrectly() { testPerson.setDhe_mcs(1.); @@ -40,7 +41,8 @@ public void calculateEQ5Dlow() { } @Test - public void calculateEQ5Dhigh() { + @DisplayName("Calculates high score correctly using Lawrence and Fleishman coefficients") + public void calculatesHighScoreCorrectly() { testPerson.setDhe_mcs(100.); @@ -56,8 +58,8 @@ public void calculateEQ5Dhigh() { @Nested - @DisplayName("2. Franks coefficients") - class FranksCoefficients { + @DisplayName("2. With eq5dConversionParameters set to 'franks'") + class WithFranksParameters { @BeforeAll public static void setupFranksCoefficients() { @@ -69,7 +71,8 @@ public static void setupFranksCoefficients() { } @Test - public void calculateEQ5Dlow(){ + @DisplayName("Calculates low score correctly using Franks coefficients") + public void calculatesLowScoreCorrectly() { testPerson.setDhe_mcs(1.); testPerson.setDhe_pcs(1.); @@ -81,7 +84,8 @@ public void calculateEQ5Dlow(){ } @Test - public void calculateEQ5Dhigh(){ + @DisplayName("Calculates high score correctly using Franks coefficients") + public void calculatesHighScoreCorrectly(){ testPerson.setDhe_mcs(100.); testPerson.setDhe_pcs(100.); From 833e645071c14b03ec37bc2060f93076d7100eed Mon Sep 17 00:00:00 2001 From: Andy Baxter Date: Wed, 19 Mar 2025 15:57:31 +0000 Subject: [PATCH 22/28] extract load eq5d parameters as public method --- src/main/java/simpaths/data/Parameters.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/simpaths/data/Parameters.java b/src/main/java/simpaths/data/Parameters.java index b81ede563..3bb30ead7 100644 --- a/src/main/java/simpaths/data/Parameters.java +++ b/src/main/java/simpaths/data/Parameters.java @@ -1358,7 +1358,7 @@ else if(country.equals(Country.UK)) { coeffCovarianceDLS2Males = ExcelAssistant.loadCoefficientMap("input/reg_health_wellbeing.xlsx", countryString + "_DLS2_Males", 1, columnsLifeSatisfaction2Males); coeffCovarianceDLS2Females = ExcelAssistant.loadCoefficientMap("input/reg_health_wellbeing.xlsx", countryString + "_DLS2_Females", 1, columnsLifeSatisfaction2Females); - coeffCovarianceEQ5D = ExcelAssistant.loadCoefficientMap("input/reg_eq5d.xlsx", countryString + "_EQ5D_" + eq5dConversionParameters, 1, columnsHealthEQ5D); + loadEQ5DParameters(countryString, columnsHealthEQ5D); //Life satisfaction @@ -3344,4 +3344,12 @@ private static void safeDelete(String filePath) { throw e; } } + + public static void loadEQ5DParameters(String countryString, int columnsHealthEQ5D) { + + coeffCovarianceEQ5D = ExcelAssistant.loadCoefficientMap("input/reg_eq5d.xlsx", countryString + "_EQ5D_" + eq5dConversionParameters, 1, columnsHealthEQ5D); + + regHealthEQ5D = new LinearRegression(coeffCovarianceEQ5D); + + } } \ No newline at end of file From 681bd5b13f39c55991d1a58ebac19f71b95cab07 Mon Sep 17 00:00:00 2001 From: Andy Baxter Date: Wed, 19 Mar 2025 15:57:57 +0000 Subject: [PATCH 23/28] only re-load eq5d params (and reset) --- src/test/java/simpaths/model/PersonTest.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/test/java/simpaths/model/PersonTest.java b/src/test/java/simpaths/model/PersonTest.java index 2a9cf7df8..d3cf1a11d 100644 --- a/src/test/java/simpaths/model/PersonTest.java +++ b/src/test/java/simpaths/model/PersonTest.java @@ -65,8 +65,15 @@ class WithFranksParameters { public static void setupFranksCoefficients() { Parameters.eq5dConversionParameters = "franks"; + Parameters.loadEQ5DParameters("UK", 8); - Parameters.loadParameters(Country.UK, 100, false, false, false, false, false, false, false, 2020, 2020, 2020, 1.,1., false, false); + } + + @AfterAll + public static void restoreDefaultCoefficients() { + + Parameters.eq5dConversionParameters = "lawrence"; + Parameters.loadEQ5DParameters("UK", 8); } From 9719062181bbc53e6256f904abdb64622205b8c6 Mon Sep 17 00:00:00 2001 From: Andy Baxter Date: Wed, 19 Mar 2025 16:00:07 +0000 Subject: [PATCH 24/28] remove test order assertions --- src/test/java/simpaths/model/PersonTest.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/test/java/simpaths/model/PersonTest.java b/src/test/java/simpaths/model/PersonTest.java index d3cf1a11d..2490935f5 100644 --- a/src/test/java/simpaths/model/PersonTest.java +++ b/src/test/java/simpaths/model/PersonTest.java @@ -19,11 +19,10 @@ static void setup() { @Nested @DisplayName("EQ5D process") - @TestClassOrder(ClassOrderer.DisplayName.class) class Eq5dTests { @Nested - @DisplayName("1. With default parameters") + @DisplayName("With default parameters") class WithDefaultParameters { @Test @@ -58,7 +57,7 @@ public void calculatesHighScoreCorrectly() { @Nested - @DisplayName("2. With eq5dConversionParameters set to 'franks'") + @DisplayName("With eq5dConversionParameters set to 'franks'") class WithFranksParameters { @BeforeAll From a528a4f7aae1b4a57606506eec4bf50921c476cc Mon Sep 17 00:00:00 2001 From: Andy Baxter Date: Wed, 19 Mar 2025 16:55:09 +0000 Subject: [PATCH 25/28] remove redundant re-calling of health regression loading --- src/main/java/simpaths/data/Parameters.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/main/java/simpaths/data/Parameters.java b/src/main/java/simpaths/data/Parameters.java index 3bb30ead7..fb7f40eb8 100644 --- a/src/main/java/simpaths/data/Parameters.java +++ b/src/main/java/simpaths/data/Parameters.java @@ -1579,9 +1579,6 @@ else if (country.equals(Country.IT)) { regLifeSatisfaction2Males = new LinearRegression(coeffCovarianceDLS2Males); regLifeSatisfaction2Females = new LinearRegression(coeffCovarianceDLS2Females); - regHealthEQ5D = new LinearRegression(coeffCovarianceEQ5D); - - //Education regEducationE1a = new BinomialRegression(RegressionType.Probit, Indicator.class, coeffCovarianceEducationE1a); regEducationE1b = new BinomialRegression(RegressionType.Probit, Indicator.class, coeffCovarianceEducationE1b); regEducationE2a = new OrderedRegression<>(RegressionType.GenOrderedLogit, Education.class, coeffCovarianceEducationE2a); From cc3063e340ce8bc197026ac01edf5a7fbaa8f0cc Mon Sep 17 00:00:00 2001 From: Andy Baxter Date: Thu, 20 Mar 2025 10:04:44 +0000 Subject: [PATCH 26/28] simplify not loading all parameters --- src/test/java/simpaths/model/PersonTest.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/test/java/simpaths/model/PersonTest.java b/src/test/java/simpaths/model/PersonTest.java index 2490935f5..c7f36d603 100644 --- a/src/test/java/simpaths/model/PersonTest.java +++ b/src/test/java/simpaths/model/PersonTest.java @@ -14,7 +14,6 @@ public class PersonTest { @BeforeAll static void setup() { testPerson = new Person(true); - Parameters.loadParameters(Country.UK, 100, false, false, false, false, false, false, false, 2020, 2020, 2020, 1.,1., false, false); } @Nested @@ -25,6 +24,13 @@ class Eq5dTests { @DisplayName("With default parameters") class WithDefaultParameters { + @BeforeAll + public static void setupDefaultCoefficients() { + + Parameters.loadEQ5DParameters("UK", 8); + + } + @Test @DisplayName("Calculates low score correctly using Lawrence and Fleishman coefficients") public void calculatesLowScoreCorrectly() { From cd11f2b3e6819896f295d28cdd04e6ce24eedf3d Mon Sep 17 00:00:00 2001 From: Andy Baxter Date: Thu, 20 Mar 2025 10:43:04 +0000 Subject: [PATCH 27/28] change parameter loading to BeforeEach --- src/test/java/simpaths/model/PersonTest.java | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/src/test/java/simpaths/model/PersonTest.java b/src/test/java/simpaths/model/PersonTest.java index c7f36d603..bb1be9b24 100644 --- a/src/test/java/simpaths/model/PersonTest.java +++ b/src/test/java/simpaths/model/PersonTest.java @@ -21,12 +21,13 @@ static void setup() { class Eq5dTests { @Nested - @DisplayName("With default parameters") - class WithDefaultParameters { + @DisplayName("With eq5dConversionParameters set to 'lawrence'") + class WithLawrenceParameters { - @BeforeAll - public static void setupDefaultCoefficients() { + @BeforeEach + public void setupLawrenceCoefficients() { + Parameters.eq5dConversionParameters = "lawrence"; Parameters.loadEQ5DParameters("UK", 8); } @@ -66,21 +67,14 @@ public void calculatesHighScoreCorrectly() { @DisplayName("With eq5dConversionParameters set to 'franks'") class WithFranksParameters { - @BeforeAll - public static void setupFranksCoefficients() { + @BeforeEach + public void setupFranksCoefficients() { Parameters.eq5dConversionParameters = "franks"; Parameters.loadEQ5DParameters("UK", 8); } - @AfterAll - public static void restoreDefaultCoefficients() { - - Parameters.eq5dConversionParameters = "lawrence"; - Parameters.loadEQ5DParameters("UK", 8); - - } @Test @DisplayName("Calculates low score correctly using Franks coefficients") From 70929abfcc85ca21752dff9cb62df7f8491433c9 Mon Sep 17 00:00:00 2001 From: Andy Baxter Date: Thu, 20 Mar 2025 10:52:27 +0000 Subject: [PATCH 28/28] add annotation to new Person enums --- src/main/java/simpaths/model/Person.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/simpaths/model/Person.java b/src/main/java/simpaths/model/Person.java index 99dd66e38..995f32883 100644 --- a/src/main/java/simpaths/model/Person.java +++ b/src/main/java/simpaths/model/Person.java @@ -2894,18 +2894,23 @@ public double getDoubleValue(Enum variableID) { } else return 0.; } case Dhe_mcs_sq -> { + // Used to calculate he_eq5d in regHealthEQ5D return dhe_mcs * dhe_mcs; } case Dhe_mcs_c -> { + // Used to calculate he_eq5d in regHealthEQ5D return dhe_mcs - 51.5; } case Dhe_mcs_c_sq -> { + // Used to calculate he_eq5d in regHealthEQ5D return Math.pow(dhe_mcs - 51.5, 2); } case Dhe_mcs_times_pcs -> { + // Used to calculate he_eq5d in regHealthEQ5D return dhe_mcs * dhe_pcs; } case Dhe_mcs_c_times_pcs_c -> { + // Used to calculate he_eq5d in regHealthEQ5D return (dhe_mcs - 51.5) * (dhe_pcs - 49.9); } case Dhe_pcs -> { @@ -2917,15 +2922,19 @@ public double getDoubleValue(Enum variableID) { } else return 0.; } case Dhe_pcs_sq -> { + // Used to calculate he_eq5d in regHealthEQ5D return dhe_pcs * dhe_pcs; } case Dhe_pcs_cb -> { + // Used to calculate he_eq5d in regHealthEQ5D return dhe_pcs * dhe_pcs * dhe_pcs; } case Dhe_pcs_c -> { + // Used to calculate he_eq5d in regHealthEQ5D return dhe_pcs - 49.9; } case Dhe_pcs_c_sq -> { + // Used to calculate he_eq5d in regHealthEQ5D return Math.pow(dhe_pcs - 49.9, 2); } case Dls -> {