Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
962e4d4
added noise to MCS, PCS, HMC and Life sat outcomes
andrewbaxter439 Dec 12, 2025
555a1e5
add age tests to health variable updates
andrewbaxter439 Dec 15, 2025
aa69e12
amended statistics
andrewbaxter439 Dec 15, 2025
5e6daf2
updating placeholders
andrewbaxter439 Dec 15, 2025
b934f14
switch GHQ caseness estimates to two steps
andrewbaxter439 Jan 12, 2026
e000adc
add documentation to health update methods
andrewbaxter439 Jan 12, 2026
b8b552c
update regression files for health and wellbeing #311
andrewbaxter439 Jan 12, 2026
73b23bb
re-introducing missing variables for calculating regressions
andrewbaxter439 Jan 12, 2026
b27879c
change life satisfaction to 0-10 scale in initial populations
andrewbaxter439 Jan 12, 2026
2d0d0ed
add LB to initial population
andrewbaxter439 Jan 12, 2026
4881e27
updated documentation for additional health helpers #152
andrewbaxter439 Jan 12, 2026
e317f21
switched dls variable to double
andrewbaxter439 Jan 12, 2026
90d75b9
change HM1_C to ordered regression
andrewbaxter439 Jan 12, 2026
8925d4d
update training population
andrewbaxter439 Jan 12, 2026
d4f6808
initial population change ghq to 0-12
andrewbaxter439 Jan 12, 2026
5d4bda7
added constrain estimates when not updating stage 2
andrewbaxter439 Jan 13, 2026
c8ac260
change ampersand to html code for docs
andrewbaxter439 Jan 13, 2026
1c82154
corrected file indentations
andrewbaxter439 Jan 16, 2026
c9177a8
bootstrap health coefficients
andrewbaxter439 Jan 16, 2026
4d14f97
updated health and wellbeing variables to new labels
andrewbaxter439 Jan 26, 2026
213066a
updates to do files for initial population and training data
andrewbaxter439 Jan 26, 2026
ddf3c0f
Merge remote-tracking branch 'origin/develop' into bugfix/302-assign-…
andrewbaxter439 Jan 26, 2026
b2ddc32
update life satisfaction variable name
andrewbaxter439 Jan 26, 2026
6e58539
update Person health variables
andrewbaxter439 Jan 26, 2026
09b6e2c
added catch to database loading
andrewbaxter439 Jan 26, 2026
47680f6
updated test stats
andrewbaxter439 Jan 26, 2026
d57e795
add reference to new version of Jas-mine core
justin-ven Jan 27, 2026
d82dde6
Merge remote-tracking branch 'origin/develop' into bugfix/302-assign-…
andrewbaxter439 Jan 27, 2026
baa6e9d
updated test stats
andrewbaxter439 Jan 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
40 changes: 36 additions & 4 deletions input/InitialPopulations/compile/02_create_UKHLS_variables.do
Original file line number Diff line number Diff line change
Expand Up @@ -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 == .)

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion input/InitialPopulations/compile/09_finalise_input_data.do
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading