search for: cmp_fun

Displaying 1 result from an estimated 1 matches for "cmp_fun".

Did you mean: cmp_func
2006 May 08
2
On the speed of apply and alternatives?
..., I have to handle a large matrix (1000 x 10001) where in the last column i have a value that all the preceding values in the same row has to be compared to. I have made the following code : # generate a (1000 x 10001) matrix, testm # generate statistics matrix 1000 x 4: qnt <- c(0.01, 0.05) cmp_fun <- function(x) { LAST <- length(x) smpls <- x[1:(LAST-1)] real <- x[LAST] ret <- vector(length=length(qnt)*2) for (i in 1:length(qnt)) { q_i <- quantile(smpls, qnt[i]) # the quantile i m_i <- mean(smpls[smpls<q_i ] ) # mean of obs less...