Description Usage Arguments Author(s) References Examples
Computes jackknife Euclidean / empirical likelihood confidence intervals for Spearman's correlation.
1 | spearmanCI(x, y, level = 0.95, method = "Euclidean", plot = FALSE)
|
x |
vector with data. |
y |
vector with data. |
level |
the confidence level required. |
method |
This must be one of the strings |
plot |
plot log-likelihood ratio function? |
Miguel de Carvalho
de Carvalho, M. and Marques, F. J. (2012). Jackknife Euclidean likelihood-based inference for Spearman's rho. North American Actuarial Journal, 16, 487–492.
Wang, R., and Peng, L. (2011). Jackknife Empirical likelihood intervals for Spearman’s rho. North American Actuarial Journal, 15, 475–486.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ## Real data example
data(fire)
attach(fire)
spearmanCI(building, contents)
## The intervals in de Carvalho and Marques (2012, Section 3.2)
## differ slightly as they are based on the estimate
## spearman <- function(x, y) {
## n <- length(x)
## F <- ecdf(x); G <- ecdf(y)
## return(12 / n * sum((F(x) - 1 / 2) * (G(y) - 1 / 2)))
## }
## Simulated data example
library(MASS)
pearson <- .7
Sigma <- matrix(c(1, pearson, pearson, 1), 2, 2)
xy <- mvrnorm(n = 1000, rep(0, 2), Sigma)
spearmanCI(xy[, 1], xy[, 2])
abline(v = 6 / pi * asin(pearson / 2), col = "grey", lty = 3)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.