This function marks a drift in the input vector.

detect_drift(
  x,
  timestamps,
  reference = list(),
  apriori = Apriori("air pressure", units = "cmH2O"),
  ...,
  plot = FALSE,
  verbose = FALSE,
  title = NULL,
  alpha = 0.01
)

# S4 method for numeric
detect_drift(x, timestamps, reference, apriori, plot, verbose, title, alpha)

Arguments

x

numeric vector of values

timestamps

timestamp vector

reference

a list of list(x, timestamps) pairs that are to be used as reference for drift detection. The more data is supplied here, the better the results.

apriori

Apriori class. Defaults to air pressure in cmH2O.

...

optional parameters, depending on signature:

plot

prints diagnostic plots. Consult the dedicated section below for more information.

verbose

adds extra information as attributes to the result.

title

adds title to the plot

alpha

significance level at which to detect drift. Defaults to 0.01.

Value

Logical vector with same length as x, specifying TRUE for drifting observations.

Details

Diagnostic plots

Top plot shows the time differences (hours) between measurements. 12 hours is signified by the red horizontal line. Note that the y-scale is logarithmic.

The middle left plot is the original series (black) overlaying the reference (darkred). In case more than one reference is supplied, only their median is shown.

The bottom left plot is the difference between the original and the reference series (or their median in case more than 1 reference is supplied) and is best suited for drift detection. The vertical dotted line signifies the most likely drift start date. Subsequently, three colors are used based on the significance: red (p < 0.001), orange and green (p > 0.01).

The right 4 smaller plots are DFTF and Year plots for the original series x (top) and differences (bottom). They are mainly used for the visualization of the seasonality patterns. The DFTF plot is in days while the yearly plot is in months. Note that the DTFT and Year plots have the drift effect subtracted. In the Year plots this results to a more pronounced seasonal pattern, and in the DTFT plot this results in lower amplitude of low frequencies (high periods).

Functions

  • detect_drift,numeric-method: