|
Let
s1 = 1000 and f(s1) = 0.6
s2 = 10000 and f(s2) = 0.3
s3 = 100000 and f(s3) = 0.1
Think of s1, s2, and s3 as three types of events. When loss = 11000, it has to be that both s1 and s2 happened, and there are two combinations, either s1 took place first then s2, or s2 took place first and then s1. When loss = 2000, it has to be that s1 happened twice, that is, s1 took place first then s1 again, which is only one combination.
# simulation in R below
x <- NULL
z <- NULL
r <- runif(100000)
x <- ifelse(r<=0.5, 0, ifelse(r<=0.8, 1, 2))
table(x)
for (i in (1:length(x))) {
if (x[i]==0) {
z[i] <- 0
} else if (x[i]==1) {
u <- runif(1)
z[i] <- ifelse(u<=0.6, 1000, ifelse(u<=0.9, 10000, 100000))
} else if (x[i]==2) {
u <- runif(1)
y1 <- ifelse(u<=0.6, 1000, ifelse(u<=0.9, 10000, 100000))
u <- runif(1)
y2 <- ifelse(u<=0.6, 1000, ifelse(u<=0.9, 10000, 100000))
z[i] <- y1 + y2
}
}
table(z)/length(x)
## z
## 0 1000 2000 10000 11000 20000 1e+05 101000 110000 2e+05
## 0.49896 0.18187 0.07184 0.08981 0.07050 0.01867 0.03028 0.02429 0.01178 0.00200
|