dcor0 {GeneTS} | R Documentation |
Density and distribution function and a random number generator of Pearson's correlation coefficient assuming that there is no correlation present (rho = 0).
The degree of freedom kappa depends both on the sample size N and the number G
of investigated variables,
i.e. whether simple or partial correlation coefficients are being considered.
For G=2 (simple correlation coefficient) the degree of freedom equals kappa = N-1,
whereas for arbitrary G (with G-2 variables eliminated in the partial correlation coefficient)
kappa = N-G+1 (see also cor0.estimate.kappa
).
The incomplete beta function is needed to compute the distribution function. For
z=1 the incomplete beta function reduces to the beta function
(ibeta
(1, a, b) = beta
(a, b)).
dcor0(x, kappa, log=FALSE) pcor0(q, kappa, lower.tail=TRUE, log.p=FALSE) rcor0(n, kappa) ibeta(z, a, b)
x,q |
vector of sample correlations |
kappa |
the degree of freedom of the distribution |
n |
number of values to generate. If n is a vector, length(n) values will be generated |
log, log.p |
logical vector; if TRUE, probabilities p are given as log(p) |
lower.tail |
logical vector; if TRUE (default), probabilities are P[R <= r], otherwise, P[R > r] |
a,b,z |
numeric vectors |
For density and distribution functions (as well as a corresponding random number generator)
of the correlation coefficient for arbitrary values of rho please refer to the
SuppDists
package by Bob Wheeler bwheeler@echip.com (available on CRAN).
Note that the parameter N in the dPearson
function (and others in the SuppDists
package)
corresponds to N=kappa+1 (i.e. G=2).
The output values conform to the output from other such functions
in R. dcor0
gives the density and pcor0
the distribution function.
The function ibeta
returns a numeric value.
Juliane Schaefer (http://www.stat.uni-muenchen.de/~schaefer/) and Korbinian Strimmer (http://www.stat.uni-muenchen.de/~strimmer/).
cor
, cor0.estimate.kappa
, beta
.
# load GeneTS library library(GeneTS) # 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) # incomplete beta function ibeta(0.4, 1, 3) ibeta(1, 2, 3) beta(2, 3)