Re: [R] efficient code - yet another question

2008-09-29 Thread Kevin Wright
You should also have a look at the pcaMethods package (on Bioconductor). I did some code optimization for the NIPALS algorithm in that package which sped up the algorithm by at least a factor of two. Kevin Wright On Wed, Apr 30, 2008 at 10:56 PM, steven wilson <[EMAIL PROTECTED]> wrote: > Dear

Re: [R] efficient code - yet another question

2008-05-01 Thread Richard . Cotton
> I've been trying to find a way to improve (if > possible) the efficiency of the code, especially when the number of > components to calculate is higher than 100. > pca.nipals <- function(X, ncomp, iter = 50, toler = sqrt(.Machine$double.eps)) > # X...data matrix, ncomp...number of components, >

Re: [R] efficient code - yet another question

2008-05-01 Thread Prof Brian Ripley
Some comments 1) 'Writing R Extensions' has a chapter about looking into bottlenecks ('profiling'). Had you given a working example, I might have shown you some results. One thing which is clearly suboptimal is to grow components (in your case by cbind) rather than allocate them initially an

[R] efficient code - yet another question

2008-04-30 Thread steven wilson
Dear list members; The code given below corresponds to the PCA-NIPALS (principal component analysis) algorithm adapted from the nipals function in the package chemometrics. The reason for using NIPALS instead of SVD is the ability of this algorithm to handle missing values, but that's a different