Displaying 1 result from an estimated 1 matches for "outperfomr".
2005 Apr 21
2
apply vs sapply vs loop - lm() call appl(y)ied on array
...The lm computation needs performance optimization, since in fact the
dimensions are much larger. I compared the following approaches:
using a for-loop. using apply, and using sapply. All of these require
roughly the same time of computation. I was astonished since I expected
at least sapply to outperfomr the for-loop.
Do you have me another solution, which is faster? many thanks
here is the code
## ------------------------------------------------------
t.length <- 5
d.dim <- c(t.length,7,8,9) # dimesions: time, x, y, z
Y <- array( rep(1:t.length, prod(d.dim)) + rnorm(prod(d.dim), 0, 0.1)...