Survival Probability

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Survival Probability

animesh
Minor doubt in defaultdensitystructure.cpp

In the function
 Probability DefaultDensityStructure::survivalProbabilityImpl(Time t)
const {
        static GaussChebyshevIntegration integral(48);
        // this stores the address of the method to integrate (so that
        // we don't have to insert its full expression inside the
        // integral below--it's long enough already)
        Real (DefaultDensityStructure::*f)(Time) const =
            &DefaultDensityStructure::defaultDensityImpl;
        // the Gauss-Chebyshev quadratures integrate over [-1,1],
        // hence the remapping (and the Jacobian term t/2)
        Probability P = 1.0 - integral(remap(bind(f,this,_1), t)) * t/2.0;
        //QL_ENSURE(P >= 0.0, "negative survival probability");
        return std::max<Real>(P, 0.0);
    }

The following code is present. If lambda is constant then survival
probability is exp(-lambda * t)
If not then we integrate to find lambda over [0,t] and it becomes
exp(Integral over [0,t] lambda dt)

In the code it looks like it is calculating default probability which is
1 - P or 1 - Survival Probability.
Maybe my understanding is wrong. Can someone explain?


        Probability P = 1.0 - integral(remap(bind(f,this,_1), t)) * t/2.0;


------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: Survival Probability

japari
Hi,
DefaultDensityStructure does not rely on a hazard rate model to compute the probabilities. You might well have other ways to compute them. Dont be confused by the methods in the parent class, you can still compute the rates. But see that
DefaultDensityStructure::defaultDensityImpl
does need to be making any reference to a HR model. Its more 'abstract' conceptually

The more specialized class and method:
HazardRateStructure::survivalProbabilityImpl
is what you have in mind.

Hope it helps.
Pepe


----- Mail Original -----
De: "animesh saxena" <[hidden email]>
À: [hidden email]
Envoyé: Samedi 10 Juillet 2010 17h06:02 GMT -08:00 Tijuana / Baja California
Objet: [Quantlib-dev] Survival Probability

Minor doubt in defaultdensitystructure.cpp

In the function
 Probability DefaultDensityStructure::survivalProbabilityImpl(Time t)
const {
        static GaussChebyshevIntegration integral(48);
        // this stores the address of the method to integrate (so that
        // we don't have to insert its full expression inside the
        // integral below--it's long enough already)
        Real (DefaultDensityStructure::*f)(Time) const =
            &DefaultDensityStructure::defaultDensityImpl;
        // the Gauss-Chebyshev quadratures integrate over [-1,1],
        // hence the remapping (and the Jacobian term t/2)
        Probability P = 1.0 - integral(remap(bind(f,this,_1), t)) * t/2.0;
        //QL_ENSURE(P >= 0.0, "negative survival probability");
        return std::max<Real>(P, 0.0);
    }

The following code is present. If lambda is constant then survival
probability is exp(-lambda * t)
If not then we integrate to find lambda over [0,t] and it becomes
exp(Integral over [0,t] lambda dt)

In the code it looks like it is calculating default probability which is
1 - P or 1 - Survival Probability.
Maybe my understanding is wrong. Can someone explain?


        Probability P = 1.0 - integral(remap(bind(f,this,_1), t)) * t/2.0;


------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: Survival Probability

animesh
  Pepe,
      Thanks for your mail. I located the class and could understand the
implementation a bit. Another issue is I tried running the CDS example
in quantlib reference. It gave following output.

hazard rate on May 15th, 2007 is 0.0299689
hazard rate on September 20th, 2007 is 0.0299689
hazard rate on December 20th, 2007 is 0.0299613
hazard rate on June 20th, 2008 is 0.0299619
hazard rate on June 22nd, 2009 is 0.0299607

Some survival probability values:
1Y survival probability: 97.040061 %
                expected: 97.040000 %
2Y survival probability: 94.175780 %
                expected: 94.180000 %


I am assuming it is calculating implied survival probabilities based on
Credit Spreads of 150bps, taken in the example. Assuming recover rate of
50%, and using the standard bootstrapping approach. As per bootstrapping
default leg = coupon leg.

So I am getting these values for year 1 and 2.

97.060795%
For year 2, 94.2338%
Attaching excel sheet for simple calculations done for CDS.

 From these values it's easy to back out hazard rate using S(t) =
exp^(-lambda * t) = 97.060795, where lambda is hazard rate. For first
case it's 2.98326%

Thanks

Animesh Saxena

