hist.period: Loss frequency histograms

Description Usage Arguments Value See Also Examples

Description

Function plotting histograms of frequency of losses.

Usage

1
hist.period(data, period, wknd = TRUE, crt = 0, begin=NULL,end=NULL, ...)

Arguments

data

two-dimensional data object; the first column of data contains loss dates, the second - loss values

period

describes how data should be agregated; possible period values are: "days","weeks","months" and "quarters"

wknd

a logical value indicating whether weekend days (wknd) count as days being bussiness days; wknd is designed only for period = "days"

crt

correction indicates how many days should be excluded from the time horizon; it is designed for holidays and only for period = "days"

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

...

further arguments passed to barplot (graphical parameters)

Value

Table y indicating how many days/weeks/months/quarters (depending on period) there was with 0,1,2,... losses.

See Also

barplot, root.period

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
# data comes from risk category called "Execution, Delivery & Process Management"
# and from business line called "Payment & Settlement"

# the first example:

 data(loss.data.object)
 x<- read.loss(5,5,loss.data.object)

 hist.period(x,"weeks")

# the second example:

 data(loss.data.object)
 x<- read.loss(5,5,loss.data.object)
 z<- {}		

 par(mfrow=c(2,2))
 z$days <- hist.period(x,"days",col = "pink1")
 z$weeks <- hist.period(x,"weeks",col = "lightblue")
 z$months <- hist.period(x,"months",col = "khaki1" )
 z$quarters <- hist.period(x,"quarters",col = "lightgreen")

z

# the third example:

 data(loss.data.object)
 x<- read.loss(5,5,loss.data.object)
 y<- {}		

 # begin and end dates would be given:
 par(mfrow=c(2,2))
 y$days <- hist.period(x,"days",col = "pink1",begin="2010-01-01",end="2010-12-31")
 y$weeks <- hist.period(x,"weeks",col = "lightblue",begin="2010-01-01",end="2010-12-31")
 y$months <- hist.period(x,"months",col = "khaki1",begin="2010-01-01",end="2010-12-31")
 y$quarters <- hist.period(x,"quarters",col = "lightgreen",begin="2010-01-01",end="2010-12-31")

y	# compare with z from the previous example

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