[R] Problem with Newton_Raphson

Berend Hasselman bhh at xs4all.nl
Thu Sep 20 16:18:27 CEST 2012


On 20-09-2012, at 16:06, Berend Hasselman wrote:

> 
> On 20-09-2012, at 15:17, Christopher Kelvin wrote:
> 
> .....
> A final remark on function z:
> 
> - do not calculate things like n*sum(s) repeatedly: doing something like A<-n*sum(s) and reusing A is more efficient.
> - same thing for log((exp(-(scale)*sum(x)))) (recalculated four times)
> - same thing for sum(x)
> 

Oops!
No not four times. Twice.
But (exp(-(scale)*sum(x))) is calculated three times.

Berend




More information about the R-help mailing list