confIntFisherTrafo: Confidence interval for correlation coefficient using...

Description Usage Arguments Value Author(s) Examples

Description

Compute a confidence interval for a correlation coefficient r using the variance-stabilizing transformation

z = \tanh^{-1}(r) = 0.5 \log((1 + r) / (1 - r)),

known as Fisher's z-transformation. By means of this transformation, r is approximately normally distributed with variance (n-3)^{-1} independent of the true correlation ρ, enabling construction of a Wald-type confidence interval. Back-transformation yields a confidence interval for the correlation coefficient. An advantage of this approach is that the limits of the confidence interval are contained in (-1, 1).

Usage

1
2
confIntFisherTrafo(var1, var2, pp = c(0.025, 0.975), meth = 
    "spearman", type = "t")

Arguments

var1

Vector containing first variable.

var2

Vector containing first variable.

pp

Vector in R^2 that contains α / 2 and 1 - α/2, where alpha is the confidence level of the confidence interval.

meth

Correlation coefficient to be used: pearson or spearman.

type

Quantile to be used: z or t.

Value

Yields a list with entries:

estimate

Value of correlation coefficient.

ci

Computed confidence interval.

p.value

p-value for a test on ρ = 0 based on the transformation.

n

Number of observations.

p2

p-value based on the R function cor.est.

Author(s)

Kaspar Rufibach
kaspar.rufibach@gmail.com

Examples

1
2
3
4
5
n <- 40
x <- runif(n)
y <- 2 * x + 0.5 * rnorm(n)
plot(x, y)
confIntFisherTrafo(x, y, pp = c(0.025, 0.975), meth = "spearman", type = "t")

biostatUZH documentation built on May 2, 2019, 6:06 p.m.