Allow variable prediction times to allow more aggressive behaviour of the system
This feature would allow the user to adjust the period over which the user can adjust the predictions with the belief that making it a shorter period would enable the algorithm to be more aggressive in its dosing.
The user would be able to enter a parameter that enabled them to pick a "look-ahead" period of up to four hours.
I've created a branch in my own repo, based on the floating carbs branch, that adds an additional parameter to preferences.json, allowing a value to be used to adjust the prediction period.
Oref0-simulator has then been run using the backtest function with 18 days of data. Each test was run with the same data set each time. Prediction periods of between 30 mins and 4 hours were applied and each prediction period was tested with 30, 60 and 90 minutes of basal as SMB.
The output is shown below:
30 mins SMB
| Mins | Low | In-Range | High |
|---|---|---|---|
| 30 | 38.2 | 51 | 10.8 |
| 60 | 23.3 | 61.9 | 14.8 |
| 90 | 15.9 | 63.5 | 20.6 |
| 120 | 12.8 | 64.1 | 23.1 |
| 150 | 12.7 | 63.3 | 24 |
| 180 | 11.9 | 63.1 | 25 |
| 210 | 11.7 | 63.2 | 25.1 |
| 240 | 12.3 | 62.9 | 24.8 |
60 mins SMB
| Mins | Low | In-Range | High |
|---|---|---|---|
| 30 | 38.8 | 52.1 | 9.1 |
| 60 | 23 | 63.5 | 13.5 |
| 90 | 16.3 | 64 | 19.7 |
| 120 | 14.4 | 67.2 | 18.4 |
| 150 | 13.8 | 66.9 | 19.3 |
| 180 | 13.6 | 65.5 | 20.9 |
| 210 | 13.1 | 66.6 | 20.3 |
| 240 | 13.9 | 65.4 | 20.7 |
90 mins SMB
| Mins | Low | In-Range | High |
|---|---|---|---|
| 30 | 39.2 | 51.8 | 9 |
| 60 | 22.6 | 63.6 | 13.8 |
| 90 | 15.9 | 64.5 | 19.6 |
| 120 | 14.4 | 67.5 | 18.1 |
| 150 | 13.8 | 66.7 | 19.5 |
| 180 | 14.2 | 66.5 | 19.3 |
| 210 | 13.4 | 66.4 | 20.2 |
| 240 | 14.5 | 65.7 | 19.8 |
The data suggests that any prediction below 120 mins produces a higher rate of lows than is acceptable (assuming 15% is acceptable in no-intervention or observation mode).
Between 120 mins and 240 mins, the variation of TIR and hypo rates is relatively small, and seems to be driven more heavily by MaxSMBBasalMinutes than the period over which the predictions occur.
This simulation raises an interesting question on the effects of increasing MaxSMBBasalMinutes in itself, given the nearly 20% greater amount of time spent below 70mg/dl with 90mins instead of 30 mins at the standard 4hr prediction.
The simulation suggests that the optimal prediction period for reducing time spent below 70mg/dl, given this data set, is 3.5 hours.
I'm happy to run these backtest scenarios with other users Nightscout data. Please contact me if you'd like me to do so.
I have been running my AndroidAPS for about a year now with a forecast time of 180 minutes. My objective was to try and reduce the amount of time stuck on high. My informal observation would be that it was successful on the score - but that you would also need to be careful that once the high ended then BG does not drop too rapidly and enter the hypo range. If I had the ability to easily edit the forecast period I would be interested to experiment further.