Directory of Open Source for Quantitative Finance and Trading
Username: Password: Not registered?
 
Quick Search:    (AJAX based: No need to press button)

Main : C++ : 


Category: C++ View Full Details
Download Now!CDO Pricing in Gaussian Copula
Submitter: vanna Date: 2007/6/3
Description:
Author : Aloke Tukul Mukherjee

Calculates prices of the floating leg, fixed leg, total price and break-even spread for the tranches of a standard 5-year synthetic CDO swap. The information is sent to stdout.

Check the Homepage for further details and notes

Got a question or problem with this link? Just enter your message and click on submit. No registration is required.

Note: A copy of this message will also be emailed to the submitter of this link
Downloaded 2345 times  2345  File Size 0 bytes  Supported Platforms C++ NewMat  Home Page http://math.nyu.edu/~atm262/files/spring06/ircm/cdo/
Rating: 0.00 (0 votes)
Rate this File | Modify | Delete | Report Broken File | Tell a Friend | Comments (16)

Poster Thread
lazim
Posted: 2007/6/2 16:30  Updated: 2007/6/2 16:35
Just popping in
Joined: 2006/10/31
From: Italy
Posts: 7
 Default probability confusion
I am trying to understand what is the default probability that exactly k default happens between times t1 and t2.

I created the following function , and call this after the matrix W of default times has been sorted:


void DoTest(Matrix& W)
{
Natural i,j;
Real t1=2;
Real t2=4;
Natural tmpsum=0;
Natural tmpsum2=0;
Natural defaultOccurences=1;
Natural test1=0;
Natural test2=0;
Natural test3=0;
Natural test4=0;
for (i=1;i<=DEFAULT_PATHS;i++)
{
tmpsum=0;
test1=0;
test3=0;
for (j=1;j<=DEFAULT_N;j++)
{
//system("PAUSE");
Real defTime=W(j,i);
//cout << "defTime=" << defTime << endl;
//if ( (defTime>t1) && (defTime<t2) )
if (defTime > t1)
{
if (defTime < t2)
{
tmpsum+=1;
}
}
if (defTime < t2)
test1++;
if (defTime < t1)
test3++;

}
if (tmpsum == defaultOccurences)
tmpsum2++;
if (test1 == defaultOccurences)
test2++;
if (test3 == defaultOccurences)
test4++;

}
cout << "no of times exactly 1 default happened before t2 = " << test2 << endl;
cout << "no of times exactly 1 default happened before t1 = " << test4 << endl;
cout << "no of times exactly 1 default happened t1 and t2 = " << tmpsum2 << endl;
Real prob1=Real(test2)/Real(DEFAULT_PATHS);
cout << "probability of exactly 1 default happened before t2 = " << prob1 << endl;
Real prob2=Real(test4)/Real(DEFAULT_PATHS);
cout << "probability of exactly 1 default happened before t1 = " << prob2 << endl;
Real prob3=Real(tmpsum2)/Real(DEFAULT_PATHS);
cout << "(method 1) prob of exactly 1 default happened between t1 and t2 = " << prob3 << endl;
Real prob4= prob1-prob2;
cout << "(method 2) prob of exactly 1 default happened between t1 and t2 = " << prob4 << endl;


}




I call it inside main() after this line:
sortColumns(W);
DoTest(W);


Now inside this function I find the probability of occurence of exactly 1 default between t1 and t2 by 2 methods:
1.probability=prob. of 1 default before time t2-prob. of 1 default before time t1
2.probability=(no. of occurences of 1 default between t1 and t2)/(no_of_paths)


I assumed they should give same value.Surprisingly, the results from method 1 and 2 are much different.

no of times exactly 1 default happened before t2 = 23289
no of times exactly 1 default happened before t1 = 14706
no of times exactly 1 default happened t1 and t2 = 14994
probability of exactly 1 default happened before t2 = 0.23289
probability of exactly 1 default happened before t1 = 0.14706
(method 1) prob of exactly 1 default happened between t1 and t2 = 0.14994
(method 2) prob of exactly 1 default happened between t1 and t2 = 0.08583
Press any key to continue . . .


method 1 gives 0.14994 while 2 gives 0.08583.

I am confused which method is wrong, aren't the probabilties additive?

Poster Thread
Gimpy
Posted: 2007/6/4 21:35  Updated: 2007/6/4 21:35
Just popping in
Joined: 2007/6/4
From:
Posts: 1
 Re: Default probability confusion
Quote:
1.probability=prob. of 1 default before time t2-prob. of 1 default before time t1

Quote:
2.probability=(no. of occurences of 1 default between t1 and t2)/(no_of_paths)


lazim your method 2 is clearly wrong. Think of a case where 2nd default happened between time t1 and t2, which had its first default happened between 0 and t1.
Accoding to (2), this event would also get counted hence you are getting hign values of prob

Poster Thread
quantcode
Posted: 2008/7/18 16:49  Updated: 2008/7/18 16:49
Just popping in
Joined: 2008/7/11
From:
Posts: 2
 Re: CDO Pricing in Gaussian Copula
when I complie by th eg++, there are error messages, "config.h", and "valarray.h" can not be found. which complier you use

Poster Thread
lazim
Posted: 2008/7/18 17:50  Updated: 2008/7/18 17:50
Just popping in
Joined: 2006/10/31
From: Italy
Posts: 7
 Re: CDO Pricing in Gaussian Copula
I had used Dev C++ IDE for Windows.It was something like 4.9 version if I recall.

Poster Thread
Anonymous
Posted: 2012/5/4 15:00  Updated: 2012/5/6 19:14
 CDO Pricing in Gaussian Copula
hi vanna i need your some help .. i construct default correlation by copula approach .. please help me (Gaussian t Frank Clayton Gambel) i see your excel sheet but i need calculation not show graphically .. please i am waiting your response email address aliayaz18@live.com

Discuss this file. Just enter your message and click on submit. No registration is required.
Similar Links:
CDO Pricing Using Gaussian Copulas in Matlab (Software)
CDO Tranche Pricing using T copula (Software)
Basket CDS pricing using Copula (Software)
CDO Square Loss distribution using Gaussian Copula (Software)
asian option pricing (Forum)

Subscribe to RSS or daily email updates of latest quantitative finance code listings
Email address :
Copyright © 2011 QuantCode Inc. All rights reserved.