Be sure to check $estim.prec and use the parameter tol as needed.

Best regards,
Craig



Madhavi Bhave wrote:
Dear Sir,
That was GREAT!!!. Thanks a lot for the solution. Once again it showed how powerful 'R' is otherwise I was breaking my head on Newton-Raphson method. Thanks again Sir. That was really superb. Madhavi

--- On Mon, 1/2/10, S Ellison <s.elli...@lgc.co.uk> wrote:


From: S Ellison <s.elli...@lgc.co.uk>
Subject: Re: [R] 'R' and 'Yield to Maturity'
To: "Craig P. Pyrame" <crap...@gmail.com>, "Madhavi Bhave" 
<madhavi_bh...@yahoo.com>
Cc: r-help@r-project.org
Date: Monday, 1 February, 2010, 3:41 AM


If you know the likely range, uniroot would do it.

f.ytm<-function(ytm) 100 / (1+ytm)  +100 / ((1+ytm)^2) + 1100 / ((1 +
ytm)^3) -1010

uniroot(f.ytm, interval=c(0,25))
#$root has the answer




______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to