glucopy.Gframe.conga#
- Gframe.conga(per_day: bool = False, m: int = 1, slack: int = 0, ignore_na: bool = True, ddof: int = 1)[source]#
Calculates the Continuous Overall Net Glycaemic Action (CONGA).
\[CONGA = \sqrt{\frac{1}{k-ddof} \sum_{t=t1} (D_t - \bar D)^2}\]\(ddof\) is the Delta Degrees of Freedom.
\(D_t\) is the difference between glycaemia at time t and t minus m hours ago.
\(\bar D\) is the mean of the differences (\(D_t\)).
\(k\) is the number of differences.
- Parameters:
per_day (bool, default False) – If True, returns the CONGA for each day separately. If False, returns the CONGA for the entire dataset.
m (int, default 1) – Number of hours to use for the CONGA calculation.
slack (int, default 0) – Maximum number of minutes that the given time can differ from the actual time in the data.
ignore_na (bool, default True) – If True, ignores missing values (not found within slack). If False, raises an error if there are missing values.
ddof (int, default 1) – Delta Degrees of Freedom. The divisor used in calculations of standard deviation is N - ddof, where N represents the number of elements.
- Returns:
conga – List of CONGA for each day.
- Return type:
list
Examples
Calculating the CONGA for the entire dataset (default):
In [1]: import glucopy as gp In [2]: gf = gp.data('prueba_1') In [3]: gf.conga() Out[3]: 45.718116219771694
Calculating the CONGA for each day with a 5 minutes slack:
In [4]: gf.conga(per_day=True, slack=5) Out[4]: Day 2020-11-27 39.420203 2020-11-28 48.749528 2020-11-29 42.539827 2020-11-30 38.670023 2020-12-01 43.761159 ... 2021-03-14 39.162393 2021-03-15 55.081212 2021-03-16 41.223525 2021-03-17 40.082720 2021-03-18 38.906165 Name: CONGA, Length: 112, dtype: float64