[R] simpleboot, pairs.boot

Rebecca Young rlyoung at email.arizona.edu
Wed Sep 1 03:27:33 CEST 2004


Hi.

I am a new R user trying to obtain bootstrap confidence intervals around vector
correlations of Principal components.

My data is a data frame of eigenvector loadings from PC1 in the columns the rows
are different species.  I want to calculated the vector correlation and
bootstrap confidence intervals for all species pairs.

I have tried using simpleboot as pairs.boot seems to be an easy way of sampling
from two vectors of data.  The function I wrote "veccor" below works outside of
the pairs.boot function.  However in this function it seems to calculate all
1000 vector correlations as -1.

########
veccor
function(x,y) ((sum((x)*(y)))/((sqrt(sum(y^2)))*(sqrt(sum(x^2)))))
x<-as.vector(faVC[1,])
y<-as.vector(faVC[2,])
boot<-pairs.boot(x,y,veccor,1000)
#########

I have also tried using the boot function but only end up sampling from on of my
vectors of data.

Any suggestions would be greatly appriciated!  Thanks!

Best, Becca




More information about the R-help mailing list