# DC Offset Detection

### Description

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

### Usage

1 2 3 4 | ```
dailyDCOffsetMetric(df, offsetDays=5,
outlierWindow=7,
outlierThreshold=6.0,
outlierSelectivity=0.1)
``` |

### Arguments

`df` |
a dataframe containing |

`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 |

### 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

1 2 3 4 5 6 7 | ```
# 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
``` |

### Value

A list is returned with a `MultipleTimeValueMetric`

object for each day in the incoming dataframe..

### Note

After initial testing on stations in the IU network, a metric value > 10 appears to be indicative of a DC offset shift.

### Author(s)

Jonathan Callahan jonathan.s.callahan@gmail.com

### See Also

`getSingleValueMetrics`

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker. Vote for new features on Trello.