Displaying 1 result from an estimated 1 matches for "u_loss".
Did you mean:
e_loss
2011 Mar 25
1
Appending data to a data.frame and writing a csv
...1 = Default, 0 = no-default.
L <- matrix(data=NA, nrow=n, ncol=samplesize, byrow=TRUE)
for(i in 1:n)
L[i,] <- rbinom(n=samplesize, size=1, prob=exposure$pd[i])
# ________________________________________________________________
# compute for each simulation
p_loss <- e_loss <- u_loss <- NULL
for(i in 1:samplesize)
{
defaulting <- subset(data.frame(id=exposure$id, ead=exposure$ead, lgd=exposure$lgd, pd=exposure$pd, loss=L[,i]),
loss==1)
p_loss[i] <- sum(defaulting$ead * defaulting$lgd)
e_loss[i] <- sum(defaulting$ead * defaulting$lgd * defaulting$pd)
u_loss[...