|
||||||||||||||
| 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 |
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 |
|---|---|
| quantcode | Posted: 2008/7/18 16:49 Updated: 2008/7/18 16:49 |
Just popping in ![]() ![]() Joined: 2008/7/11 From: Posts: 2 |
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 |
|---|---|
| Anonymous | Posted: 2012/5/4 15:00 Updated: 2012/5/6 19:14 |
|
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.
CDO Pricing in Gaussian Copula
2345
0 bytes
C++ NewMat

