BonferroniCor: Bonferroni multiple testing procedure for correlations.

Description Usage Arguments Value References See Also Examples

View source: R/FwerMethods.R

Description

Bonferroni multiple testing procedure for correlations.

Usage

1
2
3
4
5
6
7
8
BonferroniCor(
  data,
  alpha = 0.05,
  stat_test = "empirical",
  vect = FALSE,
  logical = FALSE,
  arr.ind = FALSE
)

Arguments

data

matrix of observations

alpha

level of multiple testing (used if logical=TRUE)

stat_test
'empirical'

√{n}*abs(corr)

'fisher'

√{n-3}*1/2*\log( (1+corr)/(1-corr) )

'student'

√{n-2}*abs(corr)/√(1-corr^2)

'2nd.order'

√{n}*mean(Y)/sd(Y) with Y=(X_i-mean(X_i))(X_j-mean(X_j))

vect

if TRUE returns a vector of adjusted p-values, corresponding to vectorize(cor(data)); if FALSE, returns an array containing the adjusted p-values for each entry of the correlation matrix

logical

if TRUE, returns either a vector or a matrix where each element is equal to TRUE if the corresponding null hypothesis is rejected, and to FALSE if it is not rejected

arr.ind

if TRUE, returns the indexes of the significant correlations, with respect to level alpha

Value

Returns

References

Bonferroni, C. E. (1935). Il calcolo delle assicurazioni su gruppi di teste. Studi in onore del professore salvatore ortu carboni, 13-60.

Roux, M. (2018). Graph inference by multiple testing with application to Neuroimaging, Ph.D., Université Grenoble Alpes, France, https://tel.archives-ouvertes.fr/tel-01971574v1.

See Also

ApplyFwerCor, BonferroniCor_SD

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
n <- 100
p <- 10
corr_theo <- diag(1,p)
corr_theo[1,3] <- 0.5
corr_theo[3,1] <- 0.5
corr_theo <- diag(1,p)
data <- MASS::mvrnorm(n,rep(0,p),corr_theo)
# adjusted p-values
res <- BonferroniCor(data,stat_test='empirical')
round(res,2)
# significant correlations with level alpha:
alpha <- 0.05
whichCor(res<alpha)
# directly
BonferroniCor(data,alpha,stat_test='empirical',arr.ind=TRUE)

TestCor documentation built on Oct. 23, 2020, 5:31 p.m.