The above functions describe the distribution of the Pearson correlation
r assuming that there is no correlation present (
rho = 0).
Note that the distribution has only a single parameter: the degree
kappa, which is equal to the inverse of the variance of the distribution.
The theoretical value of
kappa depends both on the sample size
n and the number
p of considered variables. If a simple correlation coefficient between two
p=2) is considered the degree of freedom equals
kappa = n-1.
However, if a partial correlation coefficient is considered (conditioned on
variables) the degree of freedom is
kappa = n-1-(p-2) = n-p+1.
1 2 3 4
vector of sample correlations
vector of probabilities
the degree of freedom of the distribution (= inverse variance)
number of values to generate. If n is a vector, length(n) values will be generated
logical vector; if TRUE, probabilities p are given as log(p)
logical vector; if TRUE (default), probabilities are P[R <= r], otherwise, P[R > r]
For density and distribution functions as well as a corresponding random number generator
of the correlation coefficient for arbitrary non-vanishing correlation
rho please refer to the
SuppDists package by Bob Wheeler firstname.lastname@example.org (available on CRAN).
Note that the parameter
N in his
dPearson function corresponds to
dcor0 gives the density,
gives the distribution function,
the quantile function, and
rcor0 generates random deviates.
Korbinian Strimmer (https://strimmerlab.github.io).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
# load fdrtool library library("fdrtool") # distribution of r for various degrees of freedom x = seq(-1,1,0.01) y1 = dcor0(x, kappa=7) y2 = dcor0(x, kappa=15) plot(x,y2,type="l", xlab="r", ylab="pdf", xlim=c(-1,1), ylim=c(0,2)) lines(x,y1) # simulated data r = rcor0(1000, kappa=7) hist(r, freq=FALSE, xlim=c(-1,1), ylim=c(0,5)) lines(x,y1,type="l") # distribution function pcor0(-0.2, kappa=15)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.