search for: matutils

Displaying 3 results from an estimated 3 matches for "matutils".

Did you mean: mathutils
2002 Jan 07
0
New package: colSums
...fast arithmetic on columns/rows of a matrix, or more generally across dimensions of an array, e.g. colSums(m) = apply(m, 2, sum) but faster. They should be compatible with the corresponding S-Plus functions. The core code was written by Doug Bates <bates at stat.wisc.edu>, as package "MatUtils", and posted to R-help on July 19, 2001. Many thanks to Doug, Peter Dalgaard <p.dalgaard at biostat.ku.dk>, Thomas Lumley <tlumley at u.washington.edu>, and Prof Brian Ripley <ripley at stats.ox.ac.uk> for their assistance; see the R-help thread "colSums in C". -...
2001 Dec 14
2
colSums in C
Hi, all! My project today is to write a speedy colSums(), which is a function available in S-Plus to add the columns of a matrix. Here are 4 ways to do it, with the time it took (elapsed, best of 3 trials) in both R and S-Plus: m <- matrix(1, 400, 40000) x1 <- apply(m, 2, sum) ## R=16.55 S=52.39 x2 <- as.vector(rep(1,nrow(m)) %*% m) ## R= 2.39 S= 8.52 x3 <-
2002 Aug 14
3
t-test via matrix operations
I need to calculate a large number of t statistics, and would like to do so via matrix operations. So far I have figured out a way to calculate the mean of each row of the matrix: d <- matrix(runif(100000,1,10), 1000, 10) # some test data s <- rep(1,ncol(d)) # a sum vector to use for matrix multiplication means <- (d%*%s)/ncol(d) This is at least 1 order of magnitude faster than