[R] snow - bootstrapped correlation ranking

R. Michael Weylandt michael.weylandt at gmail.com
Fri Jan 20 07:23:13 CET 2012


This might be of help:
http://viksalgorithms.blogspot.com/2012/01/parallel-r-loops-for-windows-and-linux.html

Michael

On Thu, Jan 19, 2012 at 4:21 PM, Patrik Waldmann
<patrik.waldmann at boku.ac.at> wrote:
> I wonder if someone could help me adjusting the following code to parallelized snow code:
>
> #Creating a data set (not needed to be parallel)
> n<-100
> p<-100
> x<-matrix(rnorm(n*p),p)
> y<-rnorm(n)
> # Bootstrapping
> nboot<-1000
> alpha<-0.05
> rhoboot <- array(0, dim=c(p,nboot))
> bootranks <- array(0, dim=c(p,nboot))
> bootsamples <- array( floor(runif(n*nboot)*n+1), dim=c(n,nboot))
> for (i in 1:nboot){
> rhoboot[,i] <- cor(y[bootsamples[,i]],x[bootsamples[,i],])
> bootranks[,i] <- p+1rank(abs(rhoboot[,i]))
> }
> # Summarise results
> rankhigh = apply(bootranks, 1, quantile, probs=alpha/2)
> ranklow = apply(bootranks, 1, quantile, probs=1-alpha/2)
>
>
> Patrik Waldmann
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list