Title: | Jackknife Euclidean / Empirical Likelihood Inference for Spearman's Rho |
---|---|
Description: | Functions for conducting jackknife Euclidean / empirical likelihood inference for Spearman's rho (de Carvalho and Marques (2012) <doi:10.1080/10920277.2012.10597644>). |
Authors: | Miguel de Carvalho [aut, cre] |
Maintainer: | Miguel de Carvalho <[email protected]> |
License: | GPL (>= 3) |
Version: | 1.1 |
Built: | 2025-02-04 04:09:08 UTC |
Source: | https://github.com/cran/spearmanCI |
Danish Fire Insurance Claims Database includes 2167 industrial fire losses gathered from the Copenhagen Reinsurance Company over the period 1980–1990.
data(fire)
data(fire)
A dataframe with 2167 observations on five variables. The object
is of class data.frame
.
data(fire) attach(fire) plot(building, contents, pch = 20, xlim = c(0,95), ylim = c(0,133), xlab = "Loss of Building", ylab = "Loss of Contents", main = "Danish Fire Insurance Claims")
data(fire) attach(fire) plot(building, contents, pch = 20, xlim = c(0,95), ylim = c(0,133), xlab = "Loss of Building", ylab = "Loss of Contents", main = "Danish Fire Insurance Claims")
Computes jackknife Euclidean / empirical likelihood confidence intervals for Spearman's correlation.
spearmanCI(x, y, level = 0.95, method = "Euclidean", plot = FALSE)
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 |
logical; if |
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.
## 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)
## 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)