MATLAB: Do I receive unexpected results using the DISC2RATE function in Financial Derivatives Toolbox 4.0.2 (R2007a)

Financial Derivatives Toolbox

I would like to compute an interest rate from a discount rate using continuous compounding. I execute the following code:
r=disc2rate(-1, 0.851746813, 734489, 733040)
to compute the annual interest rate using starting and ending dates of Dec-29-2006 and Dec-17-2010. I would expect to obtain an interest rate slightly above 4%. However, I receive the following result:
r =
1.1074e-004
What am I doiing wrong?

Best Answer

This is because you do not enter any valuation date input argument. Without a valuation date the input arguments 734489, 733040 are not treated as date strings but as periodic units.
Using Componding =365 (daily) and Compounding=-1 (continuous) leads to similar results. This is the case if you use a valuation date (assumed equal to the start date).
When I execute the following:
r=disc2rate(365, 0.851746813, 734489, 733040,733040)
I receive:
r =
4.0423e-002
When I execute the following:
r=disc2rate(-1, 0.851746813, 734489, 733040,733040)
I receive:
r =
4.0450e-002
Both values are near 4%.
However, if I do not specify a valuation date, the result I receive is completely different:
r=disc2rate(-1, 0.851746813, 734489, 733040)
r =
1.1074e-004
Entering a ValuationDate invokes the date interpretation; omitting a valuationDate invokes the default time interpretations.