IRISMustangMetrics (version 2.3.0)

correlationMetric: 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

Value

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

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
# NOT RUN {
  
# }
# 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]]
  
# }

Run the code above in your browser using DataLab