Info

此问题已关闭。 请重新打开它进行编辑或回答。

Cdsbootstrap error message

1 次查看(过去 30 天)
Luisa
Luisa 2011-11-16
关闭: MATLAB Answer Bot 2021-8-20
Hi guys, I have a problem with the following code:
settle = '24-Feb-2009'; [num text raw] = xlsread('Debt analysis','cds'); spread_time = num(:,1); spread = num(:,2:end); %10x4 matrix of cds market spreads in bps (maturities are 1, 2 ,3, 4, 5, 6, 7, 8, 9, 10 year but I don'have spreads for all the maturities for some reference entity; where I don't have data there's NaN) i=find(isnan(spread)); % I replace NaN with zeros spread(i)=ones(size(i)); market_dates = daysadd(datenum(settle),360*spread_time,1); marketdata = [market_dates spread]; [num2 text2 raw2] = xlsread('Debt analysis','rates'); zero_time = num2(5:end,1); zero_time(2) = []; zero_rate = num2(5:end,2); %11x1 vector of zero risk free rates (maturities are 1, 1.5, 2 ,3, 4, 5, 6, 7, 8, 9, 10 year) zero_rate(2) = []; %I eliminate 1.5 years rate that I don't need zero_dates = daysadd(datenum(settle),360*zero_time,1); zerodata = [zero_dates zero_rate]; probdata=zeros(size(marketdata)); hazdata=zeros(size(marketdata)); for i=2:size(marketdata,2) [probdata(:,[1 i]),hazdata(:,[1 i])] = cdsbootstrap(zerodata,marketdata(:,[1 i]),settle,'ZeroCompounding',-1); end
When I run it I got the following error message: Error using ==> fzero at 283 The function values at the interval endpoints must differ in sign.
Error in ==> cdsbootstrap at 305 bnew = fzero(errorFun,[0 1]);
I think the problem is due to the presence of zero as cds spread for some maturities. Is there a way to say the loop for not to perform cdsbootstrap function if one of the values in marketdata is equal to zero? Thank you in advance.
Luisa

回答(1 个)

abc123 shi
abc123 shi 2014-6-10
try to specify the basis option in the cdsbootstrap fun, had similar issues and this is the way I solved it. Hope it helps. Regards. (haha, just realized its 2011...long time ago)

此问题已关闭。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by