Description Usage Arguments Value Author(s) References See Also Examples
Compute the correlation for irregular time series with or without interpolation.
1 2 3 |
x |
time series one to be analyzed. Note that time increments should be positive (i.e. time is reported as age before present). |
y |
time series two to be analyzed (if omitted, autocorrelation is computed) |
lag |
numeric vector giving lags for which correlation is to be estimated |
h |
number giving the Gaussian kernel width |
enforce |
Coerce the result to the interval (-1,1) in case of numerical problems |
conflevel |
Confidence-level for the two-sided confidence intervals around zero correlation |
dt |
Average time step for the correlation function evaluation (by default set to max(mean(dtx),mean(dty) |
smoo |
logical; set to TRUE for smoothing of variability below the time step |
detr |
logical; set to TRUE for linear detrending of the time series |
Numerical vector of the length of the lag vector.
Kira Rehfeld
Rehfeld, K. and Kurths, J.: Similarity estimators for irregular and age-uncertain time series, Clim. Past, 10, 107-122, doi:10.5194/cp-10-107-2014, 2014. Rehfeld, K., Marwan, N., Heitzig, J., and Kurths, J.: Comparison of correlation analysis techniques for irregularly sampled time series, Nonlin. Processes Geophys., 18, 389-404, doi:10.5194/npg-18-389-2011, 2011.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ## Generate one gamma-distributed and one regular time axis
tx<-generate_t(dt=1,tmin=0,tmax=100,method="gamma")
ty<-generate_t(dt=1,tmin=0,tmax=100,method="linear")
## Simulate one coupled AR1 process (see reference for details)
Proc<-car(tx,ty,coupl_strength=0.7,phi=0.5,lag=0,nsur=1)
## Bind the results to zoo time series
x<-zoo(Proc$x,order.by=tx)
y<-zoo(Proc$y,order.by=ty)
## Estimate the autocorrelation
phi.est=nexcf(x,lag=1,h=0.25)
## Estimate the cross-correlation
couplstr.est=nexcf(x=x,y=y,lag=0,h=0.05)
## Estimate the cross-correlation with interpolation
couplstr.est.interp=ixcf(x=x,y=y,lag=0)
## Estimate the effective degrees of freedom, and the significance of the correlation estimate,
## from the t-distribution.
temp<-nexcf_ci(x,y,conflevel=0.1)
# degrees of freedom used for the significance test
print(temp$neff)
print(temp$rxy)
# if rxy is outside
temp$ci
# the confidence intervals, the correlation estimate is significant at the (1-conflevel)*100% level
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.