Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: Internal rate of return calculation in Mata
From
Austin Nichols <[email protected]>
To
[email protected]
Subject
Re: st: Internal rate of return calculation in Mata
Date
Wed, 23 May 2012 10:43:27 -0400
Tanja Berg <[email protected]>
Google finds similar questions in Statalist past, e.g.
http://www.stata.com/statalist/archive/2010-04/msg01113.html
On Wed, May 23, 2012 at 6:09 AM, Tanja Berg <[email protected]> wrote:
> Hi,
>
> I really need your help again!
> I want to calculate spreads for bonds in Stata.
>
> Now I want to calculate the spread for each bond and each observation, which is defined by the following formula:
>
> Price=(Cashflow1/(1+Spot1+spread)^Maturity1) + (Cashflow2/(1+Spot2+spread)^Maturity2) + ...... + (Cashflow16/(1+Spot16+spread)^Maturity16)
>
> How can I find the spread which minimizes the error in this calculation??
>
> I think I have to solve this by using Mata and the mm_root function?! But I am not exactly sure how to do this.
>
> I understood that I first have to start Mata in Stata. But how do I get all the data I need into Mata? Over the putmata command?
> And then, how do I define the vectors?
>
> I have really no clue about the syntax to solve this problem.
>
> I hope someone can help!
>
> Thanks!!
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/