Package 'mcc'

Title: Moment Corrected Correlation
Description: A number of biomedical problems involve performing many hypothesis tests, with an attendant need to apply stringent thresholds. Often the data take the form of a series of predictor vectors, each of which must be compared with a single response vector, perhaps with nuisance covariates. Parametric tests of association are often used, but can result in inaccurate type I error at the extreme thresholds, even for large sample sizes. Furthermore, standard two-sided testing can reduce power compared to the doubled p-value, due to asymmetry in the null distribution. Exact (permutation) testing approaches are attractive, but can be computationally intensive and cumbersome. MCC is an approximation to exact association testing of two vectors that is accurate and fast enough for standard use in high-throughput settings, and can easily provide standard two-sided or doubled p-values. Compatibility updates by Renova.
Authors: Yi-Hui Zhou
Maintainer: Yi-Hui Zhou<[email protected]>
License: GPL (>= 2)
Version: 1.0.9001
Built: 2026-11-13 17:47:19 UTC
Source: https://github.com/renova-r/mcc

Help Index


Moment Correction Correlation

Description

MCC is a method which can measure association between rows of a matrix with a single response vector. The method uses a parametric approximation to permutation of the correlation coefficient. It is very accurate, often to p-values of 10−810^{-8} or smaller.

Details

Package: MCC
Type: Package
Version: 1.0
Date: 2014-04-27
License: GPL (>= 2)

Please prepare a matrix format of the data, with each row representing the feature and each column for each sample. Please also prepare the clinical response/phenotype in a vector format.

Author(s)

Yi-Hui Zhou

Maintainer: Yi-Hui Zhou <[email protected]>

References

Yi-Hui Zhou, Fred Wright, 2013, Fast And Robust Association Testing For High-Throughput Testing, Submitted.


Four moments of Pearson correlation under permutation

Description

The Pearson Correlation Coefficient can be derived by the correlation of scared feature matrix and clinical response. This function provides the first four moments under permutation of the scaled pearson correlation coefficient. In order to simplify the computation of moments summed over strata, an internal offset is applied to center each stratum levels.

Usage

getAkmoment(x,y)

Arguments

x

matrix (m x n)format.

y

clinical/experimental n-vector.

Details

Generates the first 4 moments of pearson correlation under permutation of Ak=∑i∈IkxiyiA_k=\sum_{i\in I_k} x_i y_i. These steps are performed simultaneously for all m features.

Author(s)

Yi-Hui Zhou: [email protected]

References

Yi-Hui Zhou, Fred Wright, 2013, Fast And Robust Association Testing For High-Throughput Testing, Submitted.

See also the vignette included with this package.

See Also

getAmoment.

Examples

set.seed(1)
## simulate a data matrix with 300 rows and 30 columns
m=300
n=30
## assume x is a gene expression matrix with 300 genes, 30 samples
x=matrix(rnorm(m*n),m,n)
## y is the clinical response (continuous)
y=rnorm(n)
out=getAkmoment(x,y)
names(out)
out$final2[1:10]   ## the second moments for the first 10 genes

## y can also be dichotomuous 
y=c(rep(1,15),rep(2,15))
out.dia=getAkmoment(x,y)
out.dia$final4[1:10]

Four moments of Pearson correlation under permutation given covariates

Description

The Pearson Correlation Coefficient can be derived by the correlation of scared feature matrix and clinical response. This function provides the first four moments under permutation of the scaled pearson correlation coefficient. Different from function getAkmoment, this function can handle covariate. For convenience in later functions, both central and noncentral moments are outputted.

Usage

getAmoment(x,y,z=NULL)

Arguments

x

matrix (m ×\times n) of predictors.

y

clinical/experimental n-vector.

z

covariate n-vector, assumed discrete with at least two observations per value of z. If z is not provided, the function assumes no covariates. Generates the first 4 moments of pearson correlation under permutation of AA=∑kK\sum_{k}^K ∑i(xik\sum_i(x_{ik}yπ[i]k)y_{\pi[i]k}), given K covariate classes defined by z. getAkmoment provides the results for the samples in stratum k.

Details

Genertate the first moments of pearson correlation under permutation if we are given the covariate z. In practice, we first divide into K strata, getAkmoment actually provides the results for the samples in stratum k. getAmoment uses covariate z to know which sample belong to the kth stratum, and obtains the 4 moments for each of the K strata (using getAkmoment), and finally computes the 4 moments for A=∑k(Ak)A=\sum_k(A_k). The actual x and y objects are mxn matrices, so getAkmoment computes the results simultaneously for all m features.

Author(s)

Yi-Hui Zhou: [email protected]

References

Yi-Hui Zhou, Fred Wright, 2013, Fast And Robust Association Testing For High-Throughput Testing, Submitted.

See also the vignette included with this package.

See Also

getAkmoment.

Examples

set.seed(1)
######################################################################
## simulate a data matrix with 300 rows and 30 columns              ##
## assume x is a gene expression matrix with 300 genes, 30 samples  ##
## y is the clinical response (continuous)                          ##
######################################################################
m=300
n=30
x=matrix(rnorm(m*n),m,n)
y=rnorm(n)
out=getAmoment(x,y)
names(out)
out$EA2[1:10]   ## the second moments of A=sum(x*(centered phenotype)) 
		            ## under permutation for the the first 10 genes

## y can also be dichotomuous 
y=c(rep(1,15),rep(2,15))
out.dia=getAmoment(x,y)
length(out.dia$EA4)

## z is covariate. It can either be continuous or dichotomous 
## if z is dichotomous
z=c(rep(1,25),rep(2,5))
out.cov=getAmoment(x,y,z)
out.cov$EA2

## if z is continuous, then we need to splict z into K strata
## for example, suppose I sign K=4 strata for z
K=4
z=rexp(n)
cutpoint=as.vector(quantile(z, seq(0,1,b=1/K)))
newz=rep(0,n)
for (k in (1:K)){
	if (k<K) which.group=which((z>=cutpoint[k] & z<cutpoint[k+1])==TRUE)
	if (k==K) which.group=which((z>=cutpoint[k] & z<=cutpoint[k+1])==TRUE)
	newz[which.group]=k
}
out.cov.con=getAmoment(x,y,newz)
out.cov.con$EA3[1:5]

Momoent Corrected Correlation

Description

Computes association statistics, the first four moments of the trend statistic A under permutation, and p-values based on the Beta density approximation.

Usage

getbetap.A(getAmoment.list,A=NULL,fix.obs=F)

Arguments

getAmoment.list

A list which contains all the items generated by getAmoment function.

A

The vector A is composed of elements Ai=∑jxijyjA_i=\sum_j x_{ij} y_j. In other words, each AiA_i is the observed statistic of interest. getbetap.A also allows the user to input the A vector directly. This is useful mainly for debugging purposes, or for obtainting approximate p-values across a grid of hypothetical A values.

fix.obs

this option itentifies and improves the p-values using for MCC1MCC_1 features with implausibily small MCCMCC p-values.

Details

mcc utilizes a general framework for testing the association between features and clinical variables. It simultaneously performs up to millions of tests by using simple parametric approximations applied to exact permutation moments.

Value

The function returns an object of class mcc.

Author(s)

Yi-Hui Zhou: [email protected]

References

Yi-Hui Zhou, Fred Wright, 2013, Fast And Robust Association Testing For High-Throughput Testing, Submitted.

See also the vignette included with this package.

See Also

getAmoment, getAkmoment, getbetap.A.2.

Examples

set.seed(1)
m=300
n=30
x=matrix(rnorm(m*n),m,n)
y=c(rep(1,15),rep(2,15))
z=c(rep(1,25),rep(2,5))
output=getbetap.A(getAmoment(x,y,z),A=NULL,fix.obs=FALSE)
#names(output)
#[1] "twosidedp"    "rightp"       "leftp"        "pdouble"      "chebyshev.p" 
#[6] "pt"           "lowest.alpha"

Momoent Corrected Correlation One

Description

Perform MCC1MCC_1 by successively considering each of the n samples as a potential outlier. Otherwise the syntax and output are the same as getbetap.A.

Usage

getbetap.A.2(x,y,z=NULL)

Arguments

x

matrix (m ×\times n) of predictors.

y

clinical/experimental n-vector.

z

covariate n-vector, assumed discrete with at least two observations per value of z. If z is not provided, the function assumes no covariates. Generates the first 4 moments of pearson correlation under permutation of AA=∑kK\sum_{k}^K ∑i(xik\sum_i(x_{ik}yπ[i]k)y_{\pi[i]k}), given K covariate classes defined by z. getAkmoment provides the results for the samples in stratum k.

Author(s)

Yi-Hui Zhou: [email protected]

References

Yi-Hui Zhou, Fred Wright, 2013, Fast And Robust Association Testing For High-Throughput Testing, Submitted.

See also the vignette included with this package.

See Also

getbetap.A.