Help for package spearmanCI (original) (raw)
Version: | 1.1 |
---|---|
Date: | 2024-06-02 |
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>). |
Author: | Miguel de Carvalho [aut, cre] |
Depends: | R (≥ 3.0.1) |
Maintainer: | Miguel de Carvalho miguel.decarvalho@ed.ac.uk |
License: | GPL (≥ 3) |
Repository: | CRAN |
Imports: | emplik, MASS |
NeedsCompilation: | no |
Packaged: | 2024-06-02 15:07:41 UTC; muad'dib |
Date/Publication: | 2024-06-02 15:20:02 UTC |
Danish Fire Insurance Claims Database
Description
Danish Fire Insurance Claims Database includes 2167 industrial fire losses gathered from the Copenhagen Reinsurance Company over the period 1980–1990.
Usage
data(fire)
Format
A dataframe with 2167 observations on five variables. The object is of class data.frame
.
Examples
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")
Jackknife Euclidean / Empirical Likelihood Inference for Spearman's Correlation
Description
Computes jackknife Euclidean / empirical likelihood confidence intervals for Spearman's correlation.
Usage
spearmanCI(x, y, level = 0.95, method = "Euclidean", plot = FALSE)
Arguments
x | vector with data. |
---|---|
y | vector with data. |
level | the confidence level required. |
method | this must be one of the strings "Euclidean" or"empirical"; see references below for details. |
plot | logical; if TRUE, it plots log-likelihood ratio function. |
Author(s)
Miguel de Carvalho
References
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.
Examples
## 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)