modd {iglu} | R Documentation |
Calculate mean difference between glucose values obtained at the same time of day (MODD)
Description
The function modd produces MODD values in a tibble object.
Usage
modd(data, lag = 1, tz = "")
Arguments
data |
DataFrame object with column names "id", "time", and "gl". |
lag |
Integer indicating which lag (# days) to use. Default is 1. |
tz |
A character string specifying the time zone to be used. System-specific (see |
Details
A tibble object with 1 row for each subject, a column for subject id and a column for the MODD values is returned.
Missing values will be linearly interpolated when close enough to non-missing values.
MODD is calculated by taking the mean of absolute differences between measurements at the same time 1 day away, or more if lag parameter is set to an integer > 1.
Value
A tibble object with two columns: subject id and corresponding MODD 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
data(example_data_1_subject)
modd(example_data_1_subject)
modd(example_data_1_subject, lag = 2)
data(example_data_5_subject)
modd(example_data_5_subject, lag = 2)