# [R-sig-hpc] (no subject)

Ramon Diaz-Uriarte rdiaz02 at gmail.com
Thu Dec 31 01:57:34 CET 2009

```Dear Erin,

Have you used one of the random number generators for parallel
computing, such as in

library(rlecuyer)

or

library(rsprng)

Best,

R.

On Thu, Dec 31, 2009 at 1:52 AM, Hodgess, Erin <HodgessE at uhd.edu> wrote:
> Dear R HPC People:
>
> First of all, Happy New Year.
>
> I'm back to working with a simulation study.  It works fine on a regular machine:
>
> Here is the code:
> agg1 <- function(phi1=0.5) {
>        y <- arima.sim(list(order=c(1,0,0),ar=phi1),360)
>        xg <- numeric(length=120)
>        xa <- seq(from=1,by=3,length=120)
>        xb <- seq(from=3,by=3,length=120)
>        for(ik in 1:120) {
>                xg[ik] <- mean(y[xa[ik]:xb[ik]])
>        }
>
>        check1 <- try(arima(xg,order=c(1,0,0)),silent=TRUE)
>        check2 <- arima(xg,order=c(1,0,1))
>        zz <- c(arp=check1\$model\$phi,arsig=check1\$sigma2,
>           armap=check2\$model\$phi,
>                armam=check2\$model\$theta,armas=check2\$sigma2)
>        return(zz)
> }
>
> Here is the driver
> aggsim <- function(phi1=0.5,n2=10) {
>        w <- matrix(0,nrow=n2,ncol=5)
>        for(ii in 1:n2) {
>                w[ii,] <- agg1(phi1)
>        }
>        ww <- matrix(0,nrow=2,ncol=5)
>        ww[1,] <- apply(w,2,mean)
>        ww[2,] <- apply(w,2,function(x)sd(x)/sqrt(n2))
>        return(ww)
> }
>
> I am sure that I can do better by using Rmpi or something similar.  I've tried all kinds of variations on the theme with Rmpi, but keep getting "duplicates"; that is, instead of all distinct values, I get duplicates of the number of nodes.
>
> Thank you for any help.
>
> Sincerely,
> Erin
>
>
> Erin M. Hodgess, PhD
> Associate Professor
> Department of Computer and Mathematical Sciences
> University of Houston - Downtown
> mailto: hodgesse at uhd.edu
>
>
>        [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-hpc mailing list
> R-sig-hpc at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-hpc
>

--
Ramon Diaz-Uriarte
Structural Biology and Biocomputing Programme
Spanish National Cancer Centre (CNIO)
http://ligarto.org/rdiaz
Phone: +34-91-732-8000 ext. 3019

```