[R] more efficient double summation...

kathie kathryn.lord2000 at gmail.com
Fri Aug 29 06:48:14 CEST 2008


Dear R users...

I made the R-code for this double summation computation


http://www.nabble.com/file/p19213599/doublesum.jpg 

-------------------------------------------------
Here is my code..


sum(sapply(1:m, function(k){sum(sapply(1:m,
function(j){x[k]*x[j]*dnorm((mu[j]+mu[k])/sqrt(sig[k]+sig[j]))/sqrt(sig[k]+sig[j])}))}))


-------------------------------------------------

In fact, this is a part of optimization. I think if it is changed more
efficiently, then the running time could be shortened.

How could I change this more efficiently? Any suggestion will be greatly
appreciated.

Kathryn Lord
-- 
View this message in context: http://www.nabble.com/more-efficient-double-summation...-tp19213599p19213599.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list