Skip to contents

Pad the CGM time series with zeros

Usage

pad_for_pgram(ts, arg, options, consts, interval)

Arguments

ts,

numeric time series of CGM data as a numeric vector

arg,

POSIXct vector of timestamps for CGM time series

options,

list containing relevant settings for periodogram calculation, including 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")

consts,

list of observation frequency constants

interval,

time (in minutes) between CGM observations

Value

spec_data, vector containing the original CGM time series with appropriate zero-padding (assuming sufficient data and continuity)

Details

Ensures that glucose observations are appropriately and evenly spaced, accounting for missing data within and potentially at the end of the time series. Required step for accurate estimates of the spectral density from the periodogram.