Learn R Programming

IRISMustangMetrics (version 2.4.6)

spikesMetric: Find spikes using a rolling Hampel filter

Description

The spikesMetric() function determines the number of spikes in a seismic Stream.

Usage

spikesMetric(st, windowSize=41, thresholdMin=10, selectivity=NA, fixedThreshold=TRUE)

Value

A list of SingleValueMetric objects is returned.

Arguments

st

a Stream object containing a seismic signal

windowSize

The window size to roll over (default=41)

thresholdMin

Initial value for outlier detection (default=10.0)

selectivity

Numeric factor [0-1] used in determining outliers, or NA if fixedThreshold=TRUE (default=NA)

fixedThreshold

TRUE or FALSE, set the threshold=thresholdMin and ignore selectivity (default=TRUE)

Author

Jonathan Callahan jonathan@mazamascience.com

Details

This function uses the output of the findOutliers() function in the seismicRoll package to calculate the number of 'spikes' containing outliers.

The thresholdMin level is similar to a sigma value for normally distributed data. Hampel filter values above 6.0 indicate a data value that is extremely unlikely to be part of a normal distribution (~ 1/500 million) and therefore very likely to be an outlier. By choosing a relatively large value for thresholdMin we make it less likely that we will generate false positives. False positives can include high frequency environmental noise.

The selectivity is a value between 0 and 1 and is used to generate an appropriate threshold for outlier detection based on the statistics of the incoming data. A lower value for selectivity will result in more outliers while a value closer to 1.0 will result in fewer. The code ignores selectivity if fixedThreshold=TRUE.

The fixedThreshold is a logical TRUE or FALSE. If TRUE, then the threshold is set to thresholdMin. If FALSE, then the threshold is set to maximum value of the roll_hample() function output multiplied by the selectivity.

The total count of spikes reflects the number of outlier data points that are separated by at least one non-outlier data point. Each individual spike may contain more than one data point.

Examples

Run this code
  if (FALSE) {
# Open a connection to IRIS DMC webservices
iris <- new("IrisClient")

# Get the waveform
starttime <- as.POSIXct("2013-01-03 15:00:00", tz="GMT")
endtime <- starttime + 3600 * 3  
st <- getDataselect(iris,"IU","RAO","10","BHZ",starttime,endtime)

# Calculate the gaps metrics and show the results
metricList <- spikesMetric(st)
dummy <- show(metricList)
  }

Run the code above in your browser using DataLab