glucopy.metrics.mard#
- glucopy.metrics.mard(cgm_df: DataFrame, smbg_df: DataFrame, slack: int = 0, interpolate: bool = True)[source]#
- Calculates the Mean Absolute Relative Difference (MARD). \[MARD = \frac{1}{N} \sum_{i=1}^N \frac{|CGM_i - SMBG_i|}{SMBG_i} * 100\]- \(N\) is the number of SMBG readings. 
- \(CGM_i\) is the Continuous Glucose Monitoring (CGM) value at time i. 
- \(SMBG_i\) is the Self-Monitoring of Blood Glucose (SMBG) value at time i. 
 - Parameters:
- cgm_df (pandas.DataFrame) – DataFrame containing the CGM values. The dataframe must contain ‘CGM’ and ‘Timestamp’ columns present in - glucopy.Gframe.data.
- smbg_df (pandas.DataFrame) – DataFrame containing the SMBG values. The dataframe must contain ‘SMBG’ and ‘Timestamp’ columns present in - glucopy.Gframe.data.
- slack (int, default 0) – Maximum number of minutes that a given CGM value can be from an SMBG value and still be considered a match. 
- interpolate (bool, default True) – If True, the SMBG values will be interpolated to the CGM timestamps. If False, Only CGM values that have corresponding SMBG values will be used. 
 
- Returns:
- mard – Mean Absolute Relative Difference (MARD). 
- Return type:
- float 
 - Notes - This function is meant to be used by - glucopy.Gframe.mard()