ld-archer / E_FEM

This is the repository for the English version of the Future Elderly Model, originally developed at the Leonard D. Schaeffer Center for Health Policy and Microsimulation.
MIT License
3 stars 1 forks source link

fix creation of the social isolation component variables #114

Closed ld-archer closed 1 year ago

ld-archer commented 1 year ago

Components of the social isolation index are created in the wave_specific_data.do file. These are:

Other components come directly from ELSA questions so don't need to be fixed.

The problem I think is that, because the definitions of these variables are complex (separate variables for different types of contact: text, phone call, face to face etc.) I originally had a series of replace == 1 if ... ; replace == 0 if ...

I think this means that the last replace command for each component decides the entire thing. Because of this I need to refactor this to account for all factors in one statement, i.e. replace == 1 if x & if y & if z & ... OR take the previous assigned values into account in the chain. i.e. replace kcntm = 1 if scchdg > 0 & scchdg < 4 & !missing(scchdg) | kcntm == 1 (from previous).

ld-archer commented 1 year ago

Drastic changes!!

Appears this was a bit of a cock up. Top is original, bottom is new:

. tab kcntm, m

 Monthly or |
       more |
    contact |
       with |
   children |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |     40,690       40.88       40.88
          1 |     32,833       32.99       73.86
          . |     26,014       26.14      100.00
------------+-----------------------------------
      Total |     99,537      100.00

. tab kcntm2, m

     kcntm2 |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |     12,884       12.94       12.94
          1 |     60,639       60.92       73.86
          . |     26,014       26.14      100.00
------------+-----------------------------------
      Total |     99,537      100.00

Can't do anything about the missing information unfortunately but definite improvement. Now to see what this does for the transition models.

ld-archer commented 1 year ago

All var definitions fixed and tested in 2ec0852.