iccf_core: Compute the one-way Interpolated Cross-Correlation Function...

Description Usage Arguments Details Value Notes See Also Examples

View source: R/iccf_functions.R

Description

iccf_core returns the basic interpolated correlation coefficients.

Usage

1
iccf_core(t.1, x.1, t.2, x.2, tau, local.est = FALSE, cov = FALSE)

Arguments

t.1, x.1

time and value for time series 1

t.2, x.2

time and value for time series 2

tau

(vector) list of lags at which to compute the CCF.

local.est

(logical) use 'local' (not 'global') means and variances?

cov

(logical) if TRUE then compute covariance, not correlation coefficient.

Details

The main loop for the ICCF. In this part we take time series 1, x.1 at t.1, pair them with values from time series 2, x.2 at t.1-tau[i] produce by linearly interpolating between the nearest values of x.2. At a given tau[i] we sum the product of the paired x.1 and x.2 values r[i] = (1/n) * sum(x.1 * x.2) / (sd.1 * sd.2) In the simplest case n, sd.1 and sd.2 are constant and are the number of pairs at lag=0 and the total sqrt(var) of each time series. If local.est = TRUE then n, sd.1 and sd.2 are evaluated 'locally' i.e. they are vary for each lag tau[i]. In this case they are the number of good pairs at lag tau[i], and the sqrt(vars) of just the x.1 and x.2 data points involved. We assume x.1 and x.2 have zero sample mean.

Value

A list with components

r

(array) A one dimensional array containing the correlation coefficients at each lag.

n

(array) A one dimensional array containing the number of pairs of points used at each lag.

Notes

We assume that the input data x.1 and x.2 have been mean-subtracted.

See Also

cross_correlate, iccf

Examples

1
2
3
4
5
6
7
8
9
## Example using NGC 5548 data
t1 <- cont$t
y1 <- cont$y - mean(cont$y)
t2 <- hbeta$t
y2 <- hbeta$y - mean(hbeta$y)
tau <- seq(-150, 150)
result <- iccf_core(t1, y1, t2, y2, tau = tau)
plot(tau, result$r, type = "l")
 

svdataman/sour documentation built on April 6, 2018, 11:13 a.m.