aboutsummaryrefslogtreecommitdiffstats
path: root/R/script_calibrate_tranches.R
diff options
context:
space:
mode:
Diffstat (limited to 'R/script_calibrate_tranches.R')
-rw-r--r--R/script_calibrate_tranches.R5
1 files changed, 3 insertions, 2 deletions
diff --git a/R/script_calibrate_tranches.R b/R/script_calibrate_tranches.R
index 6ad98263..ab86218b 100644
--- a/R/script_calibrate_tranches.R
+++ b/R/script_calibrate_tranches.R
@@ -1,5 +1,6 @@
#!/usr/bin/Rscript
require(methods)
+options(warn=2)
args <- commandArgs(trailingOnly=TRUE)
if(.Platform$OS.type == "unix"){
@@ -85,7 +86,7 @@ Z <- quadrature$nodes
w.mod <- w
defaultprob <- 1 - SurvProb
p <- defaultprob
-rho <- 0.45
+rho <- rep(0.45, n.credit)
result <- matrix(0, 4, n.int)
for(l in 1:100){
@@ -111,7 +112,7 @@ for(l in 1:100){
err <- 0
for(i in 1:n.credit){
for(j in 1:ncol(p)){
- err <- err + abs(crossprod(shockprob(p[i,j], rho, Z), program$weight) - defaultprob[i,j])
+ err <- err + abs(crossprod(shockprob(p[i,j], rho[i], Z), program$weight) - defaultprob[i,j])
}
}
errvec <- c(errvec, err)