correlationMetric: Correlation between channels

View source: R/correlationMetric.R

correlationMetricR Documentation

Correlation between channels

Description

The correlationMetric() function calculates the correlation between two streams of seismic data.

Usage

correlationMetric(st1, st2)

Arguments

st1

a Stream object containing a seismic signal

st2

a Stream object containing a seismic signal

Details

The correlation returned is a value in the range [0-1]. This 'pearson r' correlation is a measure of the strength and direction of the linear relationship between two variables that is defined as the (sample) covariance of the variables divided by the product of their (sample) standard deviations.

Missing values are handled by casewise deletion with the following R code:

cor(x,y,use="na.or.complete")

Value

A list with a single SingleValueMetric object is returned. The metric name is cross_talk.

Note

Seismic streams passed to correlationMetric must have the same network and station, must cover the same time range and must have the same sampling rate.

The metricList generated for this two-channel metric will have a SNCL code of the form: N.S.L1:L2.C1:C2.Q.

Author(s)

Jonathan Callahan jonathan@mazamascience.com

Examples

  ## Not run: 
# Open a connection to IRIS DMC webservices
iris <- new("IrisClient")

# Get seismic traces
starttime <- as.POSIXct("2013-03-01", tz="GMT")
endtime <- as.POSIXct("2013-03-02",tz="GMT")
stZ <- getDataselect(iris,"IU","ANMO","00","BHZ",starttime,endtime,inclusiveEnd=FALSE)
st1 <- getDataselect(iris,"IU","ANMO","00","BH1",starttime,endtime,inclusiveEnd=FALSE)
st2 <- getDataselect(iris,"IU","ANMO","00","BH2",starttime,endtime,inclusiveEnd=FALSE)

# Calculate correlationMetric
correlationMetric(stZ,st1)[[1]]
correlationMetric(stZ,st2)[[1]]
correlationMetric(st1,st2)[[1]]
  
## End(Not run)

IRISMustangMetrics documentation built on April 28, 2022, 1:06 a.m.