mage: Calculate Mean Amplitude of Glycemic Excursions

Description Usage Arguments Details Value References Examples

View source: R/mage.R

Description

The function mage produces MAGE values in a tibble object.

Usage

1
mage(data, sd_multiplier = 1)

Arguments

data

DataFrame object with column names "id", "time", and "gl", or numeric vector of glucose values.

sd_multiplier

A numeric value that can change the sd value used to determine size of glycemic excursions used in the calculation.

Details

A tibble object with 1 row for each subject, a column for subject id and a column for the MAGE values is returned. NA glucose values are omitted from the calculation of MAGE.

MAGE is calculated by taking the mean of absolute differences (between each value and the mean) that are greater than the standard deviation. A multiplier can be added to the standard deviation by the sd_multiplier argument.

Value

If a data.frame object is passed, then a tibble object with two columns: subject id and corresponding MAGE value is returned. If a vector of glucose values is passed, then a tibble object with just the MAGE value is returned. as.numeric() can be wrapped around the latter to output just a numeric value.

References

Service, F. J. & Nelson, R. L. (1980) Characteristics of glycemic stability. Diabetes care 3 .58-62, doi: 10.2337/diacare.3.1.58.

Examples

1
2
3
4
5
6

stevebroll/iglu documentation built on Jan. 30, 2021, 1:53 a.m.