Diff for "FAQ/permy" - CBU statistics Wiki
location: Diff for "FAQ/permy"
Differences between revisions 8 and 9
Revision 8 as of 2013-01-07 13:34:45
Size: 193
Editor: PeterWatson
Comment:
Revision 9 as of 2013-01-07 13:36:30
Size: 491
Editor: PeterWatson
Comment:
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:

The permutation test recommended for testing if a correlation is zero can be used in R

Suppose we have two columns of data

a <- c(1,2,3)
b <- c(3,6,5)

the the two-sided p-value for testing of the a,b Pearson correlation equals zero is outputted using pout (assuming 1000 simulations).

Permutation test in R for a bivariate Pearson correlation

The permutation test recommended for testing if a correlation is zero can be used in R

Suppose we have two columns of data

a <- c(1,2,3) b <- c(3,6,5)

the the two-sided p-value for testing of the a,b Pearson correlation equals zero is outputted using pout (assuming 1000 simulations).

robs <- cor(a,b)
repout <- replicate(1000,cor(a,sample(b)))
rout<-(abs(repout)>robs)
pout<-sum(rout=="TRUE")/1000

None: FAQ/permy (last edited 2013-03-08 10:17:25 by localhost)