Displaying 2 results from an estimated 2 matches for "pvalues2".
Did you mean:
pvalues
2008 Nov 26
2
Very slow: using double apply and cor.test to compute correlation p.values for 2 matrices
My two matrices are roughly the sizes of m1 and m2. I tried using two apply and cor.test to compute the correlation p.values. More than an hour, and the codes are still running. Please help to make it more efficient.
m1 <- matrix(rnorm(100000), ncol=100)
m2 <- matrix(rnorm(10000000), ncol=100)
cor.pvalues <- apply(m1, 1, function(x) { apply(m2, 1, function(y) { cor.test(x,y)$p.value
2009 Mar 09
5
Help
...unction(x)
> cor.test(m1[,x[1]],m2[,x[2]])$p.value)->pvalues1)
> # user system elapsed
> # 8.12 0.01 8.20
>
> # ---------------
> # Option 2
> #----------------
> require(Hmisc)
> system.time(apply(combs,1,function(x)
> rcorr(m1[,x[1]],m2[,x[2]])$P[2])->pvalues2)
> # user system elapsed
> # 7.00 0.00 7.02
>
>
> HTH,
>
> Jorge
>
>
> # ------------- Session Info ----------------------------
> R version 2.8.0 Patched (2008-11-08 r46864)
> i386-pc-mingw32
>
> locale:
> LC_COLLATE=English_United States.12...