# getAmoment: Four moments of Pearson correlation under permutation given... In mcc: Moment Corrected Correlation

## 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

 1 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 A=∑_{k}^K ∑_i(x_{ik} y_{π[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(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.

getAkmoment.
  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 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=cutpoint[k] & 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]