Learn R Programming

IRISMustangMetrics (version 1.0.1)

dailyDCOffsetMetric: DC Offset Detection

Description

The dailyDCOffsetMetric() function identifies days with a jump in the signal mean.

Usage

dailyDCOffsetMetric(df, offsetDays=5, outlierWindow=7, outlierThreshold=6.0, outlierSelectivity=0.1)

Arguments

df
a dataframe containing sample_mean values obtained with getSingleValueMetrics()
offsetDays
number of days used in calculating weighting factors
outlierWindow
window size passed to findOutliers() function in the seismic package
outlierThreshold
detection threshold passed to findOutliers() function in the seismic package
outlierSelectivity
selectivity passed to findOutliers() function in the seismic package

Value

A list is returned with a MultipleTimeValueMetric object for each day in the incoming dataframe..

Details

This algorithm calculates lagged differences of the daily mean timeseries over a window of offsetDays days. Shifts in the mean that are persistent and larger than the typical standard deviation of daily means will generate higher metric values.

Details of the algorithm are as follows

# data0 = download 12+ months of daily means (in the 'df' dataframe)
# data1 = remove outliers using MAD outlier detection with the 'outlier' arguments specified
# data2 = replace outliers with rolling median values using a 7 day window
# weights = calculate absolute lagged differences with 1-N day lags (big jumps have large values)
# metric0 = multiply the lagged differences together and take the N'th root
# stddev0 = calculate the rolling standard deviation of data2 with a N-day window
# METRIC = divide metric0 by the median value of stddev0

See Also

getSingleValueMetrics