glucopy.metrics.mage#

glucopy.metrics.mage(df: DataFrame)[source]#

Calculates the Mean Amplitude of Glycaemic Excursions (MAGE).

\[MAGE = \frac{1}{K} \sum \lambda_i * I(\lambda_i > s)\]
  • \(\lambda_i\) is the difference between a pair of consecutive peak and nadir of glycaemia (or nadir-peak).

  • \(s\) is the standar deviation of the glucose values.

  • \(I(\lambda_i > s)\) is the indicator function that returns 1 if \(\lambda_i > s\) and 0 otherwise.

  • \(K\) is the number of events such that \(\lambda_i > s\)

Parameters:

df (pandas.DataFrame) – DataFrame containing the CGM values. The dataframe must contain ‘CGM’ column present in glucopy.Gframe.data.

Returns:

mage – Mean Amplitude of Glycaemic Excursions (MAGE).

Return type:

float

Notes

This function is meant to be used by glucopy.Gframe.mage()