search for: hcvx

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

Did you mean: hctx
2006 May 08
2
On the speed of apply and alternatives?
...)*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 than q_i ret[i] <- ifelse(real < q_i, 1, 0) ret[length(qnt)+i] <- ifelse(real < q_i, real - m_i, 0) } ret } hcvx <- apply(testm, 1, cmp_fun) The code is functioning well, but seems to take forever to calculate the statistics matrix. As I have to repeat this snippet 2000 times, I have a problem. Can anyone advise as to how I can optimize the runtime of this problem? Should i drop the apply function altoge...