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