Learn R Programming

IRISMustangMetrics (version 2.4.7)

correlationMetric: Correlation between channels

Description

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

Usage

correlationMetric(st1, st2)

Value

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

Arguments

st1

a Stream object containing a seismic signal

st2

a Stream object containing a seismic signal

Author

Jonathan Callahan jonathan@mazamascience.com

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")

Examples

Run this code
  if (FALSE) {
# Open a connection to EarthScope 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]]
  }

Run the code above in your browser using DataLab