[R] A coding question involving variable assignments in ifelse()
xpRt.wannabe
xprt.wannabe at gmail.com
Thu Apr 26 18:48:52 CEST 2007
Dear List,
Below is a simple, standard loss model that takes into account the
terms of an insurance policy:
deductible <- 15
coverage.limit <- 75
insurance.threshold <- deductible + coverage.limit
tmpf <- function() {
loss <- rlnorm(rpois(1, 3), 2, 5)
sum(ifelse(loss > insurance.threshold, loss - coverage.limit,
pmin(loss, deductible)))
}
net <- replicate(1000000, tmpf())
Now, I would like to enhance the model by incorporating the following
two probabilities:
1. Probability of claim being accepted by the insurance company, say, 0.8
2. Probability of payout by the insurance company, say, 0.999
Could anyone suggest how one might do this?
platform i386-pc-mingw32
arch i386
os mingw32
system i386, mingw32
status
major 2
minor 2.1
year 2005
month 12
day 20
svn rev 36812
language R
Thanks,
More information about the R-help
mailing list