This input series works perfectly
Bond.Valuation (bond.id = bondlab10, principal = 1000, price = 100,
settlement.date = "02-4-2013", trade.date = "1-31-2013")
This throws an error
Bond.Valuation (bond.id = bondlab10, principal = 1000, price = 100,
settlement.date = "01-5-2013", trade.date = "12-31-2012")
#Error in Key.Rate.Table[x, 3] = (spotrates("ns", BetaVector, m = Key.Rate.Table[x,
: replacement has length zero.
I am trying to use debug tools to step through the code but I am not having much luck. I get the following when I debug
debug at <tmp>#29: Bond.Term.Structure <<- Key.Rate.Analysis(bond.id = bondlab10,
Rate.Delta = Rate.Delta, BetaVector = BetaVector, principal = principal,
price = price, cashflow = Bond.CashFlow)
I know the function and the line but I have no idea what is wrong from the messages. Advise on debugging is appreciated. Basically, I have a long settlement here but this will be required for mortgage backed securities.
-Update, I found the problem but not from the debugger. Is there a way to watch R step through each calculation and see values?