esgcortest | R Documentation |
Performs correlation tests between two sets of shocks at each time point.
esgcortest(
x,
alternative = c("two.sided", "less", "greater"),
method = c("pearson", "kendall", "spearman"),
conf.level = 0.95
)
x |
A list containing two time series objects to test for correlation |
alternative |
A character string specifying the alternative hypothesis: "two.sided" (default), "less", or "greater" |
method |
A character string indicating which correlation coefficient is to be used: "pearson" (default), "kendall", or "spearman" |
conf.level |
Confidence level for the returned confidence interval |
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.
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
# 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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.