Learn R Programming

ESGtoolkit (version 0.2.0)

esgcortest: Correlation tests for the shocks

Description

This function performs correlation tests for the shocks generated by simshocks.

Usage

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

Arguments

x

gaussian (bivariate) shocks, with correlation, generated by simshocks.

alternative

indicates the alternative hypothesis and must be one of "two.sided", "greater" or "less".

method

which correlation coefficient is to be used for the test : "pearson", "kendall", or "spearman".

conf.level

confidence level.

Value

a list with 2 components : estimated correlation coefficients, and confidence intervals for the estimated correlations.

References

D. J. Best & D. E. Roberts (1975), Algorithm AS 89: The Upper Tail Probabilities of Spearman's rho. Applied Statistics, 24, 377-379.

Myles Hollander & Douglas A. Wolfe (1973), Nonparametric Statistical Methods. New York: John Wiley & Sons. Pages 185-194 (Kendall and Spearman tests).

See Also

esgplotbands

Examples

Run this code
# NOT RUN {
nb <- 500

s0.par1 <- simshocks(n = nb, horizon = 3, frequency = "semi",
family = 1, par = 0.2)

s0.par2 <- simshocks(n = nb, horizon = 3, frequency = "semi", 
family = 1, par = 0.8)

(test1 <- esgcortest(s0.par1))
(test2 <- esgcortest(s0.par2))
par(mfrow=c(2, 1))
esgplotbands(test1)
esgplotbands(test2)

# }

Run the code above in your browser using DataLab