corrperm-package {corrperm}R Documentation

Permutation Tests of Correlation with Repeated Measurements

Description

Three permutation tests of correlation useful when there are repeated measurements

Details

Package: corrperm
Type: Package
Version: 1.0
Date: 2008-02-26
License: GPL-3

The function cp.test tests the null hypothesis of no correlation of two variables (x and y) that are measured in repeated independent experiments. Each experiment measures either x or y on the same fixed number of populations. Inference is based on permutation tests. Three different statistics are used in the tests, which are one-sided, and are computed at the same time.

In the absence of ties, the Spearman correlation, r, equals 1 - 6 sum d^2/(n^3 - n) where d is the difference in ranks for a x,y pair, n is the number of populations (x,y pairs) and the summation is over all d. Under the null hypothesis the variance of r is 1/(n-1). The tests are based on the combining the Spearman correlations or p-values for all possible combinations of x and y experiments.

The inverse-variance weighted average Spearman correlation is: S = sum (njk - 1) rjk/(m sum (njk - 1)), where m is the total number of combinations of x and y experiments, njk is the number of x,y pairs and rjk is the correlation for the jth x and the kth y experiment, and the summation is over all possible pairs.

The unweighted Fisher's combining function is: F = -2 sum ln(pjk) , where pjk is the p-value of the Spearman test for the jth x and the kth y experiment.

The weighted Fisher's combining function is: Fw = -2 sum (njk - 1)log(pjk)/sum (njk - 1).

Each experiment must sample the same populations, but the number of experiments measuring x and y can differ. Missing values are allowed.

Author(s)

Douglas M. Potter

Maintainer: Douglas M Potter <potter@upci.pitt.edu>

References

Potter, D.M. and Acilan C., Permutation Tests of Correlation for Data with Repeated Measurements, available from D. Potter via email.

Examples


##9 different populations on which 7 experiments 
##measure x and 5 measure y

npop<-9
nxexpt<-7
nyexpt<-5

##population effects

popeff<-rnorm(npop,0,.5)

x<-rnorm(nxexpt*npop)
y<-rnorm(nyexpt*npop)
x<-matrix(x,nrow=npop)
y<-matrix(y,nrow=npop)

for(i in 1:npop){
        for(j in 1:nxexpt){
                x[i,j]<-x[i,j]+popeff[i]
        }
        for(j in 1:nyexpt){
                y[i,j]<-y[i,j]+popeff[i]
        }
}

cp.test(x,y,100)


[Package corrperm version 1.0 Index]