esgcortest: Correlation test for shocks

View source: R/tests.R

esgcortestR Documentation

Correlation test for shocks

Description

Performs correlation tests between two sets of shocks at each time point.

Usage

esgcortest(
  x,
  alternative = c("two.sided", "less", "greater"),
  method = c("pearson", "kendall", "spearman"),
  conf.level = 0.95
)

Arguments

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

Details

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.

Value

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

Examples

# 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")


Techtonique/ESGtoolkit documentation built on June 11, 2025, 6:24 p.m.