Re: [R] Yield to Maturity using R

2010-02-02 Thread Madhavi Bhave
same, I get following error.   Error: object 'ytm' not found My objective is to find ytm itself and I am not able to figure out where I am going wrong and how to overcome the same.   Regards   Madhavi --- On Tue, 2/2/10, Dennis Murphy wrote: From: Dennis Murphy Subject: Re: [R

Re: [R] Yield to Maturity using R

2010-02-02 Thread Eik Vettorazzi
Hi Madhavi, the error message means, that your function returns NA evaluated at the lower limit of the search interval. try f.ytm(0) to check that. I think, for (i in 1 : (tenure * no_comp - 1)) E = NULL F = NULL { E[i] = cash_flow[i]/(1+ytm)^i F = (sum(E) + (face_value + coupon_payment)/((1+y

[R] Yield to Maturity using R

2010-02-02 Thread Madhavi Bhave
Dear R helpers,     Yesterday I had raised following query which was addressed by Mr Ellison. The query and the wonderful solution as provided by Mr. Ellison are as given below.    ## PROBLEM   I am calculating the 'Yield to Maturity' for the Bond with following characteristics.    Its a $1000