Description Usage Arguments Value Note See Also Examples
Performs Monte Carlo loss simulation for a given number of given periods and some fitted distributions for loss frequency and denstiy.
1 2 3 4 5 6 | mc(x, rfun = NULL, period, iterate, nmb = 1000, begin = NULL, end = NULL,
wknd = TRUE, crt = 0, type = NULL, param = NULL, zero = F, distname = NULL, fit=T,
flist = c("beta", "cauchy", "chi-squared", "exponential","f", "gamma", "geometric",
"log-normal", "logistic", "normal", "weibull", "inverse gaussian"),
p = c(0.95, 0.99, 0.999), ...)
|
x |
list with two columnes, first with dates of events and second with loss amount |
rfun |
random generation for the chosen distribution; |
period |
could be |
iterate |
could be |
nmb |
number of period iterations |
begin |
period begin date; if not given, it would be minimum from loss dates |
end |
period end date; if not given, it would be maximum from loss dates |
wknd |
whether to have 252 days a year ( |
crt |
correction; argument passed to |
type |
could be |
param |
start parameters (only for |
zero |
should zero losses be drawn ( |
distname |
distribution name; if |
fit |
logical: fit |
flist |
list of distributions |
p |
confidence level (default c(0.95, 0.99, 0.999)) |
... |
arguments passed to |
table$losses |
generated losses |
table$q |
|
ad |
absolute differences between empirical and fitted density values |
"log-normal" and "lognormal" are not the same anymore; only "log-normal" would work
root.period
, loss.fit.dist
, fitdistr
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | data(loss.data.object)
x<- read.loss(3,2,loss.data.object)
# first example:
l1 = mc(x,begin="2010-01-01",end="2010-12-31")$table
l1
# second example:
l2 = mc(x,rfun = "inverse gaussian",nmb =100)$table
l2 # yearly losses for 100 years, 365 days per year
# third example:
l3 = mc(x,rfun = "beta", p=c(0.95))$table
# fourth example:
l4 = mc(x,rfun = "beta",type = "binomial")$table # type of frequency distribution is chosen
# fifth example:
l5 = mc(x,rfun = rbeta,param = list(shape1 = 0.47,shape2 = 36.66),period = "days",distname = "beta")$table
# parameters for beta distribution are given
# sixth example:
l6 = mc(x,rfun = "normal") # comapare loss.fit.dist("normal",x) - fit is very poor
# seventh example:
l7 = mc(x,rfun = rnorm,type = "binomial",param = list(mean=3,sd=4))$table
# parameters for normal distribution are given (and very poor, comparing loss.fit.dist("normal",x) or sixth example )
# eighth example:
l8 = mc(x,flist= c("normal","inverse gaussian"))$table
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.