[R] writing statistical function for boot

Monica Pisica
Mon, 26 Nov 2007 18:57:39 -0000

Hi everyone,

I need help in writing a statistical function for bootstrap. Suppose m is a
matrix with n cols and p rows, my original data. What I want to do is a
bootstrap (using boot from package boot) on eigenvectors from a PCA done on m
with a statistic function calculating the eigenvector bootstrap error ratio.

If R = number of bootstrap replicates, then my function should look something
like this where m.i is the ith bootstrap sample matrix (of course this is wrong,
but I wrote it to give an idea of what I am after)

pcasig <- function(m) {
for (i in 1:R) {
pca.i <- prcomp(m.i)
eigen.i <- pca.i$rotation
estim <- sum(eigen.1+….+eigen.R) / R
a <- matrix(estim, p, n)
se <- ((sum((eigen.i-estim)^2))/(R-1))^0.5
t.i <- a / se }
}

Thanks for your consideration,

Monica
_________________________________________________________________
Your smile counts. The more smiles you share, the more we donate.  Join in.
www.windowslive.com/smile?ocid=TXT_TAGLM_Wave2_oprsmilewlhmtagline
	[[alternative HTML version deleted]]