(http://quantanalysis.wordpress.com)


On 7/11/10 3:28 PM, [hidden email] wrote:

> Hi,
> DefaultDensityStructure does not rely on a hazard rate model to compute the probabilities. You might well have other ways to compute them. Dont be confused by the methods in the parent class, you can still compute the rates. But see that
> DefaultDensityStructure::defaultDensityImpl
> does need to be making any reference to a HR model. Its more 'abstract' conceptually
>
> The more specialized class and method:
> HazardRateStructure::survivalProbabilityImpl
> is what you have in mind.
>
> Hope it helps.
> Pepe
>
>
> ----- Mail Original -----
> De: "animesh saxena"<[hidden email]>
> À: [hidden email]
> Envoyé: Samedi 10 Juillet 2010 17h06:02 GMT -08:00 Tijuana / Baja California
> Objet: [Quantlib-dev] Survival Probability
>
> Minor doubt in defaultdensitystructure.cpp
>
> In the function
>   Probability DefaultDensityStructure::survivalProbabilityImpl(Time t)
> const {
>          static GaussChebyshevIntegration integral(48);
>          // this stores the address of the method to integrate (so that
>          // we don't have to insert its full expression inside the
>          // integral below--it's long enough already)
>          Real (DefaultDensityStructure::*f)(Time) const =
>              &DefaultDensityStructure::defaultDensityImpl;
>          // the Gauss-Chebyshev quadratures integrate over [-1,1],
>          // hence the remapping (and the Jacobian term t/2)
>          Probability P = 1.0 - integral(remap(bind(f,this,_1), t)) * t/2.0;
>          //QL_ENSURE(P>= 0.0, "negative survival probability");
>          return std::max<Real>(P, 0.0);
>      }
>
> The following code is present. If lambda is constant then survival
> probability is exp(-lambda * t)
> If not then we integrate to find lambda over [0,t] and it becomes
> exp(Integral over [0,t] lambda dt)
>
> In the code it looks like it is calculating default probability which is
> 1 - P or 1 - Survival Probability.
> Maybe my understanding is wrong. Can someone explain?
>
>
>          Probability P = 1.0 - integral(remap(bind(f,this,_1), t)) * t/2.0;
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Sprint
> What will you do first with EVO, the first 4G phone?
> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> _______________________________________________
> QuantLib-dev mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-dev
>

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev

bootstrapcds.xls (22K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Survival Probability

japari
Hi again,
Its not a large difference though, have you played around with schedule rules,
year fractions etc...? e.g. the bootstrap date is May 15th, so
the year fraction is above 0.25 for the first period.

Regards
Pepe

----- Mail Original -----
De: "animesh saxena" <[hidden email]>
À: [hidden email]
Cc: [hidden email]
Envoyé: Lundi 12 Juillet 2010 21h28:27 GMT +01:00 Amsterdam / Berlin / Berne / Rome / Stockholm / Vienne
Objet: Re: [Quantlib-dev] Survival Probability

  Pepe,
      Thanks for your mail. I located the class and could understand the
implementation a bit. Another issue is I tried running the CDS example
in quantlib reference. It gave following output.

hazard rate on May 15th, 2007 is 0.0299689
hazard rate on September 20th, 2007 is 0.0299689
hazard rate on December 20th, 2007 is 0.0299613
hazard rate on June 20th, 2008 is 0.0299619
hazard rate on June 22nd, 2009 is 0.0299607

Some survival probability values:
1Y survival probability: 97.040061 %
                expected: 97.040000 %
2Y survival probability: 94.175780 %
                expected: 94.180000 %


I am assuming it is calculating implied survival probabilities based on
Credit Spreads of 150bps, taken in the example. Assuming recover rate of
50%, and using the standard bootstrapping approach. As per bootstrapping
default leg = coupon leg.

So I am getting these values for year 1 and 2.

97.060795%
For year 2, 94.2338%
Attaching excel sheet for simple calculations done for CDS.

 From these values it's easy to back out hazard rate using S(t) =
exp^(-lambda * t) = 97.060795, where lambda is hazard rate. For first
case it's 2.98326%

Thanks

Animesh Saxena

(http://quantanalysis.wordpress.com)


On 7/11/10 3:28 PM, [hidden email] wrote:

> Hi,
> DefaultDensityStructure does not rely on a hazard rate model to compute the probabilities. You might well have other ways to compute them. Dont be confused by the methods in the parent class, you can still compute the rates. But see that
> DefaultDensityStructure::defaultDensityImpl
> does need to be making any reference to a HR model. Its more 'abstract' conceptually
>
> The more specialized class and method:
> HazardRateStructure::survivalProbabilityImpl
> is what you have in mind.
>
> Hope it helps.
> Pepe
>
>
> ----- Mail Original -----
> De: "animesh saxena"<[hidden email]>
> À: [hidden email]
> Envoyé: Samedi 10 Juillet 2010 17h06:02 GMT -08:00 Tijuana / Baja California
> Objet: [Quantlib-dev] Survival Probability
>
> Minor doubt in defaultdensitystructure.cpp
>
> In the function
>   Probability DefaultDensityStructure::survivalProbabilityImpl(Time t)
> const {
>          static GaussChebyshevIntegration integral(48);
>          // this stores the address of the method to integrate (so that
>          // we don't have to insert its full expression inside the
>          // integral below--it's long enough already)
>          Real (DefaultDensityStructure::*f)(Time) const =
>              &DefaultDensityStructure::defaultDensityImpl;
>          // the Gauss-Chebyshev quadratures integrate over [-1,1],
>          // hence the remapping (and the Jacobian term t/2)
>          Probability P = 1.0 - integral(remap(bind(f,this,_1), t)) * t/2.0;
>          //QL_ENSURE(P>= 0.0, "negative survival probability");
>          return std::max<Real>(P, 0.0);
>      }
>
> The following code is present. If lambda is constant then survival
> probability is exp(-lambda * t)
> If not then we integrate to find lambda over [0,t] and it becomes
> exp(Integral over [0,t] lambda dt)
>
> In the code it looks like it is calculating default probability which is
> 1 - P or 1 - Survival Probability.
> Maybe my understanding is wrong. Can someone explain?
>
>
>          Probability P = 1.0 - integral(remap(bind(f,this,_1), t)) * t/2.0;
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Sprint
> What will you do first with EVO, the first 4G phone?
> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> _______________________________________________
> QuantLib-dev mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-dev
>

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev