loss.density: Plots loss density

Description Usage Arguments Note See Also Examples

Description

A function plotting loss density for a chosen business line or risk category and for all risk categories or business lines accordingly. Number of losses is printed in the plot main.

Usage

1
2
loss.density(a, b, data, no = FALSE, rnumb = c(), bnumb = c(),
            period = c("none", "days", "weeks", "months", "quarters"), ...)

Arguments

a

If a=1 then function plots density for all business lines and chosen risk category (b), and if a=2 then function plots density for all risk categories and chosen business line (b)

b

chosen position from business line or risk category

data

should be of loss.data.object type

no

whether to draw antyhing when there is no data, or not (if FALSE empty plot is drawn when there is no data for given business line and risk category)

rnumb

risk categories numbers; argument designed for chosing some of risk categories

bnumb

business lines numbers; argument designed for chosing some of business lines

period

could be "none" (losses are not aggregated), "days", "weeks", "months" or "quarters" (in last four cases loss are aggregated by days, weeks, months or quarters respectively )

...

Arguments to be passed to density

Note

a =1 (business) or a =2 (risk), so when a=1, it is useless to give any rnumb and when a=2, it makes no sense to use bnumb.

See Also

density

Examples

 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
41
42
43
data(loss.data.object)

# first example:
 
 loss.density(1,7,loss.data.object) # loss density from all business lines 
 #(loss.data.object$blines) and risk category Internal Fraud
 
# second example:
 
 loss.density(1,7,loss.data.object,no=T) # second example, but with no empty plots

# third example:

 loss.density(1,1,loss.data.object) # of course it is empty (no loss data)
 # see
 D <- loss.matrix(loss.data.object); par(mfrow = c(1,1))
 loss.matrix.image(D,loss.data.object$blines,loss.data.object$rcateg)

# fourth example:

 loss.density(1,7,loss.data.object,period="quarters") # loss are aggreagated by quarters

# fifth example:

 loss.density(1,7, loss.data.object,bnumb=c(1,2,3,5,6,7)) # in this example business lines are
									# loss.data.object$blines[c(1,2,3,5,6,7)]

# sixth example:

 loss.density(1,5,loss.data.object,bnumb=c(5)) # risk category is loss.data.object$rlines[5]
   # and because bnumb=c(5), there is only one business line, loss.data.object$blines[5] 

# seventh example:

 loss.density(1,5,loss.data.object,kernel="triangular") 

# eighth example:

 # (with some mistake)
 loss.density(1,5,loss.data.object,bnumb=c(5),rnumb=c(11))
# of course rnumb=c(11) makes no sense, but it does not affect this function, because there is already
# one chosen position from risk categories and it is 5, not 11 so 11 is simply ignored
# (and note that we have no 11th risk category)

barryrowlingson/opVaR documentation built on May 11, 2019, 7:24 p.m.