Learn R Programming

GeneNet (version 1.2.16)

cor0.test: Test of Vanishing (Partial) Correlation

Description

cor0.test computes a p-value for the two-sided test with the null hypothesis H0: rho == 0 versus the alternative hypothesis HA: rho != 0.

If method="student" is selected then the statistic t=r*sqrt((kappa-1)/(1-r*r)) is considered which under H0 is student-t distributed with df=kappa-1. This method is exact.

If method="dcor0" is selected then the p-value is computed directly from the null distribution of the (partial) correlation (see dcor0). This method is also exact.

If method="ztransform" is selected then the p-value is computed using the z-transform (see z.transform), i.e. using a suitable chosen normal distribution. This method returns approximate p-values.

Usage

cor0.test(r, kappa, method=c("student", "dcor0", "ztransform"))

Arguments

r

observed correlation

kappa

degree of freedom of the null-distribution

method

method used to compute the p-value

Value

A p-value.

See Also

dcor0, kappa2n, z.transform.

Examples

Run this code
# NOT RUN {
# load GeneNet library
library("GeneNet")

# covariance matrix
m.cov <- rbind(
 c(3,1,1,0),
 c(1,3,0,1),
 c(1,0,2,0),
 c(0,1,0,2)
)

# compute partial correlations
m.pcor <- cor2pcor(m.cov)
m.pcor

# corresponding p-values 
# assuming a sample size of 25, i.e. kappa=22
kappa2n(22, 4)
cor0.test(m.pcor, kappa=22)
cor0.test(m.pcor, kappa=22) < 0.05

# p-values become smaller with larger r 
cor0.test(0.7, 12)
cor0.test(0.8, 12)
cor0.test(0.9, 12)

# comparison of various methods
cor0.test(0.2, 45, method="student")
cor0.test(0.2, 45, method="dcor0")
cor0.test(0.2, 45, method="ztransform")
# }

Run the code above in your browser using DataLab