| 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 |
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 or smaller.
| 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.
Yi-Hui Zhou
Maintainer: Yi-Hui Zhou <[email protected]>
Yi-Hui Zhou, Fred Wright, 2013, Fast And Robust Association Testing For High-Throughput Testing, Submitted.
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.
getAkmoment(x,y)getAkmoment(x,y)
x |
matrix (m x n)format. |
y |
clinical/experimental n-vector. |
Generates the first 4 moments of pearson correlation under permutation of . These steps are performed simultaneously for all m features.
Yi-Hui Zhou: [email protected]
Yi-Hui Zhou, Fred Wright, 2013, Fast And Robust Association Testing For High-Throughput Testing, Submitted.
See also the vignette included with this package.
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]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]
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.
getAmoment(x,y,z=NULL)getAmoment(x,y,z=NULL)
x |
matrix (m |
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 |
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 . The actual x and y objects are mxn matrices, so getAkmoment computes the results simultaneously for all m features.
Yi-Hui Zhou: [email protected]
Yi-Hui Zhou, Fred Wright, 2013, Fast And Robust Association Testing For High-Throughput Testing, Submitted.
See also the vignette included with this package.
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]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]
Computes association statistics, the first four moments of the trend statistic A under permutation, and p-values based on the Beta density approximation.
getbetap.A(getAmoment.list,A=NULL,fix.obs=F)getbetap.A(getAmoment.list,A=NULL,fix.obs=F)
getAmoment.list |
A list which contains all the items generated by getAmoment function. |
A |
The vector A is composed of elements |
fix.obs |
this option itentifies and improves the p-values using for |
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.
The function returns an object of class mcc.
Yi-Hui Zhou: [email protected]
Yi-Hui Zhou, Fred Wright, 2013, Fast And Robust Association Testing For High-Throughput Testing, Submitted.
See also the vignette included with this package.
getAmoment, getAkmoment, getbetap.A.2.
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"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"
Perform by successively considering each of the n samples as a potential outlier. Otherwise the syntax and output are the same as getbetap.A.
getbetap.A.2(x,y,z=NULL)getbetap.A.2(x,y,z=NULL)
x |
matrix (m |
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 |
Yi-Hui Zhou: [email protected]
Yi-Hui Zhou, Fred Wright, 2013, Fast And Robust Association Testing For High-Throughput Testing, Submitted.
See also the vignette included with this package.