Utility Data

To run the data processing for the utility data:

cd LEAP
python3 leap/data_generation/utility_data.py

leap.data_generation.utility_data module

leap.data_generation.utility_data.load_eq5d_data(max_age: int = 111) pandas.core.frame.DataFrame[source]

Load EQ-5D data from the original Excel file and process it into a DataFrame.

The original data file is formatted as follows:

Variable Total
(N = 1207)
p value* Female
(N = 662)
Male
(N = 545)
All eq5d (sd) eq5d (sd) eq5d (sd)
Age group
18–24 eq5d (sd) eq5d (sd) eq5d (sd)
25–34 eq5d (sd) eq5d (sd) eq5d (sd)
35–44 eq5d (sd) eq5d (sd) eq5d (sd)
45–54 eq5d (sd) eq5d (sd) eq5d (sd)
55–64 eq5d (sd) eq5d (sd) eq5d (sd)
65–74 eq5d (sd) eq5d (sd) eq5d (sd)
75 + eq5d (sd) < 0.01 eq5d (sd) eq5d (sd)
Education
... ... ... ... ...
Parameters:
max_age : int

The maximum age to consider in the data.

Returns:

A DataFrame containing EQ-5D utility values by age and sex. Columns:

  • age (int): Age of the individual.

  • sex (str): One of "F" = female or "M" = male.

  • eq5d (float): EQ-5D utility value.

  • sd (float): Standard deviation of the EQ-5D utility value.

leap.data_generation.utility_data.interpolate_eq5d(age: int, eq5d_upper: float, age_upper: int = 18) float[source]

Interpolate EQ-5D value for ages below 18 based on the EQ-5D value at 18.

Parameters:
age: int

Age for which to interpolate the EQ-5D value. Must be in range [0, 18].

eq5d_upper: float

EQ-5D value at the upper age limit (default is 18).

age_upper: int = 18

Upper age limit for interpolation (default is 18).

Returns:

Interpolated EQ-5D value for the given age.

leap.data_generation.utility_data.interpolate_eq5d_data(df_utility: pandas.core.frame.DataFrame) pandas.core.frame.DataFrame[source]

Interpolate EQ-5D data to fill in missing ages below 18.

The EQ-5D data was only available for ages 18 and above, so this function generates EQ-5D values for ages 0 to 17 by interpolating from the values at age 18.

Parameters:
df_utility: pandas.core.frame.DataFrame

DataFrame containing EQ-5D data for ages 18 and above:

  • age (int): Age of the individual.

  • sex (str): One of "F" = female or "M" = male.

  • eq5d (float): EQ-5D utility value.

  • sd (float): Standard deviation of the EQ-5D utility value.

Returns:

A dataframe containing EQ-5D data for ages 0 to 17, interpolated from the values at age 18. Columns:

  • age (int): Age of the individual, now including ages 0 to 17.

  • sex (str): One of "F" = female, "M" = male.

  • eq5d (float): Interpolated EQ-5D utility value for ages 0 to 17.

  • sd (float): Since the data was interpolated, the standard deviation is set to 0 for these ages.

leap.data_generation.utility_data.generate_eq5d_data()[source]

Generate EQ-5D data for ages 0 to 111.