diff --git a/input/InitialPopulations/compile/01_prepare_UKHLS_pooled_data.do b/input/InitialPopulations/compile/01_prepare_UKHLS_pooled_data.do index 6f6e80dea..281062833 100644 --- a/input/InitialPopulations/compile/01_prepare_UKHLS_pooled_data.do +++ b/input/InitialPopulations/compile/01_prepare_UKHLS_pooled_data.do @@ -198,10 +198,12 @@ preserve * Generate UC benefit marker gen benefits_uc=(ficode==40) label var benefits_uc "Universal Credit indicator" +gen benefits_lb=(ficode == 15 | ficode == 16 | ficode == 19 | ficode == 20 | ficode == 22 | ficode == 33) +label var benefits_lb "Legacy Benefits indicator" -keep hidp pidp swv benefits_uc -collapse (max) benefits_uc, by(hidp swv) +keep hidp pidp swv benefits_uc benefits_lb +collapse (max) benefits_uc benefits_lb, by(hidp swv) compress save "$dir_data/tmp_ucrcpt", replace diff --git a/input/InitialPopulations/compile/02_create_UKHLS_variables.do b/input/InitialPopulations/compile/02_create_UKHLS_variables.do index e4e8b856e..4fb27a26c 100644 --- a/input/InitialPopulations/compile/02_create_UKHLS_variables.do +++ b/input/InitialPopulations/compile/02_create_UKHLS_variables.do @@ -352,20 +352,43 @@ eststo predict_dhm: reg dhm c.dag i.dgn i.swv i.dhe, vce(robust) // Physical hea restore estimates restore predict_dhm predict dhm_prediction -fre dhm_prediction +// fre dhm_prediction gen dhm_flag = missing(dhm) replace dhm = round(dhm_prediction) if missing(dhm) bys dhm_flag : sum dhm +/**************************Subjective well-being: GHQ 0-12 score *****************************/ +/*dhm_ghq scghq2_dv "DEMOGRAPHIC: Subjective wellbeing (GHQ): rescaled to 0-12, assumed to be continuous" +This measure converts valid answers to 12 questions of the General Health Questionnaire (GHQ) to a +single scale by recoding the values of individual variables of 1 and 2 to 0, and values of 3 and 4 to 1 before summing them. +This produces a scale that ranges from 0 (indicating the least amount of distress) to 12 (indicating the greatest amount of distress). +*/ +gen dhm_ghq = scghq2_dv +replace dhm_ghq = . if scghq2_dv <0 +la var dhm_ghq "DEMOGRAPHIC: Subjective wellbeing (GHQ): 0-12 score" +gen scghq2_dv_miss_flag = (scghq2_dv == .) + +preserve +drop if dgn < 0 | dag<0 | dhe<0 +eststo predict_dhm_ghq: reg dhm_ghq c.dag i.dgn i.swv i.dhe, vce(robust) // Physical health has a big impact, so included as covariate. +restore +estimates restore predict_dhm_ghq +predict dhm_ghq_prediction + +gen dhm_ghq_flag = missing(dhm_ghq) +replace dhm_ghq = round(dhm_ghq_prediction) if missing(dhm_ghq) +bys dhm_ghq_flag : sum dhm_ghq + +/* Alternative method of GHQ caseness - binary cutoff at scghq2_dv <4 /**************************Subjective wellbeing (GHQ): Caseness ****************************** 0: not psychologically distressed, scghq2_dv < 4 1: psychologically distressed, scghq2_dv >= 4 This measure converts valid answers to 12 questions of the General Health Questionnaire (GHQ) to a single scale by recoding 1 and 2 values on individual variables to 0, and 3 and 4 values to 1, and then summing, giving a scale running from 0 (the least distressed) to 12 (the most distressed). A binary indicator is then created, equal to 1 for values >= 4.*/ -fre scghq2_dv +// fre scghq2_dv recode scghq2_dv (-9/-1 . = .) gen scghq2_dv_miss_flag = (scghq2_dv == .) @@ -451,12 +474,16 @@ replace dhe_pcssp=-9 if missing(dhe_pcssp) & idpartner>0 //fre dhe_mcssp dhe_pcssp if idpartner>0 -/***************************** Life Satisfaction ***************************************************************************/ -/* Life satisfaction, self report. Continuous scale 0 to 7. */ +/***************************** Life Satisfaction 0-10 ****************************************************/ +/* Life satisfaction, self report. Continuous scale. + UKHLS variable sclfsato records scores 1-7. + Convert to 0-10 in line with ONS Life Satisfaction scale. + */ gen dls = sclfsato replace dls = . if sclfsato < 0 +replace dls = (dls-1) * 10/6 // Change to 0-10 scale lab var dls "DEMOGRAPHIC: Life Satisfaction" // fre dls if dag>0 & dag<16 @@ -1751,6 +1778,11 @@ gen econ_benefits_uc=econ_benefits replace econ_benefits_uc=0 if benefits_uc==0 label var econ_benefits_uc "Household income includes UC benefits" +gen econ_benefits_lb=benefits_lb +replace econ_benefits_lb=0 if benefits_lb==. +replace econ_benefits_lb=0 if econ_benefits_uc==1 +label var econ_benefits_lb "Household income includes Legacy Benefits" + /***************************** Financial Distress ***************************************************************************/ // This is a measure of subjective financial distress, corresponding to answering 4 or 5 to the question below: diff --git a/input/InitialPopulations/compile/09_finalise_input_data.do b/input/InitialPopulations/compile/09_finalise_input_data.do index a52bef0fb..10156dbe8 100644 --- a/input/InitialPopulations/compile/09_finalise_input_data.do +++ b/input/InitialPopulations/compile/09_finalise_input_data.do @@ -205,7 +205,7 @@ rename dhe_mcs healthMentalMcs rename dhe_pcs healthPhysicalPcs rename dhe_mcssp healthMentalPartnerMcs rename dhe_pcssp healthPhysicalPartnerPcs -rename dls demLifeSatScore1to7 +rename dls demLifeSatScore0to10 rename dot demEthnC4 rename dot01 demEthnC6 rename financial_distress yFinDstrssFlag diff --git a/input/InitialPopulations/compile/RegressionEstimates/reg_health_mental.do b/input/InitialPopulations/compile/RegressionEstimates/reg_health_mental.do index 55688b0e8..26dd12def 100644 --- a/input/InitialPopulations/compile/RegressionEstimates/reg_health_mental.do +++ b/input/InitialPopulations/compile/RegressionEstimates/reg_health_mental.do @@ -91,7 +91,7 @@ forvalues i = 1/2 { } mkmat v*, matrix(var) -putexcel set "$dir_results/reg_health_mental", sheet("UK_HM1_L") modify +putexcel set "$dir_results/reg_health_mental", sheet("UK_HM1_L", replace) modify putexcel C2 = matrix(var) restore @@ -131,70 +131,68 @@ putexcel A1 = matrix(nonzero_b'), names nformat(number_d2) putexcel A1 = "REGRESSOR" putexcel A2 = "D_Home_owner_L1" putexcel A3 = "Dcpst_Single_L1" -putexcel A4 = "Dcpst_PreviouslyPartnered_L1" -putexcel A5 = "Dnc_L1" -putexcel A6 = "Dhe_pcs_L1" -putexcel A7 = "UKC" -putexcel A8 = "UKD" -putexcel A9 = "UKE" -putexcel A10 = "UKF" -putexcel A11 = "UKG" -putexcel A12 = "UKH" -putexcel A13 = "UKJ" -putexcel A14 = "UKK" -putexcel A15 = "UKL" -putexcel A16 = "UKM" -putexcel A17 = "UKN" -putexcel A18 = "Ydses_c5_Q2_L1" -putexcel A19 = "Ydses_c5_Q3_L1" -putexcel A20 = "Ydses_c5_Q4_L1" -putexcel A21 = "Ydses_c5_Q5_L1" -putexcel A22 = "Dlltsd_L1" -putexcel A23 = "Dhm_L1" -putexcel A24 = "Dag_L1" -putexcel A25 = "Dag_sq_L1" -putexcel A26 = "Deh_c3_Medium" -putexcel A27 = "Deh_c3_Low" -putexcel A28 = "EthnicityAsian" -putexcel A29 = "EthnicityBlack" -putexcel A30 = "EthnicityOther" -putexcel A31 = "Dgn" -putexcel A32 = "Year_transformed" -putexcel A33 = "Constant" +putexcel A4 = "Dnc_L1" +putexcel A5 = "Dhe_pcs_L1" +putexcel A6 = "UKC" +putexcel A7 = "UKD" +putexcel A8 = "UKE" +putexcel A9 = "UKF" +putexcel A10 = "UKG" +putexcel A11 = "UKH" +putexcel A12 = "UKJ" +putexcel A13 = "UKK" +putexcel A14 = "UKL" +putexcel A15 = "UKM" +putexcel A16 = "UKN" +putexcel A17 = "Ydses_c5_Q2_L1" +putexcel A18 = "Ydses_c5_Q3_L1" +putexcel A19 = "Ydses_c5_Q4_L1" +putexcel A20 = "Ydses_c5_Q5_L1" +putexcel A21 = "Dlltsd_L1" +putexcel A22 = "Dhm_L1" +putexcel A23 = "Dag_L1" +putexcel A24 = "Dag_sq_L1" +putexcel A25 = "Deh_c3_Medium" +putexcel A26 = "Deh_c3_Low" +putexcel A27 = "EthnicityAsian" +putexcel A28 = "EthnicityBlack" +putexcel A29 = "EthnicityOther" +putexcel A30 = "Dgn" +putexcel A31 = "Year_transformed" +putexcel A32 = "Constant" putexcel B1 = "COEFFICIENT" putexcel C1 = "D_Home_owner_L1" putexcel D1 = "Dcpst_Single_L1" -putexcel E1 = "Dcpst_PreviouslyPartnered_L1" -putexcel F1 = "Dnc_L1" -putexcel G1 = "Dhe_pcs_L1" -putexcel H1 = "UKC" -putexcel I1 = "UKD" -putexcel J1 = "UKE" -putexcel K1 = "UKF" -putexcel L1 = "UKG" -putexcel M1 = "UKH" -putexcel N1 = "UKJ" -putexcel O1 = "UKK" -putexcel P1 = "UKL" -putexcel Q1 = "UKM" -putexcel R1 = "UKN" -putexcel S1 = "Ydses_c5_Q2_L1" -putexcel T1 = "Ydses_c5_Q3_L1" -putexcel U1 = "Ydses_c5_Q4_L1" -putexcel V1 = "Ydses_c5_Q5_L1" -putexcel W1 = "Dlltsd_L1" -putexcel X1 = "Dhm_L1" -putexcel Y1 = "Dag_L1" -putexcel Z1 = "Dag_sq_L1" -putexcel AA1 = "Deh_c3_Medium" -putexcel AB1 = "Deh_c3_Low" -putexcel AC1 = "EthnicityAsian" -putexcel AD1 = "EthnicityBlack" -putexcel AE1 = "EthnicityOther" -putexcel AF1 = "Dgn" -putexcel AG1 = "Year_transformed" -putexcel AH1 = "Constant" +putexcel E1 = "Dnc_L1" +putexcel F1 = "Dhe_pcs_L1" +putexcel G1 = "UKC" +putexcel H1 = "UKD" +putexcel I1 = "UKE" +putexcel J1 = "UKF" +putexcel K1 = "UKG" +putexcel L1 = "UKH" +putexcel M1 = "UKJ" +putexcel N1 = "UKK" +putexcel O1 = "UKL" +putexcel P1 = "UKM" +putexcel Q1 = "UKN" +putexcel R1 = "Ydses_c5_Q2_L1" +putexcel S1 = "Ydses_c5_Q3_L1" +putexcel T1 = "Ydses_c5_Q4_L1" +putexcel U1 = "Ydses_c5_Q5_L1" +putexcel V1 = "Dlltsd_L1" +putexcel W1 = "Dhm_L1" +putexcel X1 = "Dag_L1" +putexcel Y1 = "Dag_sq_L1" +putexcel Z1 = "Deh_c3_Medium" +putexcel AA1 = "Deh_c3_Low" +putexcel AB1 = "EthnicityAsian" +putexcel AC1 = "EthnicityBlack" +putexcel AD1 = "EthnicityOther" +putexcel AE1 = "Dgn" +putexcel AF1 = "Year_transformed" +putexcel AG1 = "Constant" * save RMSE putexcel set "$dir_results/reg_RMSE.xlsx", sheet("UK") modify @@ -278,7 +276,7 @@ forvalues i = 1/2 { } mkmat v*, matrix(var) -putexcel set "$dir_results/reg_health_mental", sheet("UK_HM2_Females_L") modify +putexcel set "$dir_results/reg_health_mental", sheet("UK_HM2_Females_L", replace) modify putexcel C2 = matrix(var) restore @@ -423,7 +421,7 @@ forvalues i = 1/2 { } mkmat v*, matrix(var) -putexcel set "$dir_results/reg_health_mental", sheet("UK_HM2_Males_L") modify +putexcel set "$dir_results/reg_health_mental", sheet("UK_HM2_Males_L", replace) modify putexcel C2 = matrix(var) restore @@ -498,9 +496,12 @@ scalar drop r2_p N chi2 ll * HM1_C: GHQ12 score 0-12 of all working-age adults - baseline effects * ********************************************************************** -reg scghq2_dv /// +* New ordered logistic regression model, reflecting observed distributions + +ologit scghq2_dv /// L.i.dhh_owned L.i.dcpst L.dnc L.dhe_pcs L.ib8.drgn L.i.ydses_c5 L.dlltsd L.scghq2_dv /// L.dag L.dagsq i.deh_c3 i.dot i.dgn stm /// +if stm!=20 & stm!=21 & dag>=25 & dag<=64 & swv!=12 /// [pweight=dimxwt] /// , vce(cluster idperson) @@ -553,7 +554,7 @@ forvalues i = 1/2 { } mkmat v*, matrix(var) -putexcel set "$dir_results/reg_health_mental", sheet("UK_HM1_C") modify +putexcel set "$dir_results/reg_health_mental", sheet("UK_HM1_C", replace) modify putexcel C2 = matrix(var) restore @@ -593,81 +594,104 @@ putexcel A1 = matrix(nonzero_b'), names nformat(number_d2) putexcel A1 = "REGRESSOR" putexcel A2 = "D_Home_owner_L1" putexcel A3 = "Dcpst_Single_L1" -putexcel A4 = "Dcpst_PreviouslyPartnered_L1" -putexcel A5 = "Dnc_L1" -putexcel A6 = "Dhe_pcs_L1" -putexcel A7 = "UKC" -putexcel A8 = "UKD" -putexcel A9 = "UKE" -putexcel A10 = "UKF" -putexcel A11 = "UKG" -putexcel A12 = "UKH" -putexcel A13 = "UKJ" -putexcel A14 = "UKK" -putexcel A15 = "UKL" -putexcel A16 = "UKM" -putexcel A17 = "UKN" -putexcel A18 = "Ydses_c5_Q2_L1" -putexcel A19 = "Ydses_c5_Q3_L1" -putexcel A20 = "Ydses_c5_Q4_L1" -putexcel A21 = "Ydses_c5_Q5_L1" -putexcel A22 = "Dlltsd_L1" -putexcel A23 = "Dhm_L1" -putexcel A24 = "Dag_L1" -putexcel A25 = "Dag_sq_L1" -putexcel A26 = "Deh_c3_Medium" -putexcel A27 = "Deh_c3_Low" -putexcel A28 = "EthnicityAsian" -putexcel A29 = "EthnicityBlack" -putexcel A30 = "EthnicityOther" -putexcel A31 = "Dgn" -putexcel A32 = "Year_transformed" -putexcel A33 = "Constant" +putexcel A4 = "Dnc_L1" +putexcel A5 = "Dhe_pcs_L1" +putexcel A6 = "UKC" +putexcel A7 = "UKD" +putexcel A8 = "UKE" +putexcel A9 = "UKF" +putexcel A10 = "UKG" +putexcel A11 = "UKH" +putexcel A12 = "UKJ" +putexcel A13 = "UKK" +putexcel A14 = "UKL" +putexcel A15 = "UKM" +putexcel A16 = "UKN" +putexcel A17 = "Ydses_c5_Q2_L1" +putexcel A18 = "Ydses_c5_Q3_L1" +putexcel A19 = "Ydses_c5_Q4_L1" +putexcel A20 = "Ydses_c5_Q5_L1" +putexcel A21 = "Dlltsd_L1" +putexcel A22 = "Dhm_L1" +putexcel A23 = "Dag_L1" +putexcel A24 = "Dag_sq_L1" +putexcel A25 = "Deh_c3_Medium" +putexcel A26 = "Deh_c3_Low" +putexcel A27 = "EthnicityAsian" +putexcel A28 = "EthnicityBlack" +putexcel A29 = "EthnicityOther" +putexcel A30 = "Dgn" +putexcel A31 = "Year_transformed" +putexcel A32 = "Cut1" +putexcel A33 = "Cut2" +putexcel A34 = "Cut3" +putexcel A35 = "Cut4" +putexcel A36 = "Cut5" +putexcel A37 = "Cut6" +putexcel A38 = "Cut7" +putexcel A39 = "Cut8" +putexcel A40 = "Cut9" +putexcel A41 = "Cut10" +putexcel A42 = "Cut11" +putexcel A43 = "Cut12" putexcel B1 = "COEFFICIENT" putexcel C1 = "D_Home_owner_L1" putexcel D1 = "Dcpst_Single_L1" -putexcel E1 = "Dcpst_PreviouslyPartnered_L1" -putexcel F1 = "Dnc_L1" -putexcel G1 = "Dhe_pcs_L1" -putexcel H1 = "UKC" -putexcel I1 = "UKD" -putexcel J1 = "UKE" -putexcel K1 = "UKF" -putexcel L1 = "UKG" -putexcel M1 = "UKH" -putexcel N1 = "UKJ" -putexcel O1 = "UKK" -putexcel P1 = "UKL" -putexcel Q1 = "UKM" -putexcel R1 = "UKN" -putexcel S1 = "Ydses_c5_Q2_L1" -putexcel T1 = "Ydses_c5_Q3_L1" -putexcel U1 = "Ydses_c5_Q4_L1" -putexcel V1 = "Ydses_c5_Q5_L1" -putexcel W1 = "Dlltsd_L1" -putexcel X1 = "Dhm_L1" -putexcel Y1 = "Dag_L1" -putexcel Z1 = "Dag_sq_L1" -putexcel AA1 = "Deh_c3_Medium" -putexcel AB1 = "Deh_c3_Low" -putexcel AC1 = "EthnicityAsian" -putexcel AD1 = "EthnicityBlack" -putexcel AE1 = "EthnicityOther" -putexcel AF1 = "Dgn" -putexcel AG1 = "Year_transformed" -putexcel AH1 = "Constant" +putexcel E1 = "Dnc_L1" +putexcel F1 = "Dhe_pcs_L1" +putexcel G1 = "UKC" +putexcel H1 = "UKD" +putexcel I1 = "UKE" +putexcel J1 = "UKF" +putexcel K1 = "UKG" +putexcel L1 = "UKH" +putexcel M1 = "UKJ" +putexcel N1 = "UKK" +putexcel O1 = "UKL" +putexcel P1 = "UKM" +putexcel Q1 = "UKN" +putexcel R1 = "Ydses_c5_Q2_L1" +putexcel S1 = "Ydses_c5_Q3_L1" +putexcel T1 = "Ydses_c5_Q4_L1" +putexcel U1 = "Ydses_c5_Q5_L1" +putexcel V1 = "Dlltsd_L1" +putexcel W1 = "Dhm_L1" +putexcel X1 = "Dag_L1" +putexcel Y1 = "Dag_sq_L1" +putexcel Z1 = "Deh_c3_Medium" +putexcel AA1 = "Deh_c3_Low" +putexcel AB1 = "EthnicityAsian" +putexcel AC1 = "EthnicityBlack" +putexcel AD1 = "EthnicityOther" +putexcel AE1 = "Dgn" +putexcel AF1 = "Year_transformed" +putexcel AG1 = "Cut1" +putexcel AH1 = "Cut2" +putexcel AI1 = "Cut3" +putexcel AJ1 = "Cut4" +putexcel AK1 = "Cut5" +putexcel AL1 = "Cut6" +putexcel AM1 = "Cut7" +putexcel AN1 = "Cut8" +putexcel AO1 = "Cut9" +putexcel AP1 = "Cut10" +putexcel AQ1 = "Cut11" +putexcel AR1 = "Cut12" -* save RMSE +* save RMSE - not strictly needed for ologit predictions putexcel set "$dir_results/reg_RMSE.xlsx", sheet("UK") modify -putexcel A13 = ("HM1_C") B13 = rmse +putexcel A11 = ("HM1_C") B11 = rmse drop in_sample p scalar drop r2_p N chi2 ll + *************************************************************** * HM2_Females_C: GHQ12 Score 0-12 - causal employment effects * *************************************************************** +* Kept as linear as adding an 'additional' causal effect on baseline + gen RealIncomeDecrease_D = log_income - L.log_income gen scghq2_dv_L1 = L.scghq2_dv @@ -740,7 +764,7 @@ forvalues i = 1/2 { } mkmat v*, matrix(var) -putexcel set "$dir_results/reg_health_mental", sheet("UK_HM2_Females_C") modify +putexcel set "$dir_results/reg_health_mental", sheet("UK_HM2_Females_C", replace) modify putexcel C2 = matrix(var) restore @@ -883,7 +907,7 @@ forvalues i = 1/2 { } mkmat v*, matrix(var) -putexcel set "$dir_results/reg_health_mental", sheet("UK_HM2_Males_C") modify +putexcel set "$dir_results/reg_health_mental", sheet("UK_HM2_Males_C", replace) modify putexcel C2 = matrix(var) restore diff --git a/input/InitialPopulations/compile/RegressionEstimates/reg_health_wellbeing.do b/input/InitialPopulations/compile/RegressionEstimates/reg_health_wellbeing.do index 20a5cb482..646661b5f 100644 --- a/input/InitialPopulations/compile/RegressionEstimates/reg_health_wellbeing.do +++ b/input/InitialPopulations/compile/RegressionEstimates/reg_health_wellbeing.do @@ -91,7 +91,7 @@ forvalues i = 1/2 { } mkmat v*, matrix(var) -putexcel set "$dir_results/reg_health_wellbeing", sheet("UK_DHE_MCS1") modify +putexcel set "$dir_results/reg_health_wellbeing", sheet("UK_DHE_MCS1", replace) modify putexcel C2 = matrix(var) restore @@ -131,70 +131,68 @@ putexcel A1 = matrix(nonzero_b'), names nformat(number_d2) putexcel A1 = "REGRESSOR" putexcel A2 = "D_Home_owner_L1" putexcel A3 = "Dcpst_Single_L1" -putexcel A4 = "Dcpst_PreviouslyPartnered_L1" -putexcel A5 = "Dnc_L1" -putexcel A6 = "Dhe_pcs_L1" -putexcel A7 = "UKC" -putexcel A8 = "UKD" -putexcel A9 = "UKE" -putexcel A10 = "UKF" -putexcel A11 = "UKG" -putexcel A12 = "UKH" -putexcel A13 = "UKJ" -putexcel A14 = "UKK" -putexcel A15 = "UKL" -putexcel A16 = "UKM" -putexcel A17 = "UKN" -putexcel A18 = "Ydses_c5_Q2_L1" -putexcel A19 = "Ydses_c5_Q3_L1" -putexcel A20 = "Ydses_c5_Q4_L1" -putexcel A21 = "Ydses_c5_Q5_L1" -putexcel A22 = "Dlltsd_L1" -putexcel A23 = "Dhe_mcs_L1" -putexcel A24 = "Dag_L1" -putexcel A25 = "Dag_sq_L1" -putexcel A26 = "Deh_c3_Medium" -putexcel A27 = "Deh_c3_Low" -putexcel A28 = "EthnicityAsian" -putexcel A29 = "EthnicityBlack" -putexcel A30 = "EthnicityOther" -putexcel A31 = "Dgn" -putexcel A32 = "Year_transformed" -putexcel A33 = "Constant" +putexcel A4 = "Dnc_L1" +putexcel A5 = "Dhe_pcs_L1" +putexcel A6 = "UKC" +putexcel A7 = "UKD" +putexcel A8 = "UKE" +putexcel A9 = "UKF" +putexcel A10 = "UKG" +putexcel A11 = "UKH" +putexcel A12 = "UKJ" +putexcel A13 = "UKK" +putexcel A14 = "UKL" +putexcel A15 = "UKM" +putexcel A16 = "UKN" +putexcel A17 = "Ydses_c5_Q2_L1" +putexcel A18 = "Ydses_c5_Q3_L1" +putexcel A19 = "Ydses_c5_Q4_L1" +putexcel A20 = "Ydses_c5_Q5_L1" +putexcel A21 = "Dlltsd_L1" +putexcel A22 = "Dhe_mcs_L1" +putexcel A23 = "Dag_L1" +putexcel A24 = "Dag_sq_L1" +putexcel A25 = "Deh_c3_Medium" +putexcel A26 = "Deh_c3_Low" +putexcel A27 = "EthnicityAsian" +putexcel A28 = "EthnicityBlack" +putexcel A29 = "EthnicityOther" +putexcel A30 = "Dgn" +putexcel A31 = "Year_transformed" +putexcel A32 = "Constant" putexcel B1 = "COEFFICIENT" putexcel C1 = "D_Home_owner_L1" putexcel D1 = "Dcpst_Single_L1" -putexcel E1 = "Dcpst_PreviouslyPartnered_L1" -putexcel F1 = "Dnc_L1" -putexcel G1 = "Dhe_pcs_L1" -putexcel H1 = "UKC" -putexcel I1 = "UKD" -putexcel J1 = "UKE" -putexcel K1 = "UKF" -putexcel L1 = "UKG" -putexcel M1 = "UKH" -putexcel N1 = "UKJ" -putexcel O1 = "UKK" -putexcel P1 = "UKL" -putexcel Q1 = "UKM" -putexcel R1 = "UKN" -putexcel S1 = "Ydses_c5_Q2_L1" -putexcel T1 = "Ydses_c5_Q3_L1" -putexcel U1 = "Ydses_c5_Q4_L1" -putexcel V1 = "Ydses_c5_Q5_L1" -putexcel W1 = "Dlltsd_L1" -putexcel X1 = "Dhe_mcs_L1" -putexcel Y1 = "Dag_L1" -putexcel Z1 = "Dag_sq_L1" -putexcel AA1 = "Deh_c3_Medium" -putexcel AB1 = "Deh_c3_Low" -putexcel AC1 = "EthnicityAsian" -putexcel AD1 = "EthnicityBlack" -putexcel AE1 = "EthnicityOther" -putexcel AF1 = "Dgn" -putexcel AG1 = "Year_transformed" -putexcel AH1 = "Constant" +putexcel E1 = "Dnc_L1" +putexcel F1 = "Dhe_pcs_L1" +putexcel G1 = "UKC" +putexcel H1 = "UKD" +putexcel I1 = "UKE" +putexcel J1 = "UKF" +putexcel K1 = "UKG" +putexcel L1 = "UKH" +putexcel M1 = "UKJ" +putexcel N1 = "UKK" +putexcel O1 = "UKL" +putexcel P1 = "UKM" +putexcel Q1 = "UKN" +putexcel R1 = "Ydses_c5_Q2_L1" +putexcel S1 = "Ydses_c5_Q3_L1" +putexcel T1 = "Ydses_c5_Q4_L1" +putexcel U1 = "Ydses_c5_Q5_L1" +putexcel V1 = "Dlltsd_L1" +putexcel W1 = "Dhe_mcs_L1" +putexcel X1 = "Dag_L1" +putexcel Y1 = "Dag_sq_L1" +putexcel Z1 = "Deh_c3_Medium" +putexcel AA1 = "Deh_c3_Low" +putexcel AB1 = "EthnicityAsian" +putexcel AC1 = "EthnicityBlack" +putexcel AD1 = "EthnicityOther" +putexcel AE1 = "Dgn" +putexcel AF1 = "Year_transformed" +putexcel AG1 = "Constant" * save RMSE putexcel set "$dir_results/reg_RMSE.xlsx", sheet("UK") modify @@ -280,7 +278,7 @@ forvalues i = 1/2 { } mkmat v*, matrix(var) -putexcel set "$dir_results/reg_health_wellbeing", sheet("UK_DHE_MCS2_Females") modify +putexcel set "$dir_results/reg_health_wellbeing", sheet("UK_DHE_MCS2_Females", replace) modify putexcel C2 = matrix(var) restore @@ -426,7 +424,7 @@ forvalues i = 1/2 { } mkmat v*, matrix(var) -putexcel set "$dir_results/reg_health_wellbeing", sheet("UK_DHE_MCS2_Males") modify +putexcel set "$dir_results/reg_health_wellbeing", sheet("UK_DHE_MCS2_Males", replace) modify putexcel C2 = matrix(var) restore @@ -557,7 +555,7 @@ forvalues i = 1/2 { } mkmat v*, matrix(var) -putexcel set "$dir_results/reg_health_wellbeing", sheet("UK_DHE_PCS1") modify +putexcel set "$dir_results/reg_health_wellbeing", sheet("UK_DHE_PCS1", replace) modify putexcel C2 = matrix(var) restore @@ -597,70 +595,68 @@ putexcel A1 = matrix(nonzero_b'), names nformat(number_d2) putexcel A1 = "REGRESSOR" putexcel A2 = "D_Home_owner_L1" putexcel A3 = "Dcpst_Single_L1" -putexcel A4 = "Dcpst_PreviouslyPartnered_L1" -putexcel A5 = "Dnc_L1" -putexcel A6 = "Dhe_mcs_L1" -putexcel A7 = "UKC" -putexcel A8 = "UKD" -putexcel A9 = "UKE" -putexcel A10 = "UKF" -putexcel A11 = "UKG" -putexcel A12 = "UKH" -putexcel A13 = "UKJ" -putexcel A14 = "UKK" -putexcel A15 = "UKL" -putexcel A16 = "UKM" -putexcel A17 = "UKN" -putexcel A18 = "Ydses_c5_Q2_L1" -putexcel A19 = "Ydses_c5_Q3_L1" -putexcel A20 = "Ydses_c5_Q4_L1" -putexcel A21 = "Ydses_c5_Q5_L1" -putexcel A22 = "Dlltsd_L1" -putexcel A23 = "Dhe_pcs_L1" -putexcel A24 = "Dag_L1" -putexcel A25 = "Dag_sq_L1" -putexcel A26 = "Deh_c3_Medium" -putexcel A27 = "Deh_c3_Low" -putexcel A28 = "EthnicityAsian" -putexcel A29 = "EthnicityBlack" -putexcel A30 = "EthnicityOther" -putexcel A31 = "Dgn" -putexcel A32 = "Year_transformed" -putexcel A33 = "Constant" +putexcel A4 = "Dnc_L1" +putexcel A5 = "Dhe_mcs_L1" +putexcel A6 = "UKC" +putexcel A7 = "UKD" +putexcel A8 = "UKE" +putexcel A9 = "UKF" +putexcel A10 = "UKG" +putexcel A11 = "UKH" +putexcel A12 = "UKJ" +putexcel A13 = "UKK" +putexcel A14 = "UKL" +putexcel A15 = "UKM" +putexcel A16 = "UKN" +putexcel A17 = "Ydses_c5_Q2_L1" +putexcel A18 = "Ydses_c5_Q3_L1" +putexcel A19 = "Ydses_c5_Q4_L1" +putexcel A20 = "Ydses_c5_Q5_L1" +putexcel A21 = "Dlltsd_L1" +putexcel A22 = "Dhe_pcs_L1" +putexcel A23 = "Dag_L1" +putexcel A24 = "Dag_sq_L1" +putexcel A25 = "Deh_c3_Medium" +putexcel A26 = "Deh_c3_Low" +putexcel A27 = "EthnicityAsian" +putexcel A28 = "EthnicityBlack" +putexcel A29 = "EthnicityOther" +putexcel A30 = "Dgn" +putexcel A31 = "Year_transformed" +putexcel A32 = "Constant" putexcel B1 = "COEFFICIENT" putexcel C1 = "D_Home_owner_L1" putexcel D1 = "Dcpst_Single_L1" -putexcel E1 = "Dcpst_PreviouslyPartnered_L1" -putexcel F1 = "Dnc_L1" -putexcel G1 = "Dhe_mcs_L1" -putexcel H1 = "UKC" -putexcel I1 = "UKD" -putexcel J1 = "UKE" -putexcel K1 = "UKF" -putexcel L1 = "UKG" -putexcel M1 = "UKH" -putexcel N1 = "UKJ" -putexcel O1 = "UKK" -putexcel P1 = "UKL" -putexcel Q1 = "UKM" -putexcel R1 = "UKN" -putexcel S1 = "Ydses_c5_Q2_L1" -putexcel T1 = "Ydses_c5_Q3_L1" -putexcel U1 = "Ydses_c5_Q4_L1" -putexcel V1 = "Ydses_c5_Q5_L1" -putexcel W1 = "Dlltsd_L1" -putexcel X1 = "Dhe_pcs_L1" -putexcel Y1 = "Dag_L1" -putexcel Z1 = "Dag_sq_L1" -putexcel AA1 = "Deh_c3_Medium" -putexcel AB1 = "Deh_c3_Low" -putexcel AC1 = "EthnicityAsian" -putexcel AD1 = "EthnicityBlack" -putexcel AE1 = "EthnicityOther" -putexcel AF1 = "Dgn" -putexcel AG1 = "Year_transformed" -putexcel AH1 = "Constant" +putexcel E1 = "Dnc_L1" +putexcel F1 = "Dhe_mcs_L1" +putexcel G1 = "UKC" +putexcel H1 = "UKD" +putexcel I1 = "UKE" +putexcel J1 = "UKF" +putexcel K1 = "UKG" +putexcel L1 = "UKH" +putexcel M1 = "UKJ" +putexcel N1 = "UKK" +putexcel O1 = "UKL" +putexcel P1 = "UKM" +putexcel Q1 = "UKN" +putexcel R1 = "Ydses_c5_Q2_L1" +putexcel S1 = "Ydses_c5_Q3_L1" +putexcel T1 = "Ydses_c5_Q4_L1" +putexcel U1 = "Ydses_c5_Q5_L1" +putexcel V1 = "Dlltsd_L1" +putexcel W1 = "Dhe_pcs_L1" +putexcel X1 = "Dag_L1" +putexcel Y1 = "Dag_sq_L1" +putexcel Z1 = "Deh_c3_Medium" +putexcel AA1 = "Deh_c3_Low" +putexcel AB1 = "EthnicityAsian" +putexcel AC1 = "EthnicityBlack" +putexcel AD1 = "EthnicityOther" +putexcel AE1 = "Dgn" +putexcel AF1 = "Year_transformed" +putexcel AG1 = "Constant" * save RMSE putexcel set "$dir_results/reg_RMSE.xlsx", sheet("UK") modify @@ -746,7 +742,7 @@ forvalues i = 1/2 { } mkmat v*, matrix(var) -putexcel set "$dir_results/reg_health_wellbeing", sheet("UK_DHE_PCS2_Females") modify +putexcel set "$dir_results/reg_health_wellbeing", sheet("UK_DHE_PCS2_Females", replace) modify putexcel C2 = matrix(var) restore @@ -893,7 +889,7 @@ forvalues i = 1/2 { } mkmat v*, matrix(var) -putexcel set "$dir_results/reg_health_wellbeing", sheet("UK_DHE_PCS2_Males") modify +putexcel set "$dir_results/reg_health_wellbeing", sheet("UK_DHE_PCS2_Males", replace) modify putexcel C2 = matrix(var) restore @@ -1024,7 +1020,7 @@ forvalues i = 1/2 { } mkmat v*, matrix(var) -putexcel set "$dir_results/reg_health_wellbeing", sheet("UK_DLS1") modify +putexcel set "$dir_results/reg_health_wellbeing", sheet("UK_DLS1", replace) modify putexcel C2 = matrix(var) restore @@ -1064,70 +1060,68 @@ putexcel A1 = matrix(nonzero_b'), names nformat(number_d2) putexcel A1 = "REGRESSOR" putexcel A2 = "D_Home_owner_L1" putexcel A3 = "Dcpst_Single_L1" -putexcel A4 = "Dcpst_PreviouslyPartnered_L1" -putexcel A5 = "Dnc_L1" -putexcel A6 = "Dhe_pcs_L1" -putexcel A7 = "UKC" -putexcel A8 = "UKD" -putexcel A9 = "UKE" -putexcel A10 = "UKF" -putexcel A11 = "UKG" -putexcel A12 = "UKH" -putexcel A13 = "UKJ" -putexcel A14 = "UKK" -putexcel A15 = "UKL" -putexcel A16 = "UKM" -putexcel A17 = "UKN" -putexcel A18 = "Ydses_c5_Q2_L1" -putexcel A19 = "Ydses_c5_Q3_L1" -putexcel A20 = "Ydses_c5_Q4_L1" -putexcel A21 = "Ydses_c5_Q5_L1" -putexcel A22 = "Dlltsd_L1" -putexcel A23 = "Dls_L1" -putexcel A24 = "Dag_L1" -putexcel A25 = "Dag_sq_L1" -putexcel A26 = "Deh_c3_Medium" -putexcel A27 = "Deh_c3_Low" -putexcel A28 = "EthnicityAsian" -putexcel A29 = "EthnicityBlack" -putexcel A30 = "EthnicityOther" -putexcel A31 = "Dgn" -putexcel A32 = "Year_transformed" -putexcel A33 = "Constant" +putexcel A4 = "Dnc_L1" +putexcel A5 = "Dhe_pcs_L1" +putexcel A6 = "UKC" +putexcel A7 = "UKD" +putexcel A8 = "UKE" +putexcel A9 = "UKF" +putexcel A10 = "UKG" +putexcel A11 = "UKH" +putexcel A12 = "UKJ" +putexcel A13 = "UKK" +putexcel A14 = "UKL" +putexcel A15 = "UKM" +putexcel A16 = "UKN" +putexcel A17 = "Ydses_c5_Q2_L1" +putexcel A18 = "Ydses_c5_Q3_L1" +putexcel A19 = "Ydses_c5_Q4_L1" +putexcel A20 = "Ydses_c5_Q5_L1" +putexcel A21 = "Dlltsd_L1" +putexcel A22 = "Dls_L1" +putexcel A23 = "Dag_L1" +putexcel A24 = "Dag_sq_L1" +putexcel A25 = "Deh_c3_Medium" +putexcel A26 = "Deh_c3_Low" +putexcel A27 = "EthnicityAsian" +putexcel A28 = "EthnicityBlack" +putexcel A29 = "EthnicityOther" +putexcel A30 = "Dgn" +putexcel A31 = "Year_transformed" +putexcel A32 = "Constant" putexcel B1 = "COEFFICIENT" putexcel C1 = "D_Home_owner_L1" putexcel D1 = "Dcpst_Single_L1" -putexcel E1 = "Dcpst_PreviouslyPartnered_L1" -putexcel F1 = "Dnc_L1" -putexcel G1 = "Dhe_pcs_L1" -putexcel H1 = "UKC" -putexcel I1 = "UKD" -putexcel J1 = "UKE" -putexcel K1 = "UKF" -putexcel L1 = "UKG" -putexcel M1 = "UKH" -putexcel N1 = "UKJ" -putexcel O1 = "UKK" -putexcel P1 = "UKL" -putexcel Q1 = "UKM" -putexcel R1 = "UKN" -putexcel S1 = "Ydses_c5_Q2_L1" -putexcel T1 = "Ydses_c5_Q3_L1" -putexcel U1 = "Ydses_c5_Q4_L1" -putexcel V1 = "Ydses_c5_Q5_L1" -putexcel W1 = "Dlltsd_L1" -putexcel X1 = "Dls_L1" -putexcel Y1 = "Dag_L1" -putexcel Z1 = "Dag_sq_L1" -putexcel AA1 = "Deh_c3_Medium" -putexcel AB1 = "Deh_c3_Low" -putexcel AC1 = "EthnicityAsian" -putexcel AD1 = "EthnicityBlack" -putexcel AE1 = "EthnicityOther" -putexcel AF1 = "Dgn" -putexcel AG1 = "Year_transformed" -putexcel AH1 = "Constant" +putexcel E1 = "Dnc_L1" +putexcel F1 = "Dhe_pcs_L1" +putexcel G1 = "UKC" +putexcel H1 = "UKD" +putexcel I1 = "UKE" +putexcel J1 = "UKF" +putexcel K1 = "UKG" +putexcel L1 = "UKH" +putexcel M1 = "UKJ" +putexcel N1 = "UKK" +putexcel O1 = "UKL" +putexcel P1 = "UKM" +putexcel Q1 = "UKN" +putexcel R1 = "Ydses_c5_Q2_L1" +putexcel S1 = "Ydses_c5_Q3_L1" +putexcel T1 = "Ydses_c5_Q4_L1" +putexcel U1 = "Ydses_c5_Q5_L1" +putexcel V1 = "Dlltsd_L1" +putexcel W1 = "Dls_L1" +putexcel X1 = "Dag_L1" +putexcel Y1 = "Dag_sq_L1" +putexcel Z1 = "Deh_c3_Medium" +putexcel AA1 = "Deh_c3_Low" +putexcel AB1 = "EthnicityAsian" +putexcel AC1 = "EthnicityBlack" +putexcel AD1 = "EthnicityOther" +putexcel AE1 = "Dgn" +putexcel AF1 = "Year_transformed" +putexcel AG1 = "Constant" * save RMSE putexcel set "$dir_results/reg_RMSE.xlsx", sheet("UK") modify @@ -1213,7 +1207,7 @@ forvalues i = 1/2 { } mkmat v*, matrix(var) -putexcel set "$dir_results/reg_health_wellbeing", sheet("UK_DLS2_Females") modify +putexcel set "$dir_results/reg_health_wellbeing", sheet("UK_DLS2_Females", replace) modify putexcel C2 = matrix(var) restore @@ -1359,7 +1353,7 @@ forvalues i = 1/2 { } mkmat v*, matrix(var) -putexcel set "$dir_results/reg_health_wellbeing", sheet("UK_DLS2_Males") modify +putexcel set "$dir_results/reg_health_wellbeing", sheet("UK_DLS2_Males", replace) modify putexcel C2 = matrix(var) restore diff --git a/input/InitialPopulations/training/population_initial_UK_2019.csv b/input/InitialPopulations/training/population_initial_UK_2019.csv index cfdd2584d..c7146e1cb 100644 --- a/input/InitialPopulations/training/population_initial_UK_2019.csv +++ b/input/InitialPopulations/training/population_initial_UK_2019.csv @@ -1,4 +1,4 @@ -idHh,idBu,idPers,idPartner,idMother,idFather,statCollectionWave,demMaleFlag,demAge,demNChild0to2,demNChild,eduSpellFlag,eduHighestC3,eduExitSampleFlag,healthDsblLongtermFlag,healthSelfRated,yEmpPersGrossMonth,yNonBenPersGrossMonth,yMiscPersGrossMonth,demPartnerNYear,demAgePartnerDiff,yPersAndPartnerGrossDiffMonth,eduReturnFlag,eduHighestMotherC3,eduHighestFatherC3,statInterviewYear,healthWbScore0to36,demWbScore0to12,labHrsWorkWeek,labHrsWorkWeekL1,labC4,healthPsyDstrssFlag,demAdultChildFlag,labWageHrly,labWageHrlyL1,careNeedFlag,careHrsFormal,careHrsFromPartner,careHrsFromDaughter,careHrsFromSon,careHrsFromOther,careCareFormal,careHrsProvidedWeek,yBenReceivedFlag,yBenNonUCReceivedFlag,yBenUCReceivedFlag,yCapitalPersMonth,yPensPersGrossMonth,aidhrs,careWho,healthMentalMcs,healthPhysicalPcs,healthMentalPartnerMcs,healthPhysicalPartnerPcs,demLifeSatScore1to7,demEthnC4,demEthnC6,labUnempFlag,yFinDstrssFlag,labEmpNyear,demRgn,yHhQuintilesMonthC5,wealthPrptyFlag,wgtHhCross,wealthTotValue,wealthPensValue,wealthPrptyValue,wealthMortgageDebtValue,yDispMonth +idHh,idBu,idPers,idPartner,idMother,idFather,statCollectionWave,demMaleFlag,demAge,demNChild0to2,demNChild,eduSpellFlag,eduHighestC3,eduExitSampleFlag,healthDsblLongtermFlag,healthSelfRated,yEmpPersGrossMonth,yNonBenPersGrossMonth,yMiscPersGrossMonth,demPartnerNYear,demAgePartnerDiff,yPersAndPartnerGrossDiffMonth,eduReturnFlag,eduHighestMotherC3,eduHighestFatherC3,statInterviewYear,healthWbScore0to36,demWbScore0to12,labHrsWorkWeek,labHrsWorkWeekL1,labC4,healthPsyDstrssFlag,demAdultChildFlag,labWageHrly,labWageHrlyL1,careNeedFlag,careHrsFormal,careHrsFromPartner,careHrsFromDaughter,careHrsFromSon,careHrsFromOther,careCareFormal,careHrsProvidedWeek,yBenReceivedFlag,yBenNonUCReceivedFlag,yBenUCReceivedFlag,yCapitalPersMonth,yPensPersGrossMonth,aidhrs,careWho,healthMentalMcs,healthPhysicalPcs,healthMentalPartnerMcs,healthPhysicalPartnerPcs,demLifeSatScore0to10,demEthnC4,demEthnC6,labUnempFlag,yFinDstrssFlag,labEmpNyear,demRgn,yHhQuintilesMonthC5,wealthPrptyFlag,wgtHhCross,wealthTotValue,wealthPensValue,wealthPrptyValue,wealthMortgageDebtValue,yDispMonth 1,1,1,-9,-9,-9,1,0,61,0,0,0,2,-9,0,4,6.725114889498321,7.898206598471436,7.253384840698923,0,0,-1062.469215318536,0,2,2,2019,11,0,15,11,1,0,0,8.015179360993026,8.015179360993026,0,0,0,0,0,0,0,0,0,0,0,0,7.526514096434597,0,0,57.16,56.15,-9,-9,5,1,1,0,0,9,9,3,0,953,676131.0275408182,316456.4680975397,193683.8957471466,63936.64369794785,-377.4915825240205 2,2,2,3,-9,-9,1,1,68,0,0,0,1,-9,0,3,7.886993691667886,8.544583694034513,7.38271831749168,49,1,60.31366416029789,0,2,3,2019,6,0,25,30,1,0,0,11.51763815191938,11.51763815191938,0,0,0,0,0,0,0,0,1,1,0,6.387541206929813,7.104293718128605,0,0,51.41,56.15,42.24,58.9,6,1,1,0,0,9,9,4,1,715,2410787.41512763,1690222.068883574,706502.8913574461,104302.781800875,4909.79139019544 2,2,3,2,-9,-9,1,0,67,0,0,0,1,-9,0,4,7.710280110469539,8.041401738620744,6.862359188400778,49,-1,31.38179225666527,0,2,1,2019,18,7,15,25,1,1,0,17.98276105377562,17.98276105377562,0,0,0,0,0,0,0,0,1,1,0,4.429519137618809,7.08824878144737,0,0,42.24,58.9,51.41,56.15,6,1,1,0,0,7,9,4,1,715,2410787.41512763,1690222.068883574,706502.8913574461,104302.781800875,4909.79139019544 diff --git a/input/reg_health_mental.xlsx b/input/reg_health_mental.xlsx index 72e4bc783..93cf80d97 100644 Binary files a/input/reg_health_mental.xlsx and b/input/reg_health_mental.xlsx differ diff --git a/input/reg_health_wellbeing.xlsx b/input/reg_health_wellbeing.xlsx index 6dcbeb2da..f1f542fbd 100644 Binary files a/input/reg_health_wellbeing.xlsx and b/input/reg_health_wellbeing.xlsx differ diff --git a/pom.xml b/pom.xml index 507cc53b1..d85b0752c 100644 --- a/pom.xml +++ b/pom.xml @@ -86,6 +86,25 @@ + + org.apache.maven.plugins + maven-javadoc-plugin + 3.12.0 + + + + filter + m + Applies to: + + + updates + m + Changes the following variables: + + + + @@ -109,7 +128,7 @@ com.github.jasmineRepo JAS-mine-core - 4.3.24 + 4.3.25 compile diff --git a/src/main/java/simpaths/data/ManagerRegressions.java b/src/main/java/simpaths/data/ManagerRegressions.java index df329fce2..d955393f6 100644 --- a/src/main/java/simpaths/data/ManagerRegressions.java +++ b/src/main/java/simpaths/data/ManagerRegressions.java @@ -37,9 +37,6 @@ public static LinearRegression getLinearRegression(RegressionName regression) { case HealthHM2LevelFemales -> { return Parameters.getRegHealthHM2LevelFemales(); } - case HealthHM1Case -> { - return Parameters.getRegHealthHM1Case(); - } case HealthHM2CaseMales -> { return Parameters.getRegHealthHM2CaseMales(); } @@ -196,6 +193,9 @@ public static OrderedRegression getOrderedRegression(RegressionName regression) throw new RuntimeException("requested ordered regression is not recognised: " + regression.name()); switch (regression) { + case HealthHM1Case -> { + return Parameters.getRegHealthHM1Case(); + } default -> { throw new RuntimeException("unrecognised regression (1)"); } diff --git a/src/main/java/simpaths/data/Parameters.java b/src/main/java/simpaths/data/Parameters.java index b5723d1db..3f805dbda 100644 --- a/src/main/java/simpaths/data/Parameters.java +++ b/src/main/java/simpaths/data/Parameters.java @@ -131,7 +131,7 @@ public class Parameters { "healthWbScore0to36", //mental health status "demWbScore0to12", //mental health status case based "healthPsyDstrssFlag", //mental health status case based dummy (1 = psychologically distressed) - "demLifeSatScore1to7", //life satisfaction + "demLifeSatScore0to10", //life satisfaction "yFinDstrssFlag", //financial distress "demPartnerNYear", //years in partnership "demAgePartnerDiff", //partners age difference @@ -742,7 +742,7 @@ else if(numberOfChildren <= 5) { private static LinearRegression regHealthHM2LevelMales; private static LinearRegression regHealthHM2LevelFemales; - private static LinearRegression regHealthHM1Case; + private static OrderedRegression regHealthHM1Case; private static LinearRegression regHealthHM2CaseMales; private static LinearRegression regHealthHM2CaseFemales; @@ -1236,6 +1236,15 @@ public static void loadParameters(Country country, int maxAgeModel, boolean enab coeffCovarianceHM1Case = RegressionUtils.bootstrap(coeffCovarianceHM1Case); coeffCovarianceHM2CaseMales = RegressionUtils.bootstrap(coeffCovarianceHM2CaseMales); coeffCovarianceHM2CaseFemales = RegressionUtils.bootstrap(coeffCovarianceHM2CaseFemales); + coeffCovarianceDHE_MCS1 = RegressionUtils.bootstrap(coeffCovarianceDHE_MCS1); + coeffCovarianceDHE_MCS2Males = RegressionUtils.bootstrap(coeffCovarianceDHE_MCS2Males); + coeffCovarianceDHE_MCS2Females = RegressionUtils.bootstrap(coeffCovarianceDHE_MCS2Females); + coeffCovarianceDHE_PCS1 = RegressionUtils.bootstrap(coeffCovarianceDHE_PCS1); + coeffCovarianceDHE_PCS2Males = RegressionUtils.bootstrap(coeffCovarianceDHE_PCS2Males); + coeffCovarianceDHE_PCS2Females = RegressionUtils.bootstrap(coeffCovarianceDHE_PCS2Females); + coeffCovarianceDLS1 = RegressionUtils.bootstrap(coeffCovarianceDLS1); + coeffCovarianceDLS2Males = RegressionUtils.bootstrap(coeffCovarianceDLS2Males); + coeffCovarianceDLS2Females = RegressionUtils.bootstrap(coeffCovarianceDLS2Females); //Social care coeffCovarianceSocialCareS1a = RegressionUtils.bootstrap(coeffCovarianceSocialCareS1a); @@ -1357,7 +1366,7 @@ public static void loadParameters(Country country, int maxAgeModel, boolean enab regHealthHM2LevelMales = new LinearRegression(coeffCovarianceHM2LevelMales); regHealthHM2LevelFemales = new LinearRegression(coeffCovarianceHM2LevelFemales); - regHealthHM1Case = new LinearRegression(coeffCovarianceHM1Case); + regHealthHM1Case = new OrderedRegression(RegressionType.OrderedLogit,DhmGhq.class,coeffCovarianceHM1Case); regHealthHM2CaseMales = new LinearRegression(coeffCovarianceHM2CaseMales); regHealthHM2CaseFemales = new LinearRegression(coeffCovarianceHM2CaseFemales); @@ -1874,7 +1883,7 @@ public static void setEmploymentsFurloughedFlex(MultiKeyCoefficientMap employmen public static LinearRegression getRegHealthHM1Level() { return regHealthHM1Level; } public static LinearRegression getRegHealthHM2LevelMales() { return regHealthHM2LevelMales; } public static LinearRegression getRegHealthHM2LevelFemales() { return regHealthHM2LevelFemales; } - public static LinearRegression getRegHealthHM1Case() {return regHealthHM1Case;} + public static OrderedRegression getRegHealthHM1Case() {return regHealthHM1Case;} public static LinearRegression getRegHealthHM2CaseMales() {return regHealthHM2CaseMales;} public static LinearRegression getRegHealthHM2CaseFemales() {return regHealthHM2CaseFemales;} @@ -3164,7 +3173,11 @@ public static void databaseSetup(Country country, boolean executeWithGui, int st Parameters.setTrainingFlag(true); // populate new database for starting data - DataParser.databaseFromCSV(country, executeWithGui); // Initial database tables + try { + DataParser.databaseFromCSV(country, executeWithGui); // Initial database tables + } catch (IllegalArgumentException e) { + throw new RuntimeException("Error populating initial database from CSV files: " + e.getMessage()); + } // populate new database for tax donors String taxDonorInputFilename = "tax_donor_population_" + country; diff --git a/src/main/java/simpaths/data/RegressionName.java b/src/main/java/simpaths/data/RegressionName.java index 77e659d86..ee17f6442 100644 --- a/src/main/java/simpaths/data/RegressionName.java +++ b/src/main/java/simpaths/data/RegressionName.java @@ -25,7 +25,7 @@ public enum RegressionName { HealthHM1Level(RegressionType.Linear), HealthHM2LevelMales(RegressionType.Linear), HealthHM2LevelFemales(RegressionType.Linear), - HealthHM1Case(RegressionType.Linear), + HealthHM1Case(RegressionType.OrderedLogit), HealthHM2CaseMales(RegressionType.Linear), HealthHM2CaseFemales(RegressionType.Linear), diff --git a/src/main/java/simpaths/data/startingpop/DataParser.java b/src/main/java/simpaths/data/startingpop/DataParser.java index 9716ef9e0..d716d1c29 100644 --- a/src/main/java/simpaths/data/startingpop/DataParser.java +++ b/src/main/java/simpaths/data/startingpop/DataParser.java @@ -250,7 +250,7 @@ private static void parse(String inputFileLocation, String inputFileName, Connec + "ALTER TABLE " + personTable + " ALTER COLUMN HEALTHMENTALPARTNERMCS DECIMAL(4, 2);" + "ALTER TABLE " + personTable + " ALTER COLUMN HEALTHPHYSICALPCS DECIMAL(4, 2);" + "ALTER TABLE " + personTable + " ALTER COLUMN HEALTHPHYSICALPARTNERPCS DECIMAL(4, 2);" - + "ALTER TABLE " + personTable + " ALTER COLUMN DEMLIFESATSCORE1TO7 INT;" + + "ALTER TABLE " + personTable + " ALTER COLUMN DEMLIFESATSCORE0to10 DECIMAL(4, 2);" + "ALTER TABLE " + personTable + " ALTER COLUMN HEALTHWBSCORE0TO36 INT;" + "ALTER TABLE " + personTable + " ALTER COLUMN HEALTHPSYDSTRSSFLAG INT;" + "ALTER TABLE " + personTable + " ALTER COLUMN DEMWBSCORE0TO12 INT;" diff --git a/src/main/java/simpaths/data/statistics/HealthStatistics.java b/src/main/java/simpaths/data/statistics/HealthStatistics.java index ab8c34597..6f10222b0 100644 --- a/src/main/java/simpaths/data/statistics/HealthStatistics.java +++ b/src/main/java/simpaths/data/statistics/HealthStatistics.java @@ -83,22 +83,22 @@ public class HealthStatistics { // Life Satisfaction numeric @Column(name = "dls_mean") - private double demLifeSatScore1to7Avg; + private double demLifeSatScore0to10Avg; @Column(name = "dls_median") - private double demLifeSatScore1to7P50; + private double demLifeSatScore0to10P50; @Column(name = "dls_p_10") - private double demLifeSatScore1to7P10; + private double demLifeSatScore0to10P10; @Column(name = "dls_p_90") - private double demLifeSatScore1to7P90; + private double demLifeSatScore0to10P90; @Column(name = "dls_p_25") - private double demLifeSatScore1to7P25; + private double demLifeSatScore0to10P25; @Column(name = "dls_p_75") - private double demLifeSatScore1to7P75; + private double demLifeSatScore0to10P75; @Column(name = "qualys") private double healthLifeYearQualAdj; @@ -110,8 +110,6 @@ public class HealthStatistics { @Column(name = "N") private int healthNObsSubGroup; - @Transient - final static double WELLBEING_MEASURE_ADJUSTMENT = (double) 11 / 7; public void setGender(String demSex) { this.demSex = demSex; @@ -189,28 +187,28 @@ public void setDhe_pcs_p_75(double healthPhysicalPcsP75) { this.healthPhysicalPcsP75 = healthPhysicalPcsP75; } - public void setDls_mean(double demLifeSatScore1to7Avg) { - this.demLifeSatScore1to7Avg = demLifeSatScore1to7Avg; + public void setDls_mean(double demLifeSatScore0to10Avg) { + this.demLifeSatScore0to10Avg = demLifeSatScore0to10Avg; } - public void setDls_median(double demLifeSatScore1to7P50) { - this.demLifeSatScore1to7P50 = demLifeSatScore1to7P50; + public void setDls_median(double demLifeSatScore0to10P50) { + this.demLifeSatScore0to10P50 = demLifeSatScore0to10P50; } - public void setDls_p_10(double demLifeSatScore1to7P10) { - this.demLifeSatScore1to7P10 = demLifeSatScore1to7P10; + public void setDls_p_10(double demLifeSatScore0to10P10) { + this.demLifeSatScore0to10P10 = demLifeSatScore0to10P10; } - public void setDls_p_90(double demLifeSatScore1to7P90) { - this.demLifeSatScore1to7P90 = demLifeSatScore1to7P90; + public void setDls_p_90(double demLifeSatScore0to10P90) { + this.demLifeSatScore0to10P90 = demLifeSatScore0to10P90; } - public void setDls_p_25(double demLifeSatScore1to7P25) { - this.demLifeSatScore1to7P25 = demLifeSatScore1to7P25; + public void setDls_p_25(double demLifeSatScore0to10P25) { + this.demLifeSatScore0to10P25 = demLifeSatScore0to10P25; } - public void setDls_p_75(double demLifeSatScore1to7P75) { - this.demLifeSatScore1to7P75 = demLifeSatScore1to7P75; + public void setDls_p_75(double demLifeSatScore0to10P75) { + this.demLifeSatScore0to10P75 = demLifeSatScore0to10P75; } public void setN(int n) { @@ -231,9 +229,9 @@ public void update(SimPathsModel model, String gender_s) { AgeGenderCSfilter ageGenderCSfilter; if (gender_s.equals("Total")) { - ageGenderCSfilter = new AgeGenderCSfilter(18, 65); + ageGenderCSfilter = new AgeGenderCSfilter(25, 64); } else { - ageGenderCSfilter = new AgeGenderCSfilter(18, 65, Gender.valueOf(gender_s)); + ageGenderCSfilter = new AgeGenderCSfilter(25, 64, Gender.valueOf(gender_s)); } // set gender @@ -325,7 +323,7 @@ public void update(SimPathsModel model, String gender_s) { wellbys.applyFunction(); - setWellbys(wellbys.getDoubleValue(IDoubleSource.Variables.Default) * WELLBEING_MEASURE_ADJUSTMENT); + setWellbys(wellbys.getDoubleValue(IDoubleSource.Variables.Default)); // count CrossSection.Integer n_persons = new CrossSection.Integer(model.getPersons(), Person.class, "getPersonCount", true); diff --git a/src/main/java/simpaths/experiment/SimPathsMultiRun.java b/src/main/java/simpaths/experiment/SimPathsMultiRun.java index cca74b01a..31fe45c55 100644 --- a/src/main/java/simpaths/experiment/SimPathsMultiRun.java +++ b/src/main/java/simpaths/experiment/SimPathsMultiRun.java @@ -121,7 +121,11 @@ public static void main(String[] args) { if (flagDatabaseSetup) { - Parameters.databaseSetup(country, executeWithGui, startYear); + try { + Parameters.databaseSetup(country, executeWithGui, startYear); + } catch (RuntimeException e) { + throw e; + } } else { // standard simulation diff --git a/src/main/java/simpaths/experiment/SimPathsObserver.java b/src/main/java/simpaths/experiment/SimPathsObserver.java index 0fbe244a5..add3dde52 100644 --- a/src/main/java/simpaths/experiment/SimPathsObserver.java +++ b/src/main/java/simpaths/experiment/SimPathsObserver.java @@ -893,9 +893,9 @@ else if(edu.equals(Education.High)) { MaleAgeGroupCSfilter maleAgeFilter = new MaleAgeGroupCSfilter(ageFrom, ageTo); FemaleAgeGroupCSfilter femaleAgeFilter = new FemaleAgeGroupCSfilter(ageFrom, ageTo); - Weighted_CrossSection.Double maleCS = new Weighted_CrossSection.Double(model.getPersons(), Person.class, "getDhm", true); + Weighted_CrossSection.Double maleCS = new Weighted_CrossSection.Double(model.getPersons(), Person.class, "getHealthWbScore0to36", true); maleCS.setFilter(maleAgeFilter); - Weighted_CrossSection.Double femaleCS = new Weighted_CrossSection.Double(model.getPersons(), Person.class, "getDhm", true); + Weighted_CrossSection.Double femaleCS = new Weighted_CrossSection.Double(model.getPersons(), Person.class, "getHealthWbScore0to36", true); femaleCS.setFilter(femaleAgeFilter); TimeSeriesSimulationPlotter healthMentalAgePlotter = new TimeSeriesSimulationPlotter("Psychological distress score by age: " + ageFilter.getAgeFrom() + " - " + ageFilter.getAgeTo(), ""); @@ -993,9 +993,9 @@ else if(edu.equals(Education.High)) { MaleAgeGroupCSfilter maleAgeFilter = new MaleAgeGroupCSfilter(ageFrom, ageTo); FemaleAgeGroupCSfilter femaleAgeFilter = new FemaleAgeGroupCSfilter(ageFrom, ageTo); - Weighted_CrossSection.Integer maleCS = new Weighted_CrossSection.Integer(model.getPersons(), Person.class, "getDls", true); + Weighted_CrossSection.Integer maleCS = new Weighted_CrossSection.Integer(model.getPersons(), Person.class, "getDemLifeSatScore1to10", true); maleCS.setFilter(maleAgeFilter); - Weighted_CrossSection.Integer femaleCS = new Weighted_CrossSection.Integer(model.getPersons(), Person.class, "getDls", true); + Weighted_CrossSection.Integer femaleCS = new Weighted_CrossSection.Integer(model.getPersons(), Person.class, "getDemLifeSatScore1to10", true); femaleCS.setFilter(femaleAgeFilter); TimeSeriesSimulationPlotter lifeSatisfactionAgePlotter = new TimeSeriesSimulationPlotter("Life satisfaction score by age: " + ageFilter.getAgeFrom() + " - " + ageFilter.getAgeTo(), ""); diff --git a/src/main/java/simpaths/model/Person.java b/src/main/java/simpaths/model/Person.java index af60fb27c..56c72e02b 100644 --- a/src/main/java/simpaths/model/Person.java +++ b/src/main/java/simpaths/model/Person.java @@ -142,9 +142,8 @@ public class Person implements EventListener, IDoubleSource, IIntSource, Weight, @Transient private Double healthPhysicalPcsL1; //physical well-being: SF12 physical component summary score lag 1 private Double healthMentalPartnerMcs; //mental well-being: SF12 mental component summary score (partner) private Double healthPhysicalPartnerPcs; //physical well-being: SF12 physical component summary score (partner) - private Integer demLifeSatScore1to7; //life satisfaction - score 1-7 - @Transient private Double demLifeSatScore1to7Pred; - @Transient private Integer demLifeSatScore1to7L1; //life satisfaction - score 1-7 lag 1 + private Double demLifeSatScore0to10; //life satisfaction - score 0-10 + @Transient private Double demLifeSatScore0to10L1; //life satisfaction - score 0-10 lag 1 @Column(name="demLifeSatEQ5D") private Double demLifeSatEQ5D; @Column(name="yFinDstrssFlag") private Boolean yFinDstrssFlag; @Transient private Boolean yBenReceivedFlagL1; // Lag(1) of whether person receives benefits @@ -293,8 +292,11 @@ public Person(Gender gender, Person mother) { eduReturnFlag = Indicator.False; wgt = mother.getWgt(); //Newborn has same weight as mother (the number of newborns will then be aligned in fertility alignment) healthSelfRated = Dhe.VeryGood; - healthWbScore0to36 = 9.; //Set to median for under 18's as a placeholder + healthWbScore0to36 = 10.; //Set to median for under 18's as a placeholder healthPsyDstrss = 0.; + healthMentalMcs = 48.; + healthPhysicalPcs = 56.; + demLifeSatScore0to10 = 6.; eduHighestC3 = Education.Low; demEthnC6 = mother.getDot01(); labC4 = Les_c4.Student; //Set lag activity status as Student, i.e. in education from birth @@ -493,16 +495,16 @@ else if (demAge > Parameters.MAX_AGE_TO_LEAVE_CONTINUOUS_EDUCATION) healthPsyDstrss = Objects.requireNonNullElse(originalPerson.healthPsyDstrss, 0.); healthPsyDstrssL1 = Objects.requireNonNullElse(originalPerson.healthPsyDstrssL1, healthPsyDstrss); - demLifeSatScore1to7 = originalPerson.demLifeSatScore1to7; + demLifeSatScore0to10 = originalPerson.demLifeSatScore0to10; healthMentalMcs = originalPerson.healthMentalMcs; healthPhysicalPcs = originalPerson.healthPhysicalPcs; healthMentalPartnerMcs = originalPerson.healthMentalPartnerMcs; healthPhysicalPartnerPcs = originalPerson.healthPhysicalPartnerPcs; - if (originalPerson.demLifeSatScore1to7L1 != null) { - demLifeSatScore1to7L1 = originalPerson.demLifeSatScore1to7L1; + if (originalPerson.demLifeSatScore0to10L1 != null) { + demLifeSatScore0to10L1 = originalPerson.demLifeSatScore0to10L1; } else { - demLifeSatScore1to7L1 = originalPerson.demLifeSatScore1to7; + demLifeSatScore0to10L1 = originalPerson.demLifeSatScore0to10; } if (originalPerson.healthWbScore0to36L1 != null) { @@ -579,7 +581,7 @@ public Person(Long id, long statSeed) { // initialise random draws this.statSeed = statSeed; - statInnovations = new Innovations(33, 1, 1, statSeed); + statInnovations = new Innovations(37, 1, 1, statSeed); //Draw desired age and wage differential for parametric partnership formation for people above age to get married: double[] sampleDifferentials = setMarriageTargets(); @@ -715,7 +717,9 @@ public enum Processes { 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 + HealthMentalHM1HM2Cases, //Case-based prediction for psychological distress, Steps 1 and 2 together (no longer used) + HealthMentalHM1Case, //Case-based prediction for psychological distress, Step 1 + HealthMentalHM2Case, //Case-based prediction for psychological distress, Step 2 HealthMCS1, HealthMCS2, HealthPCS1, @@ -810,8 +814,11 @@ public void onEvent(Enum type) { case LifeSatisfaction2 -> { lifeSatisfaction2(); } - case HealthMentalHM1HM2Cases -> { - healthMentalHM1HM2Cases(); + case HealthMentalHM1Case -> { + healthMentalHM1Case(); + } + case HealthMentalHM2Case -> { + healthMentalHM2Case(); } case HealthEQ5D -> { healthEQ5D(); @@ -1002,22 +1009,40 @@ private void updateFinancialDistress() { double prob = Parameters.getRegFinancialDistress().getProbability(this, Person.DoublesVariables.class); yFinDstrssFlag = statInnovations.getDoubleDraw(32) < prob; } - - /* - This method corresponds to Step 1 of the mental health evaluation: predict level of mental health on the GHQ-12 Likert scale based on observable characteristics + + // * HEALTH AND WELLBEING ******************************************************************** + + /** + * Health and wellbeing - GHQ-12 subjective wellbeing, Likert scale 0-36 step 1 + * + *

Calculates the 'baseline' yearly update to the GHQ-12 likert (level) score ({@code healthWbScore0to36}) based on demographic variables. + * Runs before {@link #healthMentalHM2Level()}.

+ * + * @filter Age 16+ + * @updates {@code Person.healthWbScore0to36} + * @see scghq1_dv */ protected void healthMentalHM1Level() { if (demAge >= 16) { double score = Parameters.getRegHealthHM1Level().getScore(this, Person.DoublesVariables.class); double rmse = Parameters.getRMSEForRegression("HM1_L"); double gauss = Parameters.getStandardNormalDistribution().inverseCumulativeProbability(statInnovations.getDoubleDraw(1)); - healthWbScore0to36 = constrainDhmEstimate(score + rmse*gauss); + healthWbScore0to36 = score + rmse*gauss; } } - /* - This method corresponds to Step 2 of the mental health evaluation: increment / decrement the outcome of Step 1 depending on exposures that individual experienced. - Filtering: only applies to those with Age>=16 & Age<=64. Different estimates for males and females. + + /** + * Health and wellbeing - GHQ-12 subjective wellbeing, Likert scale 0-36 step 2 + * + *

Updates GHQ-12 likert (level) score ({@code healthWbScore0to36}) from the causal effects of economic transitions. + * Applies separate estimates for Male and Female Persons. + * Runs after {@link #healthMentalHM1Level()}

+ * + * @filter Age 25-64 + * @updates {@code Person.healthWbScore0to36} + * @see scghq1_dv + * */ protected void healthMentalHM2Level() { @@ -1030,109 +1055,254 @@ protected void healthMentalHM2Level() { dhmPrediction = Parameters.getRegHealthHM2LevelFemales().getScore(this, Person.DoublesVariables.class); healthWbScore0to36 = constrainDhmEstimate(dhmPrediction+ healthWbScore0to36); } else System.out.println("healthMentalHM2 method in Person class: Person has no gender!"); + } else if (healthWbScore0to36 != null) { + healthWbScore0to36 = constrainDhmEstimate(healthWbScore0to36); } } - protected void healthMCS1() { - double mcsPrediction; - mcsPrediction = Parameters.getRegHealthMCS1().getScore(this, Person.DoublesVariables.class); - healthMentalMcs = mcsPrediction; + /** + * Health and wellbeing - GHQ-12 subjective wellbeing, Caseness scale 0-12 step 1 + * + *

Calculates the 'baseline' yearly update to the GHQ-12 Caseness (cases) score ({@code healthPsyDstrss}) based on demographic variables. + * Runs before {@link #healthMentalHM2Case()}.

+ * + * @filter Age 16+ + * @updates {@code Person.healthPsyDstrss} + * @see scghq2_dv + */ + protected void healthMentalHM1Case() { + if (demAge >= 16) { + Map probs = ManagerRegressions.getProbabilities(this, RegressionName.HealthHM1Case); + MultiValEvent event = new MultiValEvent(probs, statInnovations.getDoubleDraw(36)); + healthPsyDstrss = Double.valueOf(event.eval().getValue()); + } + } + /** + * Health and wellbeing - GHQ-12 subjective wellbeing, Caseness scale 0-12 step 2 + * + *

Updates GHQ-12 Caseness (cases) score ({@code healthPsyDstrss}) from the causal effects of economic transitions. + * Applies separate estimates for Male and Female Persons. + * Runs after {@link #healthMentalHM1Case()}

+ * + * @filter Age 25-64 + * @updates {@code Person.healthPsyDstrss} + * @see scghq2_dv + */ + protected void healthMentalHM2Case() { + double dhmGhqPrediction; + if (demAge >= 25 && demAge <= 64) { + if (Gender.Male.equals(getDemMaleFlag())) { + dhmGhqPrediction = Parameters.getRegHealthHM2CaseMales().getScore(this, Person.DoublesVariables.class); + healthPsyDstrss = constrainhealthPsyDstrssEstimate(dhmGhqPrediction+ healthPsyDstrss); + } else if (Gender.Female.equals(getDemMaleFlag())) { + dhmGhqPrediction = Parameters.getRegHealthHM2CaseFemales().getScore(this, Person.DoublesVariables.class); + healthPsyDstrss = constrainhealthPsyDstrssEstimate(dhmGhqPrediction+ healthPsyDstrss); + } else System.out.println("healthMentalHM2 method in Person class: Person has no gender!"); + } else if (healthPsyDstrss != null) { + healthPsyDstrss = constrainhealthPsyDstrssEstimate(healthPsyDstrss); + } } + /** + * Health and wellbeing - Mental Component Summary update step 1 + * + *

Calculates the 'baseline' yearly update to the MCS score ({@code healthMentalMcs}) based on demographic variables. + * Runs before {@link #healthMCS2()}.

+ * + * @filter Age 16+ + * @updates {@code Person.healthMentalMcs} + * @see sf12mcs_dv + */ + protected void healthMCS1() { + + if (demAge >= 16) { + double mcsPrediction = Parameters.getRegHealthMCS1().getScore(this, Person.DoublesVariables.class); + double rmse = Parameters.getRMSEForRegression("DHE_MCS1"); + double gauss = Parameters.getStandardNormalDistribution().inverseCumulativeProbability(statInnovations.getDoubleDraw(33)); + healthMentalMcs = mcsPrediction + rmse * gauss; + } + } + + /** + * Health and wellbeing - Mental Component Summary update step 2 + * + *

Updates MCS score ({@code healthMentalMcs}) from the causal effects of economic transitions. + * Applies separate estimates for Male and Female Persons. + * Runs after {@link #healthMCS1()}

+ * + * @filter Age 25-64 + * @updates {@code Person.healthMentalMcs} + * @see sf12mcs_dv + */ protected void healthMCS2() { double mcsPrediction; - if (Gender.Male.equals(getDemMaleFlag())) { - mcsPrediction = Parameters.getRegHealthMCS2Males().getScore(this, Person.DoublesVariables.class); - healthMentalMcs = constrainSF12Estimate(mcsPrediction + healthMentalMcs); - } else if (Gender.Female.equals(getDemMaleFlag())) { - mcsPrediction = Parameters.getRegHealthMCS2Females().getScore(this, Person.DoublesVariables.class); - healthMentalMcs = constrainSF12Estimate(mcsPrediction + healthMentalMcs); + if (demAge >= 25 && demAge <= 64) { + if (Gender.Male.equals(getDemMaleFlag())) { + mcsPrediction = Parameters.getRegHealthMCS2Males().getScore(this, Person.DoublesVariables.class); + healthMentalMcs = constrainSF12Estimate(mcsPrediction + healthMentalMcs); + } else if (Gender.Female.equals(getDemMaleFlag())) { + mcsPrediction = Parameters.getRegHealthMCS2Females().getScore(this, Person.DoublesVariables.class); + healthMentalMcs = constrainSF12Estimate(mcsPrediction + healthMentalMcs); + } + } else if (healthMentalMcs != null) { + healthMentalMcs = constrainSF12Estimate(healthMentalMcs); } } + /** + * Health and wellbeing - Physical Component Summary update step 1 + * + *

Calculates the 'baseline' yearly update to the PCS score ({@code healthPhysicalPcs}) based on demographic variables. + * Runs before {@link #healthPCS2()}.

+ * + * @filter Age 16+ + * @updates {@code Person.healthPhysicalPcs} + * @see sf12pcs_dv + */ protected void healthPCS1() { - double pcsPrediction; - pcsPrediction = Parameters.getRegHealthPCS1().getScore(this, Person.DoublesVariables.class); - healthPhysicalPcs = pcsPrediction; - + if (demAge >= 16) { + double pcsPrediction = Parameters.getRegHealthPCS1().getScore(this, Person.DoublesVariables.class); + double rmse = Parameters.getRMSEForRegression("DHE_PCS1"); + double gauss = Parameters.getStandardNormalDistribution().inverseCumulativeProbability(statInnovations.getDoubleDraw(34)); + healthPhysicalPcs = pcsPrediction + rmse * gauss; + } } - + /** + * Health and wellbeing - Physical Component Summary update step 2 + * + *

Updates PCS score ({@code healthPhysicalPcs}) from the causal effects of economic transitions. + * Applies separate estimates for Male and Female Persons. + * Runs after {@link #healthPCS1()}

+ * + * @filter Age 25-64 + * @updates {@code Person.healthPhysicalPcs} + * @see sf12pcs_dv + */ protected void healthPCS2() { double pcsPrediction; - if (Gender.Male.equals(getDemMaleFlag())) { - pcsPrediction = Parameters.getRegHealthPCS2Males().getScore(this, Person.DoublesVariables.class); - healthPhysicalPcs = constrainSF12Estimate(pcsPrediction + healthPhysicalPcs); - } else if (Gender.Female.equals(getDemMaleFlag())) { - pcsPrediction = Parameters.getRegHealthPCS2Females().getScore(this, Person.DoublesVariables.class); - healthPhysicalPcs = constrainSF12Estimate(pcsPrediction + healthPhysicalPcs); + if (demAge >= 25 && demAge <= 64) { + if (Gender.Male.equals(getDemMaleFlag())) { + pcsPrediction = Parameters.getRegHealthPCS2Males().getScore(this, Person.DoublesVariables.class); + healthPhysicalPcs = constrainSF12Estimate(pcsPrediction + healthPhysicalPcs); + } else if (Gender.Female.equals(getDemMaleFlag())) { + pcsPrediction = Parameters.getRegHealthPCS2Females().getScore(this, Person.DoublesVariables.class); + healthPhysicalPcs = constrainSF12Estimate(pcsPrediction + healthPhysicalPcs); + } + } else if (healthPhysicalPcs != null) { + healthPhysicalPcs = constrainSF12Estimate(healthPhysicalPcs); } } + + /** + * Health and wellbeing - Life satisfaction score 0-10 step 1 + * + *

Calculates the 'baseline' yearly update to the Life Satisfaction score ({@code demLifeSatScore0to10}) based on demographic variables. + * Runs before {@link #lifeSatisfaction2()}.

+ * + * @filter Age 16+ + * @updates {@code Person.demLifeSatScore0to10} + * @see sclfsato + */ protected void lifeSatisfaction1() { - double dlsPrediction; - dlsPrediction = Parameters.getRegLifeSatisfaction1().getScore(this, Person.DoublesVariables.class); - demLifeSatScore1to7Pred = dlsPrediction; + if (demAge >= 16) { + double dlsPrediction = Parameters.getRegLifeSatisfaction1().getScore(this, Person.DoublesVariables.class); + double rmse = Parameters.getRMSEForRegression("DLS1"); + double gauss = Parameters.getStandardNormalDistribution().inverseCumulativeProbability(statInnovations.getDoubleDraw(35)); + demLifeSatScore0to10 = dlsPrediction + rmse*gauss; + } } - + /** + * Health and wellbeing - Life satisfaction score 0-10 step 2 + * + *

Updates Life Satisfaction score ({@code demLifeSatScore0to10}) from the causal effects of economic transitions. + * Applies separate estimates for Male and Female Persons. + * Runs after {@link #lifeSatisfaction1()}

+ * + * @filter Age 25-64 + * @updates {@code Person.demLifeSatScore0to10} + * @see sclfsato + */ protected void lifeSatisfaction2() { - double dlsPrediction; - if (Gender.Male.equals(getDemMaleFlag())) { - dlsPrediction = Parameters.getRegLifeSatisfaction2Males().getScore(this, Person.DoublesVariables.class); - demLifeSatScore1to7 = constrainLifeSatisfactionEstimate(dlsPrediction + demLifeSatScore1to7Pred); - } else if (Gender.Female.equals(getDemMaleFlag())) { - dlsPrediction = Parameters.getRegLifeSatisfaction2Females().getScore(this, Person.DoublesVariables.class); - demLifeSatScore1to7 = constrainLifeSatisfactionEstimate(dlsPrediction + demLifeSatScore1to7Pred); + if (demAge >= 25 && demAge <= 64) { + + double dlsPrediction; + if (Gender.Male.equals(getDemMaleFlag())) { + dlsPrediction = Parameters.getRegLifeSatisfaction2Males().getScore(this, Person.DoublesVariables.class); + demLifeSatScore0to10 = constrainLifeSatisfactionEstimate(dlsPrediction + demLifeSatScore0to10); + } else if (Gender.Female.equals(getDemMaleFlag())) { + dlsPrediction = Parameters.getRegLifeSatisfaction2Females().getScore(this, Person.DoublesVariables.class); + demLifeSatScore0to10 = constrainLifeSatisfactionEstimate(dlsPrediction + demLifeSatScore0to10); + } + } else if (demLifeSatScore0to10 != null) { + demLifeSatScore0to10 = constrainLifeSatisfactionEstimate(demLifeSatScore0to10); } } - private void healthEQ5D() { + + /** + * Generate EQ5D score from MCS and PCS + * + *

Calculates an EQ5D score per person from previously updated MCS and PCS scores. + * Loads conversion parameters selected as 'franks' or 'lawrence' at {@link Parameters#eq5dConversionParameters}. + * Estimates are truncated to -0.594 to 1.0.

+ * + * @filter Age 16+ + * @updates {@code Person.demLifeSatEQ5D} + * @see Franks et al., 2004 + * @see Lawrence & Fleishman, 2004 + */ + protected void healthEQ5D() { double eq5dPrediction; - eq5dPrediction = Parameters.getRegEQ5D().getScore(this, Person.DoublesVariables.class); - if (eq5dPrediction > 1) { - demLifeSatEQ5D = 1.0; - } - else if (eq5dPrediction < -0.594) { - demLifeSatEQ5D = -0.594; - } - else { - demLifeSatEQ5D = eq5dPrediction; + if (demAge >= 16) { + + eq5dPrediction = Parameters.getRegEQ5D().getScore(this, Person.DoublesVariables.class); + if (eq5dPrediction > 1) { + demLifeSatEQ5D = 1.0; + } + else if (eq5dPrediction < -0.594) { + demLifeSatEQ5D = -0.594; + } + else { + demLifeSatEQ5D = eq5dPrediction; + } } } - /* - Case-based measure of psychological distress, Steps 1 and 2 modelled together - */ - protected void healthMentalHM1HM2Cases() { - - if (demAge >= 16) { - double tmp_step1_score = 0, tmp_step2_score = 0, tmp_total_score = 0, tmp_probability = 0; - Double tmp_outcome; - tmp_step1_score = Parameters.getRegHealthHM1Case().getScore(this, Person.DoublesVariables.class); // Obtain score from Step 1 of case-based psychological distress model - if (demAge >= 25 && demAge <= 64) { - if (Gender.Male.equals(getDemMaleFlag())) { - tmp_step2_score = Parameters.getRegHealthHM2CaseMales().getScore(this, Person.DoublesVariables.class); // Obtain score from Step 2 of case-based psychological distress model - } else if (Gender.Female.equals(getDemMaleFlag())) { - tmp_step2_score = Parameters.getRegHealthHM2CaseFemales().getScore(this, Person.DoublesVariables.class); // Obtain score from Step 2 of case-based psychological distress model - } else System.out.println("healthMentalHM2 method in Person class: Person has no gender!"); - } - tmp_outcome = constrainhealthPsyDstrssEstimate(tmp_step1_score + tmp_step2_score); - sethealthPsyDstrss(tmp_outcome); + /** + * Constrains GHQ12 Level estimates to valid range, 0-36 + * + * @param healthWbScore0to36 predicted GHQ12 Level score + * @return {@code Person.healthWbScore0to36} Level score constrained to 0-36 + */ + protected Double constrainDhmEstimate(Double healthWbScore0to36) { + if (healthWbScore0to36 < 0.) { + healthWbScore0to36 = 0.; + } else if (healthWbScore0to36 > 36.) { + healthWbScore0to36 = 36.; } + return healthWbScore0to36; } + /** + * Constrains GHQ12 Caseness estimates to valid range, 0-12 + * + * @param healthPsyDstrssFlag predicted GHQ12 Caseness score + * @return {@code Person.healthPsyDstrss} Caseness score constrained to 0-12 + */ protected Double constrainhealthPsyDstrssEstimate(Double healthPsyDstrssFlag) { if (healthPsyDstrssFlag < 0.) { healthPsyDstrssFlag = 0.; @@ -1142,18 +1312,13 @@ protected Double constrainhealthPsyDstrssEstimate(Double healthPsyDstrssFlag) { return healthPsyDstrssFlag; } - /* - Psychological distress on the GHQ-12 scale has no meaning outside of the original values between 0 and 36, but we model this variable on a continuous scale. If the predicted value is outside of this interval, limit it to fall within these values. - */ - protected Double constrainDhmEstimate(Double healthWbScore0to36) { - if (healthWbScore0to36 < 0.) { - healthWbScore0to36 = 0.; - } else if (healthWbScore0to36 > 36.) { - healthWbScore0to36 = 36.; - } - return healthWbScore0to36; - } + /** + * Constrains SF12 (MCS or PCS) estimates to valid range, 0-100 + * + * @param sf12 predicted MCS or PCS score + * @return {@code Person.healthMentalMcs} or {@code Person.healthPhysicalPcs} score constrained to 0-100 + */ protected Double constrainSF12Estimate(double sf12) { if (sf12 < 0.) { sf12 = 0.; @@ -1163,18 +1328,24 @@ protected Double constrainSF12Estimate(double sf12) { return sf12; } - protected Integer constrainLifeSatisfactionEstimate(double dls_estimate) { + /** + * Constrains life satisfaction score to valid range, 0-10 + * + * @param dls_estimate predicted life satisfaction score + * @return {@code Person.demLifeSatScore0to10} score constrained to 0-10 + */ + protected Double constrainLifeSatisfactionEstimate(double dls_estimate) { if (!Parameters.checkFinite(dls_estimate)) { return null; } if (dls_estimate < 1.) { dls_estimate = 1.; - } else if (dls_estimate > 7.) { - dls_estimate = 7.; + } else if (dls_estimate > 10.) { + dls_estimate = 10.; } - return (int) Math.round(dls_estimate); + return dls_estimate; } //Health process defines health using H1a or H1b process @@ -2027,7 +2198,7 @@ private void updateLaggedVariables(boolean initialUpdate) { healthSelfRatedL1 = healthSelfRated; //Update lag(1) of health healthWbScore0to36L1 = healthWbScore0to36; //Update lag(1) of mental health healthPsyDstrssL1 = healthPsyDstrss; - demLifeSatScore1to7L1 = demLifeSatScore1to7; + demLifeSatScore0to10L1 = demLifeSatScore0to10; healthMentalMcsL1 = healthMentalMcs; healthPhysicalPcsL1 = healthPhysicalPcs; demPrptyFlagL1 = getBenefitUnit().isHousingOwned(); @@ -2401,6 +2572,8 @@ public enum DoublesVariables { Cut8, Cut9, Cut10, + Cut11, + Cut12, D_children, D_Children, D_children_2under, // Indicator (dummy variables for presence of children of certain ages in the benefitUnit) @@ -3219,11 +3392,11 @@ else throw new IllegalArgumentException( ); } case Dls -> { - return demLifeSatScore1to7; + return demLifeSatScore0to10; } case Dls_L1 -> { - if (demLifeSatScore1to7L1 != null && demLifeSatScore1to7L1 >= 0.) { - return demLifeSatScore1to7L1; + if (demLifeSatScore0to10L1 != null && demLifeSatScore0to10L1 >= 0.) { + return demLifeSatScore0to10L1; } else return 0.; } case Dhmghq_L1 -> { @@ -3287,7 +3460,7 @@ else throw new IllegalArgumentException( return (Education.Low.equals(eduHighestPartnerC3L1)) ? 1. : 0.; } case He_eq5d -> { - return getHe_eq5d(); + return getDemLifeSatEQ5D(); } case Dhhtp_c4_CoupleChildren_L1, L_Dhhtp_c4_CoupleChildren -> { return (Dhhtp_c4.CoupleChildren.equals(getDemCompHhC4L1())) ? 1.0 : 0.0; @@ -4147,6 +4320,12 @@ else throw new IllegalArgumentException( case Cut10 -> { return 0.; } + case Cut11 -> { + return 0.; + } + case Cut12 -> { + return 0.; + } default -> { throw new IllegalArgumentException("Unsupported regressor " + variableID.name() + " in Person#getDoubleValue"); } @@ -4602,7 +4781,7 @@ public void setDhe(Dhe health) { public double getDheValue() { return (double) healthSelfRated.getValue(); } - public double getDhm() { + public double getHealthWbScore0to36() { double val; if (healthWbScore0to36 == null) { val = -1.0; @@ -4611,12 +4790,12 @@ public double getDhm() { } return val; } - public Integer getDls() { - int val; - if (demLifeSatScore1to7 == null) { - val = -1; + public Double getDemLifeSatScore0to10() { + Double val; + if (demLifeSatScore0to10 == null) { + val = -1.; } else { - val = demLifeSatScore1to7; + val = demLifeSatScore0to10; } return val; } @@ -4700,7 +4879,7 @@ public void setSocialCareProvision_lag1(SocialCareProvision careProvision) { careProvidedFlagL1 = careProvision; } - public void setDhm(Double healthWbScore0to36) { + public void setHealthWbScore0to36(Double healthWbScore0to36) { this.healthWbScore0to36 = healthWbScore0to36; } @@ -4708,16 +4887,16 @@ public void setDhe_lag1(Dhe health) { this.healthSelfRatedL1 = health; } - public void setDhm_lag1(Double healthWbScore0to36) { - this.healthWbScore0to36L1 = healthWbScore0to36; + public void setHealthWbScore0to36L1(Double dhm) { + this.healthWbScore0to36L1 = dhm; } - public Double gethealthPsyDstrss() { + public Double getHealthPsyDstrss() { return healthPsyDstrss; } - public void sethealthPsyDstrss(Double healthPsyDstrssFlag) { - this.healthPsyDstrss = healthPsyDstrssFlag; + public void setHealthPsyDstrss(Double dhm_ghq) { + this.healthPsyDstrss = dhm_ghq; } public Ethnicity getDot01() { @@ -5211,7 +5390,7 @@ else if (getHoursInformalSocialCare()<0.01) public double getSocialCareProvisionState() { // double val = getSocialCareProvision().getValue(); -// if (dag>DecisionParams.MAX_AGE_COHABITATION && val > 0.1 && val < 2.1) +// if (demAge>DecisionParams.MAX_AGE_COHABITATION && val > 0.1 && val < 2.1) // val = 3.0; return (double)getSocialCareProvision().getValue(); } @@ -5698,11 +5877,11 @@ public Long getIdFather() { public static void setPersonIdCounter(long id) {personIdCounter=id;} - public Double getHe_eq5d() { + public Double getDemLifeSatEQ5D() { return demLifeSatEQ5D; } - public void setHe_eq5d(Double demLifeSatEQ5D) { + public void setDemLifeSatEQ5D(Double demLifeSatEQ5D) { this.demLifeSatEQ5D = demLifeSatEQ5D; } diff --git a/src/main/java/simpaths/model/SimPathsModel.java b/src/main/java/simpaths/model/SimPathsModel.java index 2310cb5bd..a5c476922 100644 --- a/src/main/java/simpaths/model/SimPathsModel.java +++ b/src/main/java/simpaths/model/SimPathsModel.java @@ -597,7 +597,8 @@ public void buildSchedule() { // modify the outcome of Step 1 depending on individual's exposures + caseness yearlySchedule.addCollectionEvent(persons, Person.Processes.HealthMentalHM2); //Step 2 of mental health. // update case-based measure - yearlySchedule.addCollectionEvent(persons, Person.Processes.HealthMentalHM1HM2Cases); + yearlySchedule.addCollectionEvent(persons, Person.Processes.HealthMentalHM1Case); + yearlySchedule.addCollectionEvent(persons, Person.Processes.HealthMentalHM2Case); // HEALTH and LIFE SATISFACTION 2 yearlySchedule.addCollectionEvent(persons, Person.Processes.HealthMCS1); //Step 1 of mental health diff --git a/src/main/java/simpaths/model/enums/DhmGhq.java b/src/main/java/simpaths/model/enums/DhmGhq.java new file mode 100644 index 000000000..bcad392b6 --- /dev/null +++ b/src/main/java/simpaths/model/enums/DhmGhq.java @@ -0,0 +1,31 @@ +package simpaths.model.enums; + +import microsim.statistics.regression.IntegerValuedEnum; + +public enum DhmGhq implements IntegerValuedEnum { + + Score0(0), + Score1(1), + Score2(2), + Score3(3), + Score4(4), + Score5(5), + Score6(6), + Score7(7), + Score8(8), + Score9(9), + Score10(10), + Score11(11), + Score12(12); + + private final int value; + DhmGhq(int val) {value = val;} + + @Override + public int getValue() {return value;} + + public Boolean getDepression() {return value >= 4;} + + public Boolean getMentalDisorder() {return value >= 3;} + +} diff --git a/src/test/java/simpaths/integrationtest/expected/EmploymentStatistics1.csv b/src/test/java/simpaths/integrationtest/expected/EmploymentStatistics1.csv index 7e8c4c155..d462bf228 100644 --- a/src/test/java/simpaths/integrationtest/expected/EmploymentStatistics1.csv +++ b/src/test/java/simpaths/integrationtest/expected/EmploymentStatistics1.csv @@ -1,9 +1,9 @@ run,time,id_EmploymentStatistics1,labEmpShare,labEmpToNotEmpShare,labNotEmpToEmpShare,labUnempShare -1,2019.0,1,0.7375197275521223,0.04822544511260465,0.4428874734607219,0.12592408007309577 -1,2020.0,1,0.6523038605230386,0.01010774186382317,0.23182957393483708,0.08684101286841013 -1,2021.0,1,0.7274615704196095,0.010578638796839153,0.2099712368168744,0.09488990444536768 -1,2022.0,1,0.680891772731054,0.011519716437749225,0.1648,0.080026620081524 -2,2019.0,1,0.7375197275521223,0.04822544511260465,0.4428874734607219,0.12592408007309577 -2,2020.0,1,0.6523038605230386,0.01010774186382317,0.23182957393483708,0.08684101286841013 -2,2021.0,1,0.7274615704196095,0.010578638796839153,0.2099712368168744,0.09488990444536768 -2,2022.0,1,0.680891772731054,0.011519716437749225,0.1648,0.080026620081524 \ No newline at end of file +1,2019.0,1,0.7349447628540576,0.049050819478835044,0.44033970276008494,0.12717003073344962 +1,2020.0,1,0.654095364678518,0.010256410256410256,0.23345817727840198,0.08373483967436451 +1,2021.0,1,0.723963095337046,0.017298397354362758,0.20833333333333334,0.09965921369794697 +1,2022.0,1,0.672739372764329,0.013588772555134774,0.15307692307692308,0.08551701189584893 +2,2019.0,1,0.7349447628540576,0.049050819478835044,0.44033970276008494,0.12717003073344962 +2,2020.0,1,0.654095364678518,0.010256410256410256,0.23345817727840198,0.08373483967436451 +2,2021.0,1,0.723963095337046,0.017298397354362758,0.20833333333333334,0.09965921369794697 +2,2022.0,1,0.672739372764329,0.013588772555134774,0.15307692307692308,0.08551701189584893 \ No newline at end of file diff --git a/src/test/java/simpaths/integrationtest/expected/HealthStatistics1.csv b/src/test/java/simpaths/integrationtest/expected/HealthStatistics1.csv index 6f14e38ba..de057abe2 100644 --- a/src/test/java/simpaths/integrationtest/expected/HealthStatistics1.csv +++ b/src/test/java/simpaths/integrationtest/expected/HealthStatistics1.csv @@ -1,25 +1,25 @@ -run,time,id_HealthStatistics1,demLifeSatScore1to7Avg,demLifeSatScore1to7P10,demLifeSatScore1to7P25,demLifeSatScore1to7P50,demLifeSatScore1to7P75,demLifeSatScore1to7P90,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,5.082882273342355,3.0,4.0,6.0,6.0,6.0,Total,9845.10078575798,94442.85714285714,47.46016576454639,32.93,41.6125,49.375,54.79,58.05,11824,51.582412043302156,37.85,48.135000000000005,54.8,57.57,60.09,11.508203653585927,6.0,8.0,10.0,13.0,19.0 -1,2019.0,1,5.0900653145410795,3.0,4.0,6.0,6.0,6.0,Male,4948.7929222607045,46536.28571428571,48.49371433482308,34.439,43.38,51.0,55.48,58.3,5818,52.14620831900955,40.0,49.39,55.0,57.49,59.72,10.95496734272946,6.0,7.0,10.0,12.0,18.0 -1,2019.0,1,5.075924075924076,3.0,4.0,6.0,6.0,6.0,Female,4896.3078634974345,47906.57142857143,46.45896936396954,31.587,40.71,48.63,54.2,57.33,6006,51.036263736263685,35.59700000000001,47.09,54.67,57.76,60.31,12.044122544122544,6.0,8.0,11.0,14.0,20.0 -1,2020.0,1,5.107160995429152,4.0,5.0,5.0,6.0,6.0,Total,9867.987846382177,94813.71428571429,46.07723313307481,37.05800729137269,42.590478206582176,47.45552153497012,50.70058112078441,52.90735655171413,11814,52.17333588341197,42.25576516632326,49.67124686886112,54.66098263588519,57.06731142182204,58.42297734144503,12.467025929767127,5.525783669184398,8.658696479828267,12.178426335498791,15.957498213999914,19.671033970309345 -1,2020.0,1,5.115351555784769,4.0,5.0,5.0,6.0,6.0,Male,4964.27160875494,46759.42857142857,47.42426467846777,39.235797633496375,44.455158820998385,48.81842218980688,51.57376213151434,53.68543528235989,5817,52.56867387726656,43.922918846680524,50.36497904641212,54.731302764359064,56.96749134816214,58.25838852247566,11.741328978850017,5.003288210730821,8.112030872274639,11.518604063779721,15.135336660545661,18.784475598858187 -1,2020.0,1,5.099216274804069,4.0,5.0,5.0,6.0,6.0,Female,4903.7162376272545,48054.28571428571,44.77063274962495,35.50282075868708,41.258951489098806,45.97356139454508,49.58458201662452,51.944848237651264,5997,51.789863962409406,40.84757499293931,48.831221402993954,54.56412378180342,57.20849007980755,58.6041245360313,13.170941081256984,6.136265253755889,9.251654196351577,12.963577464175241,16.71082705901307,20.375702908186494 -1,2021.0,1,5.031419376693767,4.0,5.0,5.0,5.0,6.0,Total,9783.504062152717,93360.14285714286,45.45076878402121,39.220412496219204,43.07559742598681,46.301735672787004,48.77503563061213,50.475100806592366,11808,52.00875443353065,44.046560461058945,49.892505483935764,53.85911525180584,56.18464398695711,57.557997261950945,12.82093567708548,5.927930920294657,9.130349540208435,12.711076010872631,16.393871334829758,19.8641617862824 -1,2021.0,1,5.042476354256234,4.0,5.0,5.0,5.0,6.0,Male,4920.735935849245,46077.42857142857,46.843845890467826,41.285495709174555,44.83047297156983,47.67136910768306,49.75614630417793,51.36279429617805,5815,52.33202874469034,45.359985782793444,50.46400546872791,53.95041680493021,56.16083738328063,57.42309981558958,12.078058433817468,5.368039536015929,8.443842168543183,12.02625202017624,15.559078620421626,18.907342913464774 -1,2021.0,1,5.020690805940264,4.0,5.0,5.0,5.0,6.0,Female,4862.768126303455,47282.71428571428,44.09906790399688,37.5829262368226,41.79085972733833,44.958691941322634,47.52379579312965,49.28001586200368,5993,51.69508179555413,42.789739259026405,49.310822284494634,53.74383563353733,56.221169544670815,57.72624175507087,13.541748486964362,6.605371367377746,9.741049298863413,13.35394990099573,17.220348861920563,20.5641707959241 -1,2022.0,1,5.000423800644177,4.0,5.0,5.0,5.0,6.0,Total,9685.42377474214,92706.42857142857,45.265711909063306,40.26066224241355,43.319733973341286,45.9223264412563,48.03466197054144,49.57264308670507,11798,51.57606809415161,44.860774595213215,49.84881807323178,53.015757167841976,55.28626546114065,56.64653806826095,12.754305828139334,5.90404268805009,9.024271709329822,12.595234937526566,16.35505115696332,19.789779631396573 -1,2022.0,1,5.012041974883881,4.0,5.0,5.0,5.0,6.0,Male,4877.244852437185,45783.57142857143,46.545636164485806,42.16786333939389,44.977079570398985,47.11834894405378,48.95419462198866,50.368022670160144,5813,51.99500039408917,45.99039419203403,50.34339234998302,53.304645126641425,55.405068439453494,56.70551576511696,12.090521357611516,5.387075980332026,8.455428383060564,11.958342548150666,15.611169117438422,18.954112414848723 -1,2022.0,1,4.989139515455305,4.0,5.0,5.0,5.0,6.0,Female,4808.17892230496,46922.857142857145,44.022570773428846,38.911791903162076,42.20320676983231,44.64897067828675,46.86055596059599,48.37691127851741,5985,51.16917528554095,43.5608311939296,49.31073830575697,52.750566419764944,55.12521026635699,56.59644255643239,13.399014120065512,6.439347164084394,9.648075594431448,13.19962326504095,16.943563884431526,20.68321023271273 -2,2019.0,1,5.082882273342355,3.0,4.0,6.0,6.0,6.0,Total,9845.10078575798,94442.85714285714,47.46016576454639,32.93,41.6125,49.375,54.79,58.05,11824,51.582412043302156,37.85,48.135000000000005,54.8,57.57,60.09,11.508203653585927,6.0,8.0,10.0,13.0,19.0 -2,2019.0,1,5.0900653145410795,3.0,4.0,6.0,6.0,6.0,Male,4948.7929222607045,46536.28571428571,48.49371433482308,34.439,43.38,51.0,55.48,58.3,5818,52.14620831900955,40.0,49.39,55.0,57.49,59.72,10.95496734272946,6.0,7.0,10.0,12.0,18.0 -2,2019.0,1,5.075924075924076,3.0,4.0,6.0,6.0,6.0,Female,4896.3078634974345,47906.57142857143,46.45896936396954,31.587,40.71,48.63,54.2,57.33,6006,51.036263736263685,35.59700000000001,47.09,54.67,57.76,60.31,12.044122544122544,6.0,8.0,11.0,14.0,20.0 -2,2020.0,1,5.107160995429152,4.0,5.0,5.0,6.0,6.0,Total,9867.987846382177,94813.71428571429,46.07723313307481,37.05800729137269,42.590478206582176,47.45552153497012,50.70058112078441,52.90735655171413,11814,52.17333588341197,42.25576516632326,49.67124686886112,54.66098263588519,57.06731142182204,58.42297734144503,12.467025929767129,5.525783669184398,8.658696479828267,12.178426335498791,15.957498213999914,19.671033970309345 -2,2020.0,1,5.115351555784769,4.0,5.0,5.0,6.0,6.0,Male,4964.27160875494,46759.42857142857,47.42426467846777,39.235797633496375,44.455158820998385,48.81842218980688,51.57376213151434,53.68543528235989,5817,52.56867387726656,43.922918846680524,50.36497904641212,54.731302764359064,56.96749134816214,58.25838852247566,11.741328978850017,5.003288210730821,8.112030872274639,11.518604063779721,15.135336660545661,18.784475598858187 -2,2020.0,1,5.099216274804069,4.0,5.0,5.0,6.0,6.0,Female,4903.7162376272545,48054.28571428571,44.77063274962495,35.50282075868708,41.258951489098806,45.97356139454508,49.58458201662452,51.944848237651264,5997,51.789863962409406,40.84757499293931,48.831221402993954,54.56412378180342,57.20849007980755,58.6041245360313,13.170941081256984,6.136265253755889,9.251654196351577,12.963577464175241,16.71082705901307,20.375702908186494 -2,2021.0,1,5.031419376693767,4.0,5.0,5.0,5.0,6.0,Total,9783.504062152717,93360.14285714286,45.45076878402121,39.220412496219204,43.07559742598681,46.301735672787004,48.77503563061213,50.475100806592366,11808,52.00875443353065,44.046560461058945,49.892505483935764,53.85911525180584,56.18464398695711,57.557997261950945,12.820935677085481,5.927930920294657,9.130349540208435,12.711076010872631,16.393871334829758,19.8641617862824 -2,2021.0,1,5.042476354256234,4.0,5.0,5.0,5.0,6.0,Male,4920.735935849245,46077.42857142857,46.843845890467826,41.285495709174555,44.83047297156983,47.67136910768306,49.75614630417793,51.36279429617805,5815,52.33202874469034,45.359985782793444,50.46400546872791,53.95041680493021,56.16083738328063,57.42309981558958,12.078058433817468,5.368039536015929,8.443842168543183,12.02625202017624,15.559078620421626,18.907342913464774 -2,2021.0,1,5.020690805940264,4.0,5.0,5.0,5.0,6.0,Female,4862.768126303455,47282.71428571428,44.09906790399688,37.5829262368226,41.79085972733833,44.958691941322634,47.52379579312965,49.28001586200368,5993,51.69508179555413,42.789739259026405,49.310822284494634,53.74383563353733,56.221169544670815,57.72624175507087,13.541748486964362,6.605371367377746,9.741049298863413,13.35394990099573,17.220348861920563,20.5641707959241 -2,2022.0,1,5.000423800644177,4.0,5.0,5.0,5.0,6.0,Total,9685.423774742141,92706.42857142857,45.265711909063306,40.26066224241355,43.319733973341286,45.9223264412563,48.03466197054144,49.57264308670507,11798,51.57606809415161,44.860774595213215,49.84881807323178,53.015757167841976,55.28626546114065,56.64653806826095,12.754305828139334,5.90404268805009,9.024271709329822,12.595234937526566,16.35505115696332,19.789779631396573 -2,2022.0,1,5.012041974883881,4.0,5.0,5.0,5.0,6.0,Male,4877.244852437185,45783.57142857143,46.545636164485806,42.16786333939389,44.977079570398985,47.11834894405378,48.95419462198866,50.368022670160144,5813,51.99500039408917,45.99039419203403,50.34339234998302,53.304645126641425,55.405068439453494,56.70551576511696,12.090521357611516,5.387075980332026,8.455428383060564,11.958342548150666,15.611169117438422,18.954112414848723 -2,2022.0,1,4.989139515455305,4.0,5.0,5.0,5.0,6.0,Female,4808.17892230496,46922.857142857145,44.022570773428846,38.911791903162076,42.20320676983231,44.64897067828675,46.86055596059599,48.37691127851741,5985,51.16917528554095,43.5608311939296,49.31073830575697,52.750566419764944,55.12521026635699,56.59644255643239,13.399014120065512,6.439347164084394,9.648075594431448,13.19962326504095,16.943563884431526,20.68321023271273 \ No newline at end of file +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 +1,2019.0,1,5.070450684520836,3.0,4.0,6.0,6.0,6.0,Total,8282.657487114777,50740.0,47.649027680623185,33.01,41.87,49.75,54.92,58.15,10007,51.15567302887993,36.97,47.89,54.53,57.49,59.89,11.5157389827121,6.0,8.0,10.0,13.0,19.0 +1,2019.0,1,5.079714576962283,3.0,4.0,6.0,6.0,6.0,Male,4145.939357171729,24916.0,48.5927319062183,34.65,43.57,51.0,55.36,58.504000000000005,4905,51.759822629968916,39.0,49.0,54.8,57.400000000000006,59.6,11.006727828746177,6.0,7.5,10.0,12.0,18.0 +1,2019.0,1,5.061544492355939,3.0,4.0,6.0,6.0,6.0,Female,4136.718129943165,25824.0,46.741762054096604,32.243,40.86,48.87,54.35,57.73,5102,50.57485103880819,34.519,46.3575,54.3,57.49,60.16,12.005096040768326,6.0,8.0,11.0,14.0,20.0 +1,2020.0,1,6.15479912980333,4.234853001488025,5.203243628024023,6.214972237230485,7.181115889868165,8.005813742187787,Total,8176.473935726076,61732.63527192741,46.284405935968685,32.89871136598147,39.82729030712588,46.78855467791709,53.331761561911755,59.03659124888406,10030,51.76371253684316,37.96991364761898,45.893084268972274,52.88783679367499,58.936603561038496,63.94569587775157,12.420891101003075,5.51619316114934,8.647494376231297,12.176013723354938,15.840145765929496,19.50430707629297 +1,2020.0,1,6.165592519321066,4.309835760323352,5.223763300005617,6.197585362987448,7.159048663468391,7.9963817300823505,Male,4103.40599347293,30310.052824982362,47.775328758585644,34.7819762114363,41.17202826015482,48.3260969500794,54.69398960355088,60.31582491399437,4916,52.181709039952885,39.42365842307421,46.629265209209095,53.20083029451112,58.93518634281055,63.76472554663432,11.808860105287533,5.0979468748298,8.1212594072473,11.612846180512065,15.192510926474178,18.586636467615335 +1,2020.0,1,6.144423630611094,4.164341071033048,5.183459859368027,6.228672866969047,7.202268924681874,8.014760027254553,Female,4073.067942253174,31422.582446945133,44.851207540195226,31.441021070705958,38.354741513633456,45.398002199626546,52.02961717637206,57.43058885946585,5114,51.36189970749488,36.64543613802746,45.258954213129186,52.58269279778721,58.94022395206611,64.14641858979982,13.009225941624404,6.005984112071939,9.120911670672118,12.7840793678229,16.518908501855996,20.2973045337445 +1,2021.0,1,6.4273315038934085,4.459553990066534,5.449834227809937,6.496381920343835,7.470230503214192,8.296170642653923,Total,8117.4578682176,64588.25428262486,45.8863812936987,32.57940075126437,39.03983408297942,46.04970179674484,52.7047183566617,59.1325215021261,10049,51.70833132127122,38.05020894550072,45.352833357018696,52.321630056137224,58.835005852541,64.75913808542727,12.85292486618553,5.960788358115341,9.16314082841081,12.738399003532761,16.36244214108939,19.90363605902 +1,2021.0,1,6.440489109760218,4.5364829702763565,5.473981744105062,6.48876633241575,7.468546343962816,8.271971988801775,Male,4071.729643488588,31719.408865569076,47.40394823513742,34.3574979148735,40.55270496341201,47.60551569338095,54.199983531984124,60.21623581010326,4925,52.124834490497484,38.96488060967943,45.949974190006024,52.56330331889996,58.97656896674281,64.71352963135072,12.134090068687463,5.2241114680365435,8.479890519788086,11.985307667096087,15.700166760746061,19.16640873087936 +1,2021.0,1,6.414684897942152,4.385255140958879,5.42055786732357,6.499362439475959,7.472091952464421,8.323749630953959,Female,4045.7282247289804,32868.845417055585,44.4277518661842,31.071758852834222,37.70292952225949,44.59574721365753,51.30102209079954,57.39851837457006,5124,51.30800382157566,37.241077779763756,44.81348256986962,51.92632630657218,58.72008619528194,64.83739803069024,13.54384238720005,6.720714172309142,9.909420770678869,13.360591584819476,17.03411636469017,20.592514206642456 +1,2022.0,1,6.537419461227224,4.618441166061394,5.569114842003494,6.589201985116359,7.5846632655882935,8.427139217998802,Total,8043.885969587013,65818.7391356357,45.64194425971552,32.33413114957401,38.83807632281159,45.71652278109958,52.59206830813299,58.78698761071709,10068,51.24151564715614,37.48734744021233,44.48410793685275,51.70463418299286,58.56851481309928,64.38748310775037,12.84423306940242,5.890231174429797,9.14360986351706,12.795111641279702,16.40068519855007,19.788677795939485 +1,2022.0,1,6.574427882671881,4.649831828105116,5.625979330190156,6.627166321479633,7.605209477353271,8.4424852161636,Male,4030.487467490255,32392.20617792436,46.9804221257756,33.911250186803755,40.385640834308305,46.948068816091144,53.794344822734345,59.99412292879636,4927,51.76686919318487,38.39763132081861,45.20232917668582,52.25977731820738,58.79733604692817,64.54662222183562,12.170634946517243,5.185155592971629,8.548634799013556,12.09571859038346,15.61550239147978,19.081472610035263 +1,2022.0,1,6.501951557617496,4.577004528020655,5.52050927463746,6.546367227129112,7.560975383391569,8.406720728945828,Female,4013.398502096728,33426.53295771155,44.35918206440729,31.277808202831654,37.400201953084604,44.5515065895928,51.31977311332493,57.467214595823904,5141,50.73803054284059,36.78068360590923,43.933919521222656,51.10710722228834,58.321324682839084,64.28342932875508,13.489791900652332,6.579232299649911,9.779920940585832,13.467847629358003,17.09077320874089,20.375743673904477 +2,2019.0,1,5.070450684520836,3.0,4.0,6.0,6.0,6.0,Total,8282.657487114777,50740.0,47.649027680623185,33.01,41.87,49.75,54.92,58.15,10007,51.15567302887993,36.97,47.89,54.53,57.49,59.89,11.5157389827121,6.0,8.0,10.0,13.0,19.0 +2,2019.0,1,5.079714576962283,3.0,4.0,6.0,6.0,6.0,Male,4145.939357171729,24916.0,48.5927319062183,34.65,43.57,51.0,55.36,58.504000000000005,4905,51.759822629968916,39.0,49.0,54.8,57.400000000000006,59.6,11.006727828746177,6.0,7.5,10.0,12.0,18.0 +2,2019.0,1,5.061544492355939,3.0,4.0,6.0,6.0,6.0,Female,4136.718129943165,25824.0,46.741762054096604,32.243,40.86,48.87,54.35,57.73,5102,50.57485103880819,34.519,46.3575,54.3,57.49,60.16,12.005096040768326,6.0,8.0,11.0,14.0,20.0 +2,2020.0,1,6.15479912980333,4.234853001488025,5.203243628024023,6.214972237230485,7.181115889868165,8.005813742187787,Total,8176.473935726076,61732.63527192741,46.284405935968685,32.89871136598147,39.82729030712588,46.78855467791709,53.331761561911755,59.03659124888406,10030,51.76371253684316,37.96991364761898,45.893084268972274,52.88783679367499,58.936603561038496,63.94569587775157,12.420891101003075,5.51619316114934,8.647494376231297,12.176013723354938,15.840145765929496,19.50430707629297 +2,2020.0,1,6.165592519321066,4.309835760323352,5.223763300005617,6.197585362987448,7.159048663468391,7.9963817300823505,Male,4103.40599347293,30310.052824982362,47.775328758585644,34.7819762114363,41.17202826015482,48.3260969500794,54.69398960355088,60.31582491399437,4916,52.181709039952885,39.42365842307421,46.629265209209095,53.20083029451112,58.93518634281055,63.76472554663432,11.808860105287533,5.0979468748298,8.1212594072473,11.612846180512065,15.192510926474178,18.586636467615335 +2,2020.0,1,6.144423630611094,4.164341071033048,5.183459859368027,6.228672866969047,7.202268924681874,8.014760027254553,Female,4073.067942253174,31422.582446945133,44.851207540195226,31.441021070705958,38.354741513633456,45.398002199626546,52.02961717637206,57.43058885946585,5114,51.36189970749488,36.64543613802746,45.258954213129186,52.58269279778721,58.94022395206611,64.14641858979982,13.009225941624404,6.005984112071939,9.120911670672118,12.7840793678229,16.518908501855996,20.2973045337445 +2,2021.0,1,6.4273315038934085,4.459553990066534,5.449834227809937,6.496381920343835,7.470230503214192,8.296170642653923,Total,8117.4578682176,64588.25428262486,45.8863812936987,32.57940075126437,39.03983408297942,46.04970179674484,52.7047183566617,59.1325215021261,10049,51.70833132127122,38.05020894550072,45.352833357018696,52.321630056137224,58.835005852541,64.75913808542727,12.85292486618553,5.960788358115341,9.16314082841081,12.738399003532761,16.36244214108939,19.90363605902 +2,2021.0,1,6.440489109760218,4.5364829702763565,5.473981744105062,6.48876633241575,7.468546343962816,8.271971988801775,Male,4071.729643488588,31719.408865569076,47.40394823513742,34.3574979148735,40.55270496341201,47.60551569338095,54.199983531984124,60.21623581010326,4925,52.124834490497484,38.96488060967943,45.949974190006024,52.56330331889996,58.97656896674281,64.71352963135072,12.134090068687463,5.2241114680365435,8.479890519788086,11.985307667096087,15.700166760746061,19.16640873087936 +2,2021.0,1,6.414684897942152,4.385255140958879,5.42055786732357,6.499362439475959,7.472091952464421,8.323749630953959,Female,4045.7282247289804,32868.845417055585,44.4277518661842,31.071758852834222,37.70292952225949,44.59574721365753,51.30102209079954,57.39851837457006,5124,51.30800382157566,37.241077779763756,44.81348256986962,51.92632630657218,58.72008619528194,64.83739803069024,13.54384238720005,6.720714172309142,9.909420770678869,13.360591584819476,17.03411636469017,20.592514206642456 +2,2022.0,1,6.537419461227224,4.618441166061394,5.569114842003494,6.589201985116359,7.5846632655882935,8.427139217998802,Total,8043.885969587013,65818.7391356357,45.64194425971552,32.33413114957401,38.83807632281159,45.71652278109958,52.59206830813299,58.78698761071709,10068,51.24151564715614,37.48734744021233,44.48410793685275,51.70463418299286,58.56851481309928,64.38748310775037,12.84423306940242,5.890231174429797,9.14360986351706,12.795111641279702,16.40068519855007,19.788677795939485 +2,2022.0,1,6.574427882671881,4.649831828105116,5.625979330190156,6.627166321479633,7.605209477353271,8.4424852161636,Male,4030.487467490255,32392.20617792436,46.9804221257756,33.911250186803755,40.385640834308305,46.948068816091144,53.794344822734345,59.99412292879636,4927,51.76686919318487,38.39763132081861,45.20232917668582,52.25977731820738,58.79733604692817,64.54662222183562,12.170634946517243,5.185155592971629,8.548634799013556,12.09571859038346,15.61550239147978,19.081472610035263 +2,2022.0,1,6.501951557617496,4.577004528020655,5.52050927463746,6.546367227129112,7.560975383391569,8.406720728945828,Female,4013.398502096728,33426.53295771155,44.35918206440729,31.277808202831654,37.400201953084604,44.5515065895928,51.31977311332493,57.467214595823904,5141,50.73803054284059,36.78068360590923,43.933919521222656,51.10710722228834,58.321324682839084,64.28342932875508,13.489791900652332,6.579232299649911,9.779920940585832,13.467847629358003,17.09077320874089,20.375743673904477 \ 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 index a4b59e719..70ff14fac 100644 --- a/src/test/java/simpaths/integrationtest/expected/Statistics1.csv +++ b/src/test/java/simpaths/integrationtest/expected/Statistics1.csv @@ -1,9 +1,9 @@ run,time,id_Statistics1,edi_p50,sIndex_p50,statYHhDispEquivNatGini,statYMktNatGini,yHhDispEquivP50,yHhQuintilesC5P20,yHhQuintilesC5P40,yHhQuintilesC5P60,yHhQuintilesC5P80,yLabP20,yLabP40,yLabP60,yLabP80 -1,2019.0,1,13643.583390133683,NaN,0.0,0.0,13643.667479107155,0.0,6.51833999175728,7.9090821344821665,8.39487669904798,1015.7031862136506,1595.5475473858087,2190.490749493191,3216.4356578295665 -1,2020.0,1,12423.40799238695,NaN,0.0,0.0,12423.40799238695,0.0,0.0,7.80523111874781,8.399096813063087,1155.4114367902455,1746.9759994440487,2409.8485417454194,3480.597893507784 -1,2021.0,1,15248.76945713412,NaN,0.0,0.0,15248.764086554458,0.0,7.008969243282366,8.071873405791731,8.590228314596128,1257.0236597604874,1916.3540502445262,2658.054252506135,3853.870426816769 -1,2022.0,1,13512.505112526625,NaN,0.0,0.0,13511.583099289626,0.0,0.0,7.924647831700972,8.496337938699355,1263.6630434935632,1900.9751882920457,2582.5847305134994,3761.9210093792885 -2,2019.0,1,13643.583390133683,NaN,0.0,0.0,13643.667479107155,0.0,6.51833999175728,7.9090821344821665,8.39487669904798,1015.7031862136506,1595.5475473858087,2190.490749493191,3216.4356578295665 -2,2020.0,1,12423.407992386947,NaN,0.0,0.0,12423.407992386947,0.0,0.0,7.80523111874781,8.399096813063087,1155.4114367902455,1746.9759994440487,2409.8485417454194,3480.597893507784 -2,2021.0,1,15248.76945713412,NaN,0.0,0.0,15248.764086554458,0.0,7.008969243282366,8.071873405791731,8.590228314596128,1257.0236597604874,1916.3540502445262,2658.054252506135,3853.870426816769 -2,2022.0,1,13512.505112526625,NaN,0.0,0.0,13511.583099289626,0.0,0.0,7.924647831700972,8.496337938699355,1263.6630434935632,1900.9751882920457,2582.5847305134994,3761.9210093792885 \ No newline at end of file +1,2019.0,1,13694.118139479408,NaN,0.0,0.0,13696.748093281414,0.0,6.464868868117958,7.9042791273927175,8.39353482563426,1018.8789473854033,1586.268257508741,2201.4371135302663,3215.759357553552 +1,2020.0,1,12525.0985199147,NaN,0.0,0.0,12523.474664458354,0.0,0.0,7.803255060404565,8.386153720867247,1168.7745369787574,1743.859156167526,2368.607522361104,3452.5074025565054 +1,2021.0,1,15559.98761312728,NaN,0.0,0.0,15556.97654572353,0.0,6.9884118542326075,8.065176286333347,8.577680266984,1287.4504308781425,1927.5628607289862,2648.866112991184,3804.125858290752 +1,2022.0,1,13340.320394892507,NaN,0.0,0.0,13340.320394892507,0.0,0.0,7.895183287214958,8.494864469864652,1247.927253465205,1876.7486993263296,2621.8317463226076,3710.006371803516 +2,2019.0,1,13694.118139479408,NaN,0.0,0.0,13696.748093281414,0.0,6.464868868117958,7.9042791273927175,8.39353482563426,1018.8789473854033,1586.268257508741,2201.4371135302663,3215.759357553552 +2,2020.0,1,12525.0985199147,NaN,0.0,0.0,12523.474664458354,0.0,0.0,7.803255060404565,8.386153720867247,1168.7745369787574,1743.859156167526,2368.607522361104,3452.5074025565054 +2,2021.0,1,15559.98761312728,NaN,0.0,0.0,15556.97654572353,0.0,6.9884118542326075,8.065176286333347,8.577680266984,1287.4504308781425,1927.5628607289862,2648.866112991184,3804.125858290752 +2,2022.0,1,13340.320394892507,NaN,0.0,0.0,13340.320394892507,0.0,0.0,7.895183287214958,8.494864469864652,1247.927253465205,1876.7486993263296,2621.8317463226076,3710.006371803516 \ 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 index 6e1fbfbd0..b23b4ad74 100644 --- a/src/test/java/simpaths/integrationtest/expected/Statistics21.csv +++ b/src/test/java/simpaths/integrationtest/expected/Statistics21.csv @@ -1,9 +1,9 @@ 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.056818181818181816,0.09244486156733928,0.1300523062291964,0.2703168044077135,0.6707336148912874,0.6131716595339991,0.28546831955922863,0.9438448302831222,0.08083689966714218,2904.0,6393.0,4206.0,3.6797520661157024,3.4509619896762085,3.1238706609605327,-0.03280974462809916,-0.04843401568540323,-0.05500624220240888,0.024626505658583042,0.5953856749311295,0.7888315344908494,0.34141702330004753,0.0946969696969697,0.06162990771155952,0.03281027104136947,0.0,0.0,0.0,42.90138650342101,-235.73251852989438,-757.7467085400431,1329.1136079319922,1863.7884002201056,1321.098886102814,0.0,0.0,0.0,434.0636850782414,594.982264159137,577.842361382952,0.0,0.0,0.0,0.0,0.0,0.0,-720.1491392879234,-1107.7139183419072,-1342.7185177749318,-1403.9198889040383,14.047551522588241 -1,2020.0,1,0.056239015817223195,0.08175113761179978,0.15153631284916202,0.2172231985940246,0.6417699670484858,0.5726256983240223,0.2562390158172232,0.9060097285422878,0.08100558659217877,2845.0,6373.0,4296.0,3.6087873462214413,3.419739526125843,3.038175046554935,-0.0685618978910369,0.03779833029450941,-0.036335165604895664,0.28456143500931097,0.6460456942003515,0.8091950415816727,0.11173184357541899,0.07978910369068541,0.022595324023222972,0.0025605214152700185,0.0,0.0,0.0,178.85726290557022,-181.53740466318732,-1138.5666684641694,1465.0694843341414,1917.9835140868126,940.2789261786877,0.0,0.0,0.0,452.56436796649825,632.7330291922549,641.6922122499931,0.0,0.0,0.0,0.0,0.0,0.0,-720.1475685528261,-1107.7918465495334,-1342.8542359424646,-1403.855389781263,18.943899571019074 -1,2021.0,1,0.06205164992826399,0.07451658544254049,0.163185678218958,0.17324246771879484,0.6126395220877221,0.5444112921735139,0.2342180774748924,0.8679452916208144,0.08377323846683497,2788.0,6361.0,4357.0,3.5161406025824964,3.338626002200912,2.9761303649299977,-0.06690213586800575,-0.049396337005775226,-0.05755533293507309,0.03507138090429196,0.6474175035868006,0.8380757742493319,0.3484048657333027,0.07675753228120516,0.014934758685741236,0.015377553362405325,0.0,0.0,0.0,233.80744223913666,-89.77828278558468,-497.447417398952,1520.0196636677078,2009.7426359644153,1581.3981772439051,0.0,0.0,0.0,481.53928383966644,652.5782741766019,819.8829678890841,0.0,0.0,0.0,0.0,0.0,0.0,-720.159448471871,-1107.79744755163,-1342.8597000193156,-1403.8120977254491,34.44827018248283 -1,2022.0,1,0.06045156591405681,0.07454688731284476,0.16872146118721462,0.1358339402767662,0.5910165484633569,0.5157534246575343,0.21412964311726146,0.8335697399527187,0.08036529680365297,2746.0,6345.0,4380.0,3.4107793153678077,3.2616233254531126,2.908447488584475,-0.08781085819373635,0.011074250864820723,-0.05340216800630418,0.22533781826484023,0.6675163874726876,0.8400315208825847,0.16940639269406393,0.0775673707210488,0.008825847123719465,0.00410958904109589,0.0,0.0,0.0,254.52345404012112,-106.80243629353572,-989.4596422271429,1540.7356754686923,1992.7184824564642,1089.3859524157142,0.0,0.0,0.0,484.63332723781656,656.5635170299258,774.8814208892799,0.0,0.0,0.0,0.0,0.0,0.0,-720.2113750849451,-1107.8889881725324,-1342.9771963668388,-1403.8700200740648,106.51161990887896 -2,2019.0,1,0.056818181818181816,0.09244486156733928,0.1300523062291964,0.2703168044077135,0.6707336148912874,0.6131716595339991,0.28546831955922863,0.9438448302831222,0.08083689966714218,2904.0,6393.0,4206.0,3.6797520661157024,3.4509619896762085,3.1238706609605327,-0.03280974462809916,-0.04843401568540323,-0.05500624220240888,0.024626505658583042,0.5953856749311295,0.7888315344908494,0.34141702330004753,0.0946969696969697,0.06162990771155952,0.03281027104136947,0.0,0.0,0.0,42.90138650342101,-235.73251852989438,-757.7467085400431,1329.1136079319922,1863.7884002201056,1321.098886102814,0.0,0.0,0.0,434.0636850782414,594.982264159137,577.842361382952,0.0,0.0,0.0,0.0,0.0,0.0,-720.1491392879234,-1107.7139183419072,-1342.7185177749318,-1403.9198889040383,14.047551522588241 -2,2020.0,1,0.056239015817223195,0.08175113761179978,0.15153631284916202,0.2172231985940246,0.6417699670484858,0.5726256983240223,0.2562390158172232,0.9060097285422878,0.08100558659217877,2845.0,6373.0,4296.0,3.6087873462214413,3.419739526125843,3.038175046554935,-0.0685618978910369,0.03779833029450941,-0.036335165604895664,0.28456143500931097,0.6460456942003515,0.8091950415816727,0.11173184357541899,0.07978910369068541,0.022595324023222972,0.0025605214152700185,0.0,0.0,0.0,178.85726290557022,-181.53740466318732,-1138.5666684641694,1465.0694843341414,1917.9835140868126,940.2789261786877,0.0,0.0,0.0,452.56436796649825,632.7330291922549,641.692212249993,0.0,0.0,0.0,0.0,0.0,0.0,-720.1475685528261,-1107.7918465495334,-1342.8542359424646,-1403.855389781263,18.943899571019074 -2,2021.0,1,0.06205164992826399,0.07451658544254049,0.163185678218958,0.17324246771879484,0.6126395220877221,0.5444112921735139,0.2342180774748924,0.8679452916208144,0.08377323846683497,2788.0,6361.0,4357.0,3.5161406025824964,3.338626002200912,2.9761303649299977,-0.06690213586800575,-0.049396337005775226,-0.05755533293507309,0.03507138090429196,0.6474175035868006,0.8380757742493319,0.3484048657333027,0.07675753228120516,0.014934758685741236,0.015377553362405325,0.0,0.0,0.0,233.80744223913666,-89.77828278558468,-497.447417398952,1520.0196636677078,2009.7426359644153,1581.3981772439051,0.0,0.0,0.0,481.53928383966644,652.5782741766019,819.8829678890841,0.0,0.0,0.0,0.0,0.0,0.0,-720.159448471871,-1107.79744755163,-1342.8597000193156,-1403.8120977254491,34.44827018248283 -2,2022.0,1,0.06045156591405681,0.07454688731284476,0.16872146118721462,0.1358339402767662,0.5910165484633569,0.5157534246575343,0.21412964311726146,0.8335697399527187,0.08036529680365297,2746.0,6345.0,4380.0,3.4107793153678077,3.2616233254531126,2.908447488584475,-0.08781085819373635,0.011074250864820723,-0.05340216800630418,0.22533781826484023,0.6675163874726876,0.8400315208825847,0.16940639269406393,0.0775673707210488,0.008825847123719465,0.00410958904109589,0.0,0.0,0.0,254.52345404012112,-106.80243629353572,-989.4596422271429,1540.7356754686923,1992.7184824564642,1089.3859524157142,0.0,0.0,0.0,484.63332723781656,656.5635170299258,774.8814208892799,0.0,0.0,0.0,0.0,0.0,0.0,-720.2113750849451,-1107.8889881725324,-1342.9771963668388,-1403.8700200740648,106.51161990887896 \ No newline at end of file +1,2019.0,1,0.056818181818181816,0.09244486156733928,0.1300523062291964,0.2703168044077135,0.6707336148912874,0.6131716595339991,0.28546831955922863,0.9438448302831222,0.08083689966714218,2904.0,6393.0,4206.0,3.6797520661157024,3.4509619896762085,3.1238706609605327,-0.03246539201101928,-0.04621228718062653,-0.05406771568903487,0.030094884165477898,0.5971074380165289,0.7889879555764117,0.3361864003804089,0.09263085399449036,0.06053496011262318,0.032572515454113174,0.0,0.0,0.0,42.670457691692945,-237.4839503804401,-770.211367343305,1328.8826791202641,1862.0369683695599,1308.634227299552,0.0,0.0,0.0,434.4529098111861,595.0368092174058,572.6088161828362,0.0,0.0,0.0,0.0,0.0,0.0,-720.1482462933187,-1107.71303671876,-1342.717685242823,-1403.9218077781773,14.584452936336016 +1,2020.0,1,0.053445850914205346,0.08239171374764595,0.1488665576069175,0.21729957805907174,0.6454802259887006,0.5709277868660902,0.25843881856540085,0.9102322661644695,0.07758822154709044,2844.0,6372.0,4279.0,3.610056258790436,3.416195856873823,3.049310586585651,-0.0688171140646976,0.035645937236013336,-0.04211542146892655,0.2883139542416453,0.6438115330520394,0.8138731952291274,0.10773545220845993,0.08227848101265822,0.023697426239799122,0.002804393549894835,0.0,0.0,0.0,174.0046409489396,-195.64070058155994,-1140.3570869355722,1460.2168623775108,1903.88021816844,938.4885077072851,0.0,0.0,0.0,450.0661997239399,623.9040452305816,634.5257175670146,0.0,0.0,0.0,0.0,0.0,0.0,-720.1518044398651,-1107.7799191624265,-1342.8317476551274,-1403.8709970086531,3.5859366091688294 +1,2021.0,1,0.059182209469153514,0.08415919458864245,0.1695461875143976,0.17647058823529413,0.6229353468617272,0.5420410043768716,0.24354375896700142,0.8746263960987888,0.07947477539737388,2788.0,6357.0,4341.0,3.514347202295552,3.3566147553877617,2.9661368348306842,-0.07802121764705883,-0.047347681714370426,-0.04582213207487809,0.03234838650080629,0.6639167862266858,0.8282208588957055,0.3492282884128081,0.07137733142037303,0.013056473179172566,0.017277125086385625,0.0,0.0,0.0,236.80778474989575,-108.00334137305549,-507.1932795434552,1523.020006178467,1991.5175773769445,1571.652315099402,0.0,0.0,0.0,472.2481994387709,653.9338294657625,803.2169191675517,0.0,0.0,0.0,0.0,0.0,0.0,-720.1758610322416,-1107.8056652116566,-1342.8619844769569,-1403.8435541537729,18.146483124667206 +1,2022.0,1,0.06156648451730419,0.08183538315988648,0.18277599633531838,0.13916211293260475,0.5912961210974456,0.5169491525423728,0.22185792349726777,0.8315988647114475,0.076042143838754,2745.0,6342.0,4366.0,3.414207650273224,3.2918637653736993,2.9388456252863033,-0.0724174460837887,0.0175452104512005,-0.05364602989593187,0.2371497230416858,0.654280510018215,0.8390097760958688,0.1571232249198351,0.07540983606557378,0.010091453800063072,0.004580852038479157,0.0,0.0,0.0,213.6393256464687,-110.64007694539532,-993.6406289576885,1499.85154707504,1988.8808418046046,1085.2049656851686,0.0,0.0,0.0,472.3750336771146,654.7091807628286,801.071248320193,0.0,0.0,0.0,0.0,0.0,0.0,-720.1967118437865,-1107.8913582749399,-1342.9903505319594,-1403.8648671338967,5.050857300591692 +2,2019.0,1,0.056818181818181816,0.09244486156733928,0.1300523062291964,0.2703168044077135,0.6707336148912874,0.6131716595339991,0.28546831955922863,0.9438448302831222,0.08083689966714218,2904.0,6393.0,4206.0,3.6797520661157024,3.4509619896762085,3.1238706609605327,-0.03246539201101928,-0.04621228718062653,-0.05406771568903487,0.030094884165477898,0.5971074380165289,0.7889879555764117,0.3361864003804089,0.09263085399449036,0.06053496011262318,0.032572515454113174,0.0,0.0,0.0,42.670457691692945,-237.4839503804401,-770.211367343305,1328.8826791202641,1862.0369683695599,1308.634227299552,0.0,0.0,0.0,434.4529098111861,595.0368092174058,572.6088161828362,0.0,0.0,0.0,0.0,0.0,0.0,-720.1482462933187,-1107.71303671876,-1342.717685242823,-1403.9218077781773,14.584452936336016 +2,2020.0,1,0.053445850914205346,0.08239171374764595,0.1488665576069175,0.21729957805907174,0.6454802259887006,0.5709277868660902,0.25843881856540085,0.9102322661644695,0.07758822154709044,2844.0,6372.0,4279.0,3.610056258790436,3.416195856873823,3.049310586585651,-0.0688171140646976,0.035645937236013336,-0.04211542146892655,0.2883139542416453,0.6438115330520394,0.8138731952291274,0.10773545220845993,0.08227848101265822,0.023697426239799122,0.002804393549894835,0.0,0.0,0.0,174.0046409489396,-195.64070058155994,-1140.3570869355722,1460.2168623775108,1903.88021816844,938.4885077072851,0.0,0.0,0.0,450.0661997239399,623.9040452305816,634.5257175670146,0.0,0.0,0.0,0.0,0.0,0.0,-720.1518044398651,-1107.7799191624265,-1342.8317476551274,-1403.8709970086531,3.5859366091688294 +2,2021.0,1,0.059182209469153514,0.08415919458864245,0.1695461875143976,0.17647058823529413,0.6229353468617272,0.5420410043768716,0.24354375896700142,0.8746263960987888,0.07947477539737388,2788.0,6357.0,4341.0,3.514347202295552,3.3566147553877617,2.9661368348306842,-0.07802121764705883,-0.047347681714370426,-0.04582213207487809,0.03234838650080629,0.6639167862266858,0.8282208588957055,0.3492282884128081,0.07137733142037303,0.013056473179172566,0.017277125086385625,0.0,0.0,0.0,236.80778474989575,-108.00334137305549,-507.1932795434552,1523.020006178467,1991.5175773769445,1571.652315099402,0.0,0.0,0.0,472.2481994387709,653.9338294657625,803.2169191675517,0.0,0.0,0.0,0.0,0.0,0.0,-720.1758610322416,-1107.8056652116566,-1342.8619844769569,-1403.8435541537729,18.146483124667206 +2,2022.0,1,0.06156648451730419,0.08183538315988648,0.18277599633531838,0.13916211293260475,0.5912961210974456,0.5169491525423728,0.22185792349726777,0.8315988647114475,0.076042143838754,2745.0,6342.0,4366.0,3.414207650273224,3.2918637653736993,2.9388456252863033,-0.0724174460837887,0.0175452104512005,-0.05364602989593187,0.2371497230416858,0.654280510018215,0.8390097760958688,0.1571232249198351,0.07540983606557378,0.010091453800063072,0.004580852038479157,0.0,0.0,0.0,213.6393256464687,-110.64007694539532,-993.6406289576885,1499.85154707504,1988.8808418046046,1085.2049656851686,0.0,0.0,0.0,472.3750336771146,654.7091807628286,801.071248320193,0.0,0.0,0.0,0.0,0.0,0.0,-720.1967118437865,-1107.8913582749399,-1342.9903505319594,-1403.8648671338967,5.050857300591692 \ No newline at end of file diff --git a/src/test/java/simpaths/integrationtest/expected/Statistics31.csv b/src/test/java/simpaths/integrationtest/expected/Statistics31.csv index 9773f577e..10d0e260e 100644 --- a/src/test/java/simpaths/integrationtest/expected/Statistics31.csv +++ b/src/test/java/simpaths/integrationtest/expected/Statistics31.csv @@ -1,9 +1,9 @@ run,time,id_Statistics31,careAdj,demFertAdj,demFertRateSim,demFertRateTarget,demPartnerAdj,demPartnerSimShare,demPartnerTargetShare,demUtilAdjCouple,demUtilAdjSingleF,demUtilAdjSingleM 1,2019.0,1,0.0,-0.279462622342386,0.060041407867494824,0.06092462518117112,-0.613869665517935,0.5523988206915036,0.639752445827121,0.0,0.0,0.0 -1,2020.0,1,0.0,-0.2659197918000082,0.02770330652368186,0.059320659210062375,-0.5988444469664678,0.5142210084593353,0.6494882472052341,0.0,0.0,0.0 -1,2021.0,1,0.0,-0.25543875103684177,0.025157232704402517,0.0570746110314559,-0.5821259283872153,0.4838302676140514,0.6444373367775469,0.0,0.0,0.0 -1,2022.0,1,0.0,-0.24930347300809638,0.021340547039374814,0.05798520015481514,-0.584760268520426,0.456553365956884,0.6442540414107724,0.0,0.0,0.0 +1,2020.0,1,0.0,-0.2659197918000082,0.02981514609421586,0.059320659210062375,-0.5988444469664678,0.5157635139638739,0.6494882472052341,0.0,0.0,0.0 +1,2021.0,1,0.0,-0.25543875103684177,0.028185907046476763,0.0570746110314559,-0.5821259283872153,0.4879734219269103,0.6444373367775469,0.0,0.0,0.0 +1,2022.0,1,0.0,-0.24930347300809638,0.020451127819548873,0.05798520015481514,-0.584760268520426,0.4572751322751323,0.6442540414107724,0.0,0.0,0.0 2,2019.0,1,0.0,-0.279462622342386,0.060041407867494824,0.06092462518117112,-0.613869665517935,0.5523988206915036,0.639752445827121,0.0,0.0,0.0 -2,2020.0,1,0.0,-0.2659197918000082,0.02770330652368186,0.059320659210062375,-0.5988444469664678,0.5142210084593353,0.6494882472052341,0.0,0.0,0.0 -2,2021.0,1,0.0,-0.25543875103684177,0.025157232704402517,0.0570746110314559,-0.5821259283872153,0.4838302676140514,0.6444373367775469,0.0,0.0,0.0 -2,2022.0,1,0.0,-0.24930347300809638,0.021340547039374814,0.05798520015481514,-0.584760268520426,0.456553365956884,0.6442540414107724,0.0,0.0,0.0 \ No newline at end of file +2,2020.0,1,0.0,-0.2659197918000082,0.02981514609421586,0.059320659210062375,-0.5988444469664678,0.5157635139638739,0.6494882472052341,0.0,0.0,0.0 +2,2021.0,1,0.0,-0.25543875103684177,0.028185907046476763,0.0570746110314559,-0.5821259283872153,0.4879734219269103,0.6444373367775469,0.0,0.0,0.0 +2,2022.0,1,0.0,-0.24930347300809638,0.020451127819548873,0.05798520015481514,-0.584760268520426,0.4572751322751323,0.6442540414107724,0.0,0.0,0.0 \ No newline at end of file diff --git a/src/test/java/simpaths/model/PersonTest.java b/src/test/java/simpaths/model/PersonTest.java index b5bfb8c8c..411479784 100644 --- a/src/test/java/simpaths/model/PersonTest.java +++ b/src/test/java/simpaths/model/PersonTest.java @@ -361,7 +361,9 @@ class Eq5dTests { @BeforeEach void setup() { + testPerson = new Person(true); + testPerson.setDemAge(30); } @Nested @@ -388,7 +390,7 @@ public void calculatesLowScoreCorrectly() { testPerson.onEvent(Person.Processes.HealthEQ5D); - assertEquals(-0.594, testPerson.getHe_eq5d()); + assertEquals(-0.594, testPerson.getDemLifeSatEQ5D()); } @@ -402,7 +404,7 @@ public void calculatesHighScoreCorrectly() { testPerson.onEvent(Person.Processes.HealthEQ5D); - assertEquals(1, testPerson.getHe_eq5d()); + assertEquals(1, testPerson.getDemLifeSatEQ5D()); } @@ -433,7 +435,7 @@ public void calculatesLowScoreCorrectly() { testPerson.onEvent(Person.Processes.HealthEQ5D); - assertEquals(-0.594, testPerson.getHe_eq5d()); + assertEquals(-0.594, testPerson.getDemLifeSatEQ5D()); } @@ -447,7 +449,7 @@ public void calculatesHighScoreCorrectly(){ testPerson.onEvent(Person.Processes.HealthEQ5D); // The maximum possible value given by the Franks coefficients - assertEquals(0.9035601, testPerson.getHe_eq5d()); + assertEquals(0.9035601, testPerson.getDemLifeSatEQ5D()); }