Performs correlation tests between two sets of shocks at each time point.
A list containing two time series objects to test for correlation
A character string specifying the alternative hypothesis: "two.sided" (default), "less", or "greater"
A character string indicating which correlation coefficient is to be used: "pearson" (default), "kendall", or "spearman"
Confidence level for the returned confidence interval
A list containing:
cor.estimate: A time series of correlation estimates
conf.int: A time series matrix containing the lower and upper bounds of the confidence intervals
The function performs correlation tests between two sets of shocks at each time point. It returns both the correlation estimates and confidence intervals for the correlation coefficient at each time point.
# Generate sample shocks
x <- ts(matrix(rnorm(1000), 100, 10))
y <- ts(matrix(rnorm(1000), 100, 10))
# Test correlation between shocks
result <- esgcortest(list(x, y))
# Plot correlation estimates with confidence intervals
plot(result$cor.estimate)
lines(result$conf.int[,1], col="red")
lines(result$conf.int[,2], col="red")