[R] bootstrapping a matrix using boot package

Amit amitkumartiwary at gmail.com
Sat Jan 9 18:36:43 CET 2010


Dear All,
I am trying to bootstrap a large data matrix 'exp' of dimension
9275x898 using package 'boot'. I am trying to calculate correlation of
the obtained samples. I have done following so far:

>library(boot)
>load("ratio_exp.RData") #loading the data matrix
>dim(ratio_exp)
[1] 9275  898
>sample.cor=function(ratio_exp,d){return(cor(t(ratio_exp[d,])))} #function for obtaing correlation
>boot.exp=boot(ratio_exp,sample.cor,R=50)
Error in matrix(NA, sum(R), lt0) : too many elements specified

But when I reduced the no of replication that is 10 then I got following
>boot.exp=boot(ratio_exp,sample.cor,R=10)
> str(boot.exp$t)
 num [1:5, 1:86025625] 1 1 1 1 1 ...

In both the cases its not correct. So I am doing something wrong in
writing the function sample.cor. Please help!

regards
Amit



More information about the R-help mailing list