-
Notifications
You must be signed in to change notification settings - Fork 139
Description
UPDATE: See my update in a post below - this also has a problem.
This here is simply adding two means:
simglucose/simglucose/analysis/risk.py
Line 16 in c51e7f2
| RI = LBGI + HBGI |
However, adding up two means (or taking the mean) of sub-sequences that are different in length does not equal the mean of the whole sequence:

Instead we have to weigh the each individual mean by the length of sequence it represents. Like this:
weight_rl = len(rl) / horizon
weight_rh = len(rh) / horizon
RI = weight_rl*LBGI + weight_rh*HBGIWhile risk index is not explicitly defined in any paper I can find (neither here nor here) - only the low and high risk indicies are defined:

it is not unreasonable to assume that it should be defined such that risk function applied to the whole trajectory would result in the same mean as the combination of low and high risk indicies, e.g.:
The nice thing about weighing the LBGI and HBGI is that the final risk then is still bounded between 0 and 100.
