aboutsummaryrefslogtreecommitdiffstats
path: root/python/script_calibrate_tranches.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/script_calibrate_tranches.py')
-rw-r--r--python/script_calibrate_tranches.py31
1 files changed, 0 insertions, 31 deletions
diff --git a/python/script_calibrate_tranches.py b/python/script_calibrate_tranches.py
deleted file mode 100644
index 6368a74f..00000000
--- a/python/script_calibrate_tranches.py
+++ /dev/null
@@ -1,31 +0,0 @@
-import numpy as np
-from tranche_functions import GHquad, BClossdist
-
-n_int = 500
-n_credit = 100
-Z, w = GHquad(n_int)
-
-with open("recov.csv") as fh:
- recov = np.array([float(e) for e in fh], dtype='double', order='F')
-
-with open("SurvProb.csv") as fh:
- SurvProb = np.array([[float(e) for e in line.split(",")] for line in fh], dtype='double', order='F')
-
-defaultprob = 1 - SurvProb
-p = defaultprob
-rho = 0.45 * np.ones(n_credit)
-
-for l in range(150):
- Rstoch = np.zeros((n_credit, n_int, SurvProb.shape[1]))
- for t in range(SurvProb.shape[1]):
- for i in range(n_credit):
- Rstoch[i,:,t] = stochasticrecov(recov[i], 0, Z, w_mod, rho[i], defaultprob[i,t], p[i,t])
- L = np.zeros((n_int, Ngrid, SurvProb.shape[1]))
- R = np.zeros((n_int, Ngrid, SurvProb.shape[1]))
- for t in range(SurvProba.shape[1]):
- S = 1 - Rstoch[:,:,t]
- L[:,:,t] = lossdistZ(p[:,t], issuerweights, S, Ngrid, 0, rho, Z)
- R[:,:,t] = lossdistZ(p[:,t], issuerweights, S, Ngrid, 0, rho, Z)
-
- for i in range(n_int):
- result[:,i] = tranche.pvvec(Kmodified, L[i,,], R[i,,], cs)