Java Mailing List Archive

http://www.r-help.com/

Home » Home (12/2007) » R Help for Statistical Computing »

[R] A coding question involving variable assignments in ifelse()

xpRt.wannabe

2007-04-26

Replies:

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,

______________________________________________
R-help@(protected)
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
©2008 r-help.com - Jax Systems, LLC, U.S.A.