Hi everybody, 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 what I actually want) 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 se <- ((sum((eigen.i-estim)^2))/(R-1))^0.5 t.i <- estim/se } } Thanks for your consideration, Monica _________________________________________________________________
07 [[alternative HTML version deleted]]
______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.