Skip to content
Prev 12757 / 29559 Next

joining envelope objects for parallel computing. Possible?

On 12/09/11 21:03, Quets Jan wrote:
See fortune("This is R")

     You could do it, I think, at the expense of writing a bit of additional
     code.  Something along the following lines:

     * For each of your calls to envelope, use the argument savefuns=TRUE.
     * From each of the ENV_OBJ_j, extract the "simfuns" attribute.
     * Change the class of each extracted "simfuns" attribute to 
"data.frame"
        (from c("fv","data.frame")), discard the "r" columns, and then cbind
        them all together; make the result into a *matrix* rather than a
        data frame.  Call it, say, "M".
     * apply the appropriate function across the rows of M, to obtain "lo"
        and "hi"; e.g.

             LH <- t(apply(M,1,function(x,m){x <- sort(x);  
c(x[m],x[length(x)-m+1])},m=5))

        The value "m=5" corresponds to setting "nrank=5" in a ``direct'' 
call to
        envelope().  The first column of LH is "lo"; the second is "hi".

     * These vectors, "lo" and "hi" are then the lower and upper bounds
        respectively of the required envelope.

     The foregoing can be wrapped up in a convenient function.
     Exercise for the reader! :-)

     HTH

         cheers,

             Rolf

P. S.  Not clear to me that this is worth doing; the time consuming part 
is the
simulation of the patterns, which you've already got in the 
"sim_pat_list".  Once
you have the patterns, calculating the summary functions is usually very 
fast,
and hence not worth parallelizing. Unless you have an extraordinarily 
complicated
setting.

             R.