Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Cdsbootstrap error message

1 visualización (últimos 30 días)
Luisa
Luisa el 16 de Nov. de 2011
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
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

Respuestas (1)

abc123 shi
abc123 shi el 10 de Jun. de 2014
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)

La pregunta está cerrada.

Community Treasure Hunt

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

Start Hunting!

Translated by