Calculates Glucose Color Index (GCI) using long-format raw CGM time series in a dataframe with sensible defaults
Source:R/GCI.R
calculate_GCI.data.frame.Rd
Calculates Glucose Color Index (GCI) using long-format raw CGM time series in a dataframe with sensible defaults
Usage
# S3 method for data.frame
calculate_GCI(
x,
weights = default_weights(),
means = c(long_slope = 0, long_midpoint = 0, int_slope = 0, int_midpoint = 0,
short_slope = 0, short_midpoint = 0),
stddevs = c(long_slope = 1, long_midpoint = 1, int_slope = 1, int_midpoint = 1,
short_slope = 1, short_midpoint = 1),
...
)
Arguments
- x,
dataframe containing time argument in "timestamp" column and CGM argument in "glucose" column
- weights,
numeric vector of weights used to form the GCI linear combination
- means,
numeric vector of mean values for the 6 degree of freedom approximation, subtracted away before calculation of GCI
- stddevs,
numeric vector of standard deviations for each of the values within the 6 degree of freedom approximation, used for scaling before GCI calculation
- ...,
can include list of periodogram options: number of expected days in the data ("days"), maximum gap in the data allowable ("maxgap", in days), minimum data for analysis ("mindata" in days), amount of start and end data to trim ("strim" and "etrim" both in days), and odd-value spans of Daniel smoothing kernels ("spans"). This argument is required, and a set of reasonable defaults is provided by the default_pgram() function.
Details
Using weights, defaulting to those derived from analysis of the repeat CGM wears in the HYPNOS trial, generates the GCI as a weighted linear combination of a provided 6 degree of freedom disjoint piece-wise linear approximation of the log-periodogram. If columnnames are not properly specified, an error will be thrown.