[R] newton-raphson

dlavecchia@tiscali.it dlavecchia at tiscali.it
Wed Nov 30 17:08:47 CET 2005


Hi everybody,
I have to solve a score function by using Newton-Raphson algorithm. Is there
such a fucntion in R? I have built this algoritm

newton<-function(tgt,drva,th0,err) {
iter=0
repeat  {iter = iter+1
th1=th0-tgt(th0)/drva(th0)
if (abs(th0-th1)<err||abs(tgt(th1))<.1e-10)
break
th0=th1}
th1
}

but it does not work for my function because the ratio "tgt(th0)/drva(th0)"
is very high and the algoritm does not converge. On the contrary it works
very well for some simple functions (like X^2, X^3..and so on)
Please, can you help me?

Thanks in advance,
Davide   



__________________________________________________________________
TISCALI ADSL
Solo con Tiscali Adsl navighi senza limiti e telefoni senza canone 
Telecom a partire da 19,95 Euro/mese.
Attivala subito, I PRIMI DUE MESI SONO GRATIS! CLICCA QUI:
http://abbonati.tiscali.it/adsl/sa/1e25flat_tc/




More information about the R-help mailing list