Package 'ggsolvencyii'

Title: A 'ggplot2'-Plot of Composition of Solvency II SCR: SF and IM
Description: An implementation of 'ggplot2'-methods to present the composition of Solvency II Solvency Capital Requirement (SCR) as a series of concentric circle-parts. Solvency II (Solvency 2) is European insurance legislation, coming in force by the delegated acts of October 10, 2014. <https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=OJ%3AL%3A2015%3A012%3ATOC>. Additional files, defining the structure of the Standard Formula (SF) method of the SCR-calculation are provided. The structure files can be adopted for localization or for insurance companies who use Internal Models (IM). Options are available for combining smaller components, horizontal and vertical scaling, rotation, and plotting only some circle-parts. With outlines and connectors several SCR-compositions can be compared, for example in ORSA-scenarios (Own Risk and Solvency Assessment).
Authors: Marco van Zanden [aut, cre]
Maintainer: Marco van Zanden <[email protected]>
License: GPL-3
Version: 0.2.0.1
Built: 2024-11-09 04:09:00 UTC
Source: https://github.com/vanzanden/ggsolvencyii

Help Index


geom_sii_riskconnection

Description

returns a 'ggplot2' object, based on geom_segment.; it plots a line between (x and y coordinates of) those datapoints which have a matching value in the columns 'id' and 'comparewithid'. values in 'id' must be unique. For values in 'comparewithid' is uniqueness not required, but a matching value in 'id' must be present.

Usage

geom_sii_riskconnection(data = NULL, mapping = NULL,
  stat = "sii_riskconnection", position = "identity", na.rm = FALSE,
  show.legend = NA, inherit.aes = TRUE, ...)

Arguments

data

the dataset in tidyverse format (column 'description' as a factor). see examples in sii_z_ex2_data or sii_z_ex3_data

mapping

required aes(thetics) : 'x' (i.e. time, longitude, integer), 'y' (i.e SCR ratio, lattitude), 'id' and also 'comparewithid'

stat

default stat is statsii_riskconnection, combinations with other stat's are not tested

position

standard ggplot function

na.rm

standard ggplot function

show.legend

standard ggplot function

inherit.aes

standard ggplot function

...

ellipsis, a standard R parameter

Value

a 'ggplot2' object based on 'geom_polygon'

Examples

library(ggsolvencyii)
library(ggplot2)

sii_z_ex3_data[sii_z_ex3_data$description == "SCR", ]

ggplot() + geom_sii_riskconnection(data = sii_z_ex3_data, mapping = aes(
  comparewithid = comparewithid,
  x = time,
  y = ratio,
  id = id,
  ),
color = "red",
lwd = 0.7,
arrow = arrow()
)

geom_sii_riskoutline

Description

returns a 'ggplot2' object, based on geom_path with the outlines concentric circle(part)s, defined by the values in a hierarchy of levels. This can be used instead of geom_sii_risksurface to plot the composition of the SCR. When optional aes(thetic) 'comparewithid' is passed to the geom_sii_riskoutline then the second SCR can be an overlay over another, for easy comparison.

Usage

geom_sii_riskoutline(data = NULL, mapping = NULL,
  stat = "sii_riskoutline",
  structure = ggsolvencyii::sii_structure_sf16_eng, squared = FALSE,
  levelmax = 99, aggregatesuffix = "_other", plotdetails = NULL,
  rotationdegrees = NULL, rotationdescription = NULL,
  maxscrvalue = NULL, scalingx = 1, scalingy = 1,
  position = "identity", na.rm = FALSE, show.legend = NA,
  inherit.aes = TRUE, ...)

Arguments

data

the dataset in tidyverse format (column 'description' as a factor). see examples in sii_z_ex2_data or sii_z_ex3_data

mapping

required aes(thetics) : 'x' (i.e. time, longitude, integer), 'y' (i.e SCR ratio, lattitude), 'id', 'description', 'value'. Optional aes is 'comparewithid'

stat

default stat is statsii_riskoutline, combinations with other stat's are not tested

structure

(dataframe: default = sii_structure_sf16_eng)
A representation of the buildup from individual risks to the SCR. columns are

  1. description (chr),

  2. level (chr),

  3. childlevel (chr)

. In the standard formula structure, SCR has level 1, with childlevel 2. This means it consists of all datalines with level == 2, ie. "BSCR", "operational" and "Adjustment-LACDT". lines in the dataset with a suffix "d" behind the levelnumber are diversification items. As of now these are not used in any calculation. the values in column "description" in the dataset need to match the description in this file. The package contains also a file sii_structure_sf16_nld with Dutch terms in description column.

squared

(optional, boolean, default = FALSE)
when set to TRUE plot returns a square representation. Compared with a circle representation of the same data the height and width of the square are smaller than the radius of the circle. Segments which fall in the corner parts of the square are smaller than equally sized part which fall in the vertical or horizontal parts of the square.

levelmax

(integer or dataframe, default = 99)
a positive integer or a dataframe with columns 'level' and 'levelmax'.
The maximum amount of items in a certain level to be plotted. The smallest items are combined to one item. In the case level consisting of 7 items has a levelmax of 5 this results in 4 separate items and one grouped item.
For a less detailed plot sii_levelmax_sf16_995 and sii_levelmax_sf16_993 are present in the package where the components of market, life, non-life, health are combined in 5 or 3 items.

aggregatesuffix

(string, default = "_other")
When a certain level contains more items than specified by levelmax the smallest items are combined. The description is of the name of the one higher level (lower number) with a suffix

plotdetails

a table with columns 'levelordescription' and 'outline1' to 'outline4', indicating which outlines of which circle elements to plot. When no table is provided all segments are plotted. example 3 shows how to combine geom_sii_risksurface and geom_sii_riskoutline by using using table sii_z_ex3_plotdetails. geom_sii_risksurface uses another column in the same table.

rotationdegrees

(optional, integer, -360 to 360, default = NULL)
when given, the fixed amount of degrees (positive is clockwise) of which each item is rotated (as in a compass, -90 is a quarter rotation anti-clockwise), additive to possible rotation to description

rotationdescription

(optional, string, default = NULL)
default the orientation of the lower level (higher number) circles is based on the structure. When this parameter is not NULL then the circles are rotated in such a way that the indicated item lies in the "north-east" part of the circle.

maxscrvalue

(optional, double, default = NULL)
the scale of the different plot elements is is by default measured to the largest level 1 element (i.e. SCR) in the dataset, this can be overridden by this parameter for example when combining several plots

scalingx

(optional, positive value ,default = 1)
for plots where units in x and y are different in magnitude distortion can occur. This parameter scales only in x-direction

scalingy

(optional, positive value ,default = 1)
for plots where units in x and y are different in magnitude distortion can occur. This parameter scales only in y-direction

position

standard ggplot function

na.rm

standard ggplot function

show.legend

standard ggplot function

inherit.aes

standard ggplot function

...

ellipsis, a standard R parameter

Details

When describing an outline of a circle part 4 segments can be distinguised, radial line outwards, outer circle segment, radial line inwards, inner circle segment. Whether or not to plot these lines can be determined with an outline dataframe. by means of the column aes()value comparewithid in the data an overlay can be made to compare two SCR representations.

Value

a 'ggplot2' object geom_sii_risksurface

Examples

library(ggsolvencyii)
library(ggplot2)

## see details about id and comparewithid
# sii_z_ex3_data[sii_z_ex3_data$description == "SCR", ]

ggplot()+
geom_sii_riskoutline(data = sii_z_ex3_data, mapping = aes(
  # comparewithid = comparewithid,
  x = time,
  y = ratio,
  value = value,
  id = id,
  description = description),
color = "red",
lwd = 0.7
)

##and with comparewithid in  aes()

ggplot()+
geom_sii_riskoutline(data = sii_z_ex3_data, mapping = aes(
  comparewithid = comparewithid,
  x = time,
  y = ratio,
  value = value,
  id = id,
  description = description),
color = "red",
lwd = 0.7
)

geom_sii_risksurface

Description

returns a 'ggplot2' object, based on geom_polygon, with filled, concentric circle(part)s, defined by the values in a hierarchy of levels.

Usage

geom_sii_risksurface(data = NULL, mapping = NULL,
  stat = "sii_risksurface",
  structure = ggsolvencyii::sii_structure_sf16_eng, squared = FALSE,
  levelmax = 99, aggregatesuffix = "_other", plotdetails = NULL,
  rotationdegrees = NULL, rotationdescription = NULL,
  maxscrvalue = NULL, scalingx = 1, scalingy = 1,
  position = "identity", na.rm = FALSE, show.legend = NA,
  inherit.aes = TRUE, ...)

Arguments

data

the dataset in tidyverse format (column 'description' as a factor). see examples in sii_z_ex2_data or sii_z_ex3_data

mapping

required aes(thetics) : x (i.e. time, longitude), y (i.e SCR ratio, lattitude), id, description (), value

stat

default stat is statsii_risksurface, combinations with other stat's are not tested

structure

(dataframe: default = sii_structure_sf16_eng)
A representation of the buildup from individual risks to the SCR. columns are

  1. description (chr),

  2. level (chr),

  3. childlevel (chr)

. In the standard formula structure, SCR has level 1, with childlevel 2. This means it consists of all datalines with level == 2, ie. "BSCR", "operational" and "Adjustment-LACDT". lines in the dataset with a suffix "d" behind the levelnumber are diversification items. As of now these are not used in any calculation. the values in column "description" in the dataset need to match the description in this file. The package contains also a file sii_structure_sf16_nld with Dutch terms in description column.

squared

(optional, boolean, default = FALSE)
when set to TRUE plot returns a square representation. Compared with a circle representation of the same data the height and width of the square are smaller than the radius of the circle. Segments which fall in the corner parts of the square are smaller than equally sized part which fall in the vertical or horizontal parts of the square.

levelmax

(integer or dataframe, default = 99)
a positive integer or a dataframe with columns 'level' and 'levelmax'.
The maximum amount of items in a certain level to be plotted. The smallest items are combined to one item. In the case level consisting of 7 items has a levelmax of 5 this results in 4 separate items and one grouped item.
For a less detailed plot sii_levelmax_sf16_995 and sii_levelmax_sf16_993 are present in the package where the components of market, life, non-life, health are combined in 5 or 3 items.

aggregatesuffix

(string, default = "_other")
When a certain level contains more items than specified by levelmax the smallest items are combined. The description is of the name of the one higher level (lower number) with a suffix

plotdetails

(optional) a table with columns 'levelordescription' and 'surface', indicating which circle elements to plot. When no table is provided all segments are plotted. example 3 shows how to combine geom_sii_risksurface and geom_sii_riskoutline by using using table sii_z_ex3_plotdetails. geom_sii_riskoutline uses other columns in the same table

rotationdegrees

(optional, integer, -360 to 360, default = NULL)
when given, the fixed amount of degrees (positive is clockwise) of which each item is rotated (as in a compass, -90 is a quarter rotation anti-clockwise), additive to possible rotation to description

rotationdescription

(optional, string, default = NULL)
default the orientation of the lower level (higher number) circles is based on the structure. When this parameter is not NULL then the circles are rotated in such a way that the indicated item lies in the "north-east" part of the circle.

maxscrvalue

(optional, double, default = NULL)
the scale of the different plot elements is is by default measured to the largest level 1 element (i.e. SCR) in the dataset, this can be overridden by this parameter for example when combining several plots

scalingx

(optional, positive value ,default = 1)
for plots where units in x and y are different in magnitude distortion can occur. This parameter scales only in x-direction

scalingy

(optional, positive value ,default = 1)
for plots where units in x and y are different in magnitude distortion can occur. This parameter scales only in y-direction

position

standard ggplot function

na.rm

standard ggplot function

show.legend

standard ggplot function

inherit.aes

standard ggplot function

...

ellipsis, a standard R parameter

Value

a ggplot object

Examples

## dataset human readable
library(ggsolvencyii)
library(ggplot2)
t <- tidyr::spread(data = sii_z_ex1_data, key = description, value = value)
t <- as.data.frame(t)
t <- t[order(t$id),]
t <- dplyr::select( t, id, time, comparewithid, ratio, SCR, dplyr::everything())
t[1:3 ,1:8]

ggplot() +
geom_sii_risksurface(
    data = sii_z_ex1_data[sii_z_ex1_data$id == 1, ],
mapping = aes(x = time,
                  y = ratio,
                  id = id,
                  value = value,
                  description = description,
                  color = description,
                  fill = description
                   ) ) +
theme_bw() +
scale_fill_manual(name = "Risks",values = sii_x_fillcolors_sf16_eng) +
scale_color_manual(name = "Risks",values = sii_x_edgecolors_sf16_eng)

ggplot() +
 geom_sii_risksurface(
   data = sii_z_ex2_data,
   mapping = aes(x = time, y = ratio, id = id, value = value,
                 description = description,
                 # color = description,
                 fill = description
                 ),
   color = "black",
   levelmax = sii_levelmax_sf16_993) +
theme_bw() +
scale_fill_manual(name = "Risks",values = sii_x_fillcolors_sf16_eng) # +
# scale_color_manual(name = "Risks",values = sii_x_edgecolors_sf16_eng)



ggplot() +
 geom_sii_risksurface(data = sii_z_ex1_data[sii_z_ex1_data$id == 1, ],
       mapping = ggplot2::aes(x = time,
                              y = ratio,
                              ## x and y could for example be
                              ## longitude and latitude
                              ## in combination with plotted map
                              value = value,
                              id = id,
                              description = description,
                              fill = description, ## optional
                              color = description  ## optional
                              ),
           ## all parameters are shown here,
           ## the values behind the outcommented are the default values
             ## how and what
               ## structure = sii_structure_sf16_eng,
               ## plotdetails = NULL,
             ## grouping
               # levelmax = 99,
               # aggregatesuffix = "other",
             ## scaling
               # maxscrvalue =  NULL,
               # scalingx = 1,
               # scalingy = 1,
             ## rotation and squared
               # rotationdegrees = NULL,
               # rotationdescription = NULL,
               # squared = FALSE,
             ## cosmetic
               lwd = 0.25,
               # alpha = 1
       ) +
 theme_bw() +
 scale_fill_manual(name = "risks", values = sii_z_ex1_fillcolors) +
 scale_color_manual(name = "risks", values = sii_z_ex1_edgecolors)

get_external_data makes a call to website vanzanden.nl. The only purpose is to track the usage of (parts) of the package.

Description

get_external_data makes a call to website vanzanden.nl. The only purpose is to track the usage of (parts) of the package.

Usage

get_external_data(caller = "stat_usage.csv")

Arguments

caller

(default = "stat_usage.csv") the filename which will be downloaded, for each geom is a separate file available

Value

it returns a list: $success = TRUE/FALSE

Examples

library(ggsolvencyii)
callresult <- ggsolvencyii:::get_external_data(caller = "stat_usage.csv")
callresult

sii_debug_geom

Description

assists in finding level or description mismatches in a set parameter(tables)

Usage

sii_debug_geom(data_descriptionvector,
  structure = ggsolvencyii::sii_structure_sf16_eng,
  aggregatesuffix = "other", levelmax = NULL, plotdetails = NULL,
  fillcolors = NULL, edgecolors = NULL)

Arguments

data_descriptionvector

(no default) the vector 'description' from the data

structure

(no default) the structure dataframe

aggregatesuffix

(optional, default = "_other"):

levelmax

(optional, no default): the levelmax dataframe, when not filled the expanded structure assumes levelmax was set to 99 for all levels.

plotdetails

(optional, no default): the plotdetails dataframe

fillcolors

(optional, no default): fillcolor parameter (list with items "description" = "color" where color can be a name, #hexcode or other )

edgecolors

(optional, no default): edgecolor parameter (list with items "description" = "color" where color can be a name, #hexcode or other )

Value

prints two comparison tables and puts them in $debug_description and $debug_level


sii_levelmax_sf16_993

Description

maximum number of items in a level, 99 items for levels 1-3 (SCR, BSCR/OR/ADJ, Market/life/... risks) and 3 items for lower level risk (equity/longevity/...) in a standard formula structure.

Usage

sii_levelmax_sf16_993

Format

A data frame with columns:

level

string with format 'level(numeric)' [<point> 'sublevel(numeric)'] ['d'] i.e. 1, 2.01, 3.1d where d indicates a diversification component

levelmax

positive integer indicating the total number of components to be shown in a level, consisting of the x-1 largest components and the remaining components combined in one other

Source

made from excel-file in github.com/vanzanden :

Examples

installedtable <- sii_levelmax_sf16_993
installedtable

sii_levelmax_sf16_995

Description

maximum number of items in a level, 99 items for levels 1-3 (SCR, BSCR/OR/ADJ, Market/life/... risks) and 5 items for lower level risk (equity/longevity/...) in a standard formula structure.

Usage

sii_levelmax_sf16_995

Format

A data frame with columns:

level

string with format 'level(numeric)' [<point> 'sublevel(numeric)'] ['d'] i.e. 1, 2.01, 3.1d where d indicates a diversification component

levelmax

positive integer indicating the total number of components to be shown in a level, consisting of the x-1 largest components and the remaining components combined in one other

Source

made from excel-file in github.com/vanzanden, from there transfered to R environment with code in preparingtables.R.

Examples

installedtable <- sii_levelmax_sf16_995
installedtable

sii_plotdetails_sf16

Description

A table for geom_sii_risksurface and geom_sii_riskoutline indicating which outlines of each item should be shown, specified per level and/or description. the latter overrule the former.
when defining an item (or the squared = TRUE transformation) 4 lines can be distinguished, a radialline going outwards, a circle segment (clockwise), a radialline going inwards, a circle segment (counterclockwise). These are numbered as outline1 to outline4.

Usage

sii_plotdetails_sf16

Format

A data frame with columns:

levelordescription

string with format 'level(numeric)' [<point> 'sublevel(numeric)'] ['d'] i.e. 1, 2.01, 3.1d where d indicates a diversification component AND/OR description(s) from the corresponding structure

surface

boolean (logical): the surface

outline1

boolean (logical): the radial line

outline2

boolean (logical): the outer line

outline3

boolean (logical): the radial line

outline4

boolean (logical): the inner line

outline11

NOT YET IMPLEMENTED: boolean (logical): analogue to outline1, but but only for the first plotted component of that level. The components in each level are plotted clockwise

outline13

NOT YET IMPLEMENTED: boolean (logical): analogue to outline3, but but only for the last plotted component of that level.

Source

determined based on specification of EIOPA standard formula Solvency II structure made from excel-file in github.com/vanzanden, from there transfered to R environment with code in preparingtables.R.

Examples

installedtable <- sii_plotdetails_sf16
installedtable

sii_setoption_statistics_httpfailurecounter

Description

sii_setoption_statistics_httpfailurecounter

Usage

sii_setoption_statistics_httpfailurecounter(cnt = 0)

Arguments

cnt

(default = 0) the value to be assigned to the counter

Value

nothing

Examples

# library(ggsolvencyii)
ggsolvencyii:::sii_setoption_statistics_httpfailurecounter()
ggsolvencyii:::sii_setoption_statistics_httpfailurecounter(cnt = 10)

sii_setoption_statistics_participate sets the option to participate in anonymous user statistics, no other data is sent other than the calling geom and the IP adress

Description

sii_setoption_statistics_participate sets the option to participate in anonymous user statistics, no other data is sent other than the calling geom and the IP adress

Usage

sii_setoption_statistics_participate(participate = TRUE, quiet = FALSE)

Arguments

participate

(boolean, default = TRUE) whether to participate

quiet

(boolean, default = FALSE) whether to confirm that the option is set

Value

participate

Examples

library(ggsolvencyii)
sii_setoption_statistics_participate()
sii_setoption_statistics_participate(FALSE)
sii_setoption_statistics_participate(participate = FALSE, quiet = FALSE)

sii_setoption_statistics_remind sets the option to remind that participation is set to TRUE (if that is the case) after 1,2,3,5,10,50,100,200,500,1000,1500,2500 calls

Description

sii_setoption_statistics_remind sets the option to remind that participation is set to TRUE (if that is the case) after 1,2,3,5,10,50,100,200,500,1000,1500,2500 calls

Usage

sii_setoption_statistics_remind(remind = TRUE, quiet = FALSE)

Arguments

remind

(default = TRUE) : whether to remind that participation is set

quiet

(default = FALSE) : whether to confirm that the option is set

Value

remind

Examples

library(ggsolvencyii)
sii_setoption_statistics_remind()
sii_setoption_statistics_remind(remind = FALSE)
sii_setoption_statistics_remind(remind = FALSE, quiet = TRUE)

sii_setoption_statistics_remindercounter

Description

sii_setoption_statistics_remindercounter

Usage

sii_setoption_statistics_remindercounter(cnt = 0)

Arguments

cnt

(default = 0)

Value

nothing

Examples

# library(ggsolvencyii)
ggsolvencyii:::sii_setoption_statistics_remindercounter()
ggsolvencyii:::sii_setoption_statistics_remindercounter(cnt = 10)

sii_structure_sf16_eng

Description

a standard formula structure (as of 2016), with descriptions in English.

Usage

sii_structure_sf16_eng

Format

A data frame with columns:

description

string: the name of the component

level

string with format 'level(numeric)' [<point> 'sublevel(numeric)'] ['d'] i.e. 1, 2.01, 3.1d where d indicates a diversification component

childlevel

string, same format as level, indicating the level of which the components combine into this level

Source

determined based on specification of EIOPA standard formula Solvency II structure.
made from excel-file in github.com/vanzanden, from there transfered to R environment with code in preparingtables.R.

Examples

installedtable <- sii_structure_sf16_eng
installedtable

sii_structure_sf16_nld

Description

a standard formula structure (as of 2016), with descriptions in Dutch.

Usage

sii_structure_sf16_nld

Format

A data frame with columns:

description

string: the name of the component

level

string with format 'level(numeric)' [<point> 'sublevel(numeric)'] ['d'] i.e. 1, 2.01, 3.1d where d indicates a diversification component

childlevel

string, same format as level, indicating the level of which the components combine into this level

Source

determined based on specification of EIOPA standard formula Solvency II structure.
made from excel-file in github.com/vanzanden, from there transfered to R environment with code in preparingtables.R.

Examples

installedtable <- sii_structure_sf16_nld
installedtable

sii_x_edgecolors_sf16_eng

Description

a colorset, as named list, where each risk has the edgecolor of the "motherlevel", as defined in the ..fillcolors.. variable.

Usage

sii_x_edgecolors_sf16_eng

Format

A list with items in the form "description"= "#colorcode":

Source

made with preparingtables.R (not included in this package) which can be found on github.com/vanzanden/ggsolvencyii

Examples

installedtable <- sii_x_edgecolors_sf16_eng
installedtable

sii_x_edgecolors_sf16_nld

Description

a colorset, as named list, where each risk has the edgecolor of the "motherlevel", as defined in the ..fillcolors.. variable.

Usage

sii_x_edgecolors_sf16_nld

Format

A list with items in the form "description"= "#colorcode":

Source

made with preparingtables.R (not included in this package) which can be found on github.com/vanzanden/ggsolvencyii

Examples

installedtable <- sii_x_edgecolors_sf16_nld
installedtable

sii_x_fillcolors_sf16_eng

Description

a colorset, as named list, where each accumulationlevel and each type of risk has it's own color, where ".._other" has the same color as the "motherlevel", i.e. 'market_other' has the same color as 'market' while other 'm_..' risks have a different hue.

Usage

sii_x_fillcolors_sf16_eng

Format

A list with items in the form "description"= "#colorcode":

Source

made with preparingtables.R (not included in this package) which can be found on github.com/vanzanden/ggsolvencyii

Examples

installedtable <- sii_x_fillcolors_sf16_eng
installedtable

sii_x_fillcolors_sf16_nld

Description

a colorset, as named list, where each accumulationlevel and each type of risk has it's own color, where ".._other" has the same color as the "motherlevel", i.e. 'market_other' has the same color as 'market' while other 'm_..' risks have a different hue.

Usage

sii_x_fillcolors_sf16_nld

Format

A list with items in the form "description"= "#colorcode":

Source

made with preparingtables.R (not included in this package) which can be found on github.com/vanzanden/ggsolvencyii

Examples

installedtable <- sii_x_fillcolors_sf16_nld
installedtable

sii_z_ex1_data

Description

example dataset, in tidyverse format, for the showcase of a limited structure.

Usage

sii_z_ex1_data

Format

A data frame with columns:

time

numerical: a representation of an x value:
The x aesthetic could also be a normal numbering, or a longitude

ratio

numerical: solvency II ratio, a representation of an y value:
y aesthetic could also be a lattitude

description

character: component of the structure

id

number: a grouping item

value

numerical: positive for risks, negative for diversification effects

comparewithid

numerical: a reference to the id of another datapoint

#'

Source

loosely based on public SFCR report of a medium sized dutch life insurer made from excel-file in github.com/vanzanden, from there transfered to R environment with code in preparingtables.R.

Examples

installedtable <- sii_z_ex1_data
installedtable

sii_z_ex1_edgecolors

Description

a colorset, as named list, where each risk has the edgecolor of the "motherlevel", as defined in the ..fillcolors.. variable.

Usage

sii_z_ex1_edgecolors

Format

A list with items in the form "description"= "#colorcode":

Source

made with preparingtables.R (not included in this package) which can be found on github.com/vanzanden/ggsolvencyii

Examples

installedtable <- sii_z_ex1_edgecolors
installedtable

sii_z_ex1_fillcolors

Description

a colorset, as named list, where each accumulationlevel and each type of risk has it's own color, where ".._other" has the same color as the "motherlevel", i.e. 'market_other' has the same color as 'market' while other 'm_..' risks have a different hue.

Usage

sii_z_ex1_fillcolors

Format

A list with items in the form "description"= "#colorcode":

Source

made with preparingtables.R (not included in this package) which can be found on github.com/vanzanden/ggsolvencyii

Examples

installedtable <- sii_z_ex1_fillcolors
installedtable

sii_z_ex1_levelmax

Description

maximum number of items in a level, 99 items for levels 1-3 (SCR, BSCR/OR/ADJ, Market/life/... risks) and 3 items for lower level risk (equity/longevity/...)

Usage

sii_z_ex1_levelmax

Format

A data frame with columns:

Source

made from excel-file in github.com/vanzanden, from there transfered to R environment with code in preparingtables.R.

Examples

installedtable <- sii_z_ex1_levelmax
installedtable

sii_z_ex1_plotdetails #' A table for geom_sii_risksurface and geom_sii_riskoutline indicating which outlines of each item should be shown, specified per level and/or description. the latter overrule the former.
when defining an item (or the squared = TRUE transformation) 4 lines can be distinguished, a radialline going outwards, a circle segment (clockwise), a radialline going inwards, a circle segment (counterclockwise). These are numbered as outline1 to outline4.

Description

sii_z_ex1_plotdetails #' A table for geom_sii_risksurface and geom_sii_riskoutline indicating which outlines of each item should be shown, specified per level and/or description. the latter overrule the former.
when defining an item (or the squared = TRUE transformation) 4 lines can be distinguished, a radialline going outwards, a circle segment (clockwise), a radialline going inwards, a circle segment (counterclockwise). These are numbered as outline1 to outline4.

Usage

sii_z_ex1_plotdetails

Format

A data frame with columns:

levelordescription

string with format 'level(numeric)' [<point> 'sublevel(numeric)'] ['d'] i.e. 1, 2.01, 3.1d where d indicates a diversification component AND/OR description(s) from the corresponding structure

surface

boolean (logical): the surface

outline1

boolean (logical): the radial line

outline2

boolean (logical): the outer line

outline3

boolean (logical): the radial line

outline4

boolean (logical): the inner line

outline11

NOT YET IMPLEMENTED: boolean (logical): analogue to outline1, but but only for the first plotted component of that level. The components in each level are plotted clockwise

outline13

NOT YET IMPLEMENTED: boolean (logical): analogue to outline3, but but only for the last plotted component of that level.

Source

determined based on specification of EIOPA standard formula Solvency II structure made from excel-file in github.com/vanzanden, from there transfered to R environment with code in preparingtables.R.

Examples

installedtable <- sii_z_ex1_plotdetails
installedtable

sii_z_ex1_plotdetails2 #' A table for geom_sii_risksurface and geom_sii_riskoutline indicating which outlines of each item should be shown, specified per level and/or description. the latter overrule the former.
when defining an item (or the squared = TRUE transformation) 4 lines can be distinguished, a radialline going outwards, a circle segment (clockwise), a radialline going inwards, a circle segment (counterclockwise). These are numbered as outline1 to outline4.

Description

sii_z_ex1_plotdetails2 #' A table for geom_sii_risksurface and geom_sii_riskoutline indicating which outlines of each item should be shown, specified per level and/or description. the latter overrule the former.
when defining an item (or the squared = TRUE transformation) 4 lines can be distinguished, a radialline going outwards, a circle segment (clockwise), a radialline going inwards, a circle segment (counterclockwise). These are numbered as outline1 to outline4.

Usage

sii_z_ex1_plotdetails2

Format

A data frame with columns:

levelordescription

string with format 'level(numeric)' [<point> 'sublevel(numeric)'] ['d'] i.e. 1, 2.01, 3.1d where d indicates a diversification component AND/OR description(s) from the corresponding structure

surface

boolean (logical): the surface

outline1

boolean (logical): the radial line

outline2

boolean (logical): the outer line

outline3

boolean (logical): the radial line

outline4

boolean (logical): the inner line

outline11

NOT YET IMPLEMENTED: boolean (logical): analogue to outline1, but but only for the first plotted component of that level. The components in each level are plotted clockwise

outline13

NOT YET IMPLEMENTED: boolean (logical): analogue to outline3, but but only for the last plotted component of that level.

Source

determined based on specification of EIOPA standard formula Solvency II structure made from excel-file in github.com/vanzanden, from there transfered to R environment with code in preparingtables.R.

Examples

installedtable <- sii_z_ex1_plotdetails2
installedtable

sii_z_ex1_structure

Description

a adapted (compact) structure, for a life-insurer with only market and life risk and their subrisks

Usage

sii_z_ex1_structure

Format

A data frame with columns:

description

string: the name of the component, or a diversification

level

string with format 'level(numeric)' [<point> 'sublevel(numeric)'] ['d'] i.e. 1, 2.01, 3.1d where d indicates a diversification component

childlevel

string of the same format as level, indicating the level of which the components make up this item

Source

determined based on specification of EIOPA standard formula Solvency II structure made from excel-file in github.com/vanzanden, from there transfered to R environment with code in preparingtables.R.

Examples

installedtable <- sii_z_ex1_structure
installedtable

sii_z_ex2_data

Description

example dataset, in tidyverse format, with only one instance of a limited filled sf structure.

Usage

sii_z_ex2_data

Format

A data frame with columns:

time

numerical: a representation of an x value:
The x aesthetic could also be a normal numbering, or a longitude

ratio

numerical: solvency II ratio, a representation of an y value:
y aesthetic could also be a lattitude

description

character: component of the structure

id

number: a grouping item

value

numerical: positive for risks, negative for diversification effects

Source

loosely based on public SFCR report of a medium sized dutch life insurer made from excel-file in github.com/vanzanden, from there transfered to R environment with code in preparingtables.R.

Examples

installedtable <- sii_z_ex2_data
installedtable

sii_z_ex3_data

Description

example dataset, in tidyverse format, with all columns of the complete SF16 structure present in the data but with only a few risks filled with non-zero values,

Usage

sii_z_ex3_data

Format

A data frame with columns:

time

numerical: a representation of an x value:
The x aesthetic could also be a normal numbering, or a longitude

ratio

numerical: solvency II ratio, a representation of an y value:
y aesthetic could also be a lattitude

description

character: component of the structure

id

number: a grouping item

value

numerical: positive for risks, negative for diversification effects

comparewithid

numerical: a reference to the id of another datapoint

Source

loosely based on public SFCR report of a medium sized dutch life insurer made from excel-file in github.com/vanzanden, from there transfered to R environment with code in preparingtables.R.

Examples

installedtable <- sii_z_ex3_data
installedtable

sii_z_ex3_plotdetails #' A table for geom_sii_risksurface and geom_sii_riskoutline indicating which outlines of each item should be shown, specified per level and/or description. the latter overrule the former.
when defining an item (or the squared = TRUE transformation) 4 lines can be distinguished, a radialline going outwards, a circle segment (clockwise), a radialline going inwards, a circle segment (counterclockwise). These are numbered as outline1 to outline4.

Description

sii_z_ex3_plotdetails #' A table for geom_sii_risksurface and geom_sii_riskoutline indicating which outlines of each item should be shown, specified per level and/or description. the latter overrule the former.
when defining an item (or the squared = TRUE transformation) 4 lines can be distinguished, a radialline going outwards, a circle segment (clockwise), a radialline going inwards, a circle segment (counterclockwise). These are numbered as outline1 to outline4.

Usage

sii_z_ex3_plotdetails

Format

A data frame with columns:

levelordescription

string with format 'level(numeric)' [<point> 'sublevel(numeric)'] ['d'] i.e. 1, 2.01, 3.1d where d indicates a diversification component AND/OR description(s) from the corresponding structure

surface

boolean (logical): the surface

outline1

boolean (logical): the radial line

outline2

boolean (logical): the outer line

outline3

boolean (logical): the radial line

outline4

boolean (logical): the inner line

outline11

NOT YET IMPLEMENTED: boolean (logical): analogue to outline1, but but only for the first plotted component of that level. The components in each level are plotted clockwise

outline13

NOT YET IMPLEMENTED: boolean (logical): analogue to outline3, but but only for the last plotted component of that level.

Source

determined based on specification of EIOPA standard formula Solvency II structure made from excel-file in github.com/vanzanden, from there transfered to R environment with code in preparingtables.R.

Examples

installedtable <- sii_z_ex3_plotdetails
installedtable

sii_z_ex4_data

Description

example dataset, in tidyverse format, with several instances of a filled sf structure,

Usage

sii_z_ex4_data

Format

A data frame with columns:

time

numerical: a representation of an x value:
The x aesthetic could also be a normal numbering, or a longitude

ratio

numerical: solvency II ratio, a representation of an y value:
y aesthetic could also be a lattitude

description

character: component of the structure

id

number: a grouping item

value

numerical: positive for risks, negative for diversification effects

comparewithid

numerical: a reference to the id of another datapoint

#'

Source

based on public SFCR 2017 reports of a medium sized dutch life insurer in Oosterhout made from excel-file in github.com/vanzanden, from there transfered to R environment with code in preparingtables.R.

Examples

installedtable <- sii_z_ex4_data
installedtable

sii_z_ex4_levelmax

Description

maximum number of items in a level, 99 items for levels 1-3 (SCR, BSCR/OR/ADJ, Market/life/... risks) and 3 items for lower level risk (equity/longevity/...)

Usage

sii_z_ex4_levelmax

Format

A data frame with columns:

Source

made from excel-file in github.com/vanzanden, from there transfered to R environment with code in preparingtables.R.

Examples

installedtable <- sii_z_ex4_levelmax
installedtable

sii_z_ex4_structure

Description

a adapted (compact) structure with no division of market, life, .. risks in subrisks (i.e. equity, longevity,... ). Descriptions are in English

Usage

sii_z_ex4_structure

Format

A data frame with columns:

description

string: the name of the component, or a diversification

level

string with format 'level(numeric)' [<point> 'sublevel(numeric)'] ['d'] i.e. 1, 2.01, 3.1d where d indicates a diversification component

childlevel

string of the same format as level, indicating the level of which the components make up this item

Source

determined based on specification of EIOPA standard formula Solvency II structure made from excel-file in github.com/vanzanden, from there transfered to R environment with code in preparingtables.R.

Examples

installedtable <- sii_z_ex4_structure
installedtable

sii_z_ex6_data

Description

example dataset of a internal model of a large Dutch insurer (NN group). Values are fictious

Usage

sii_z_ex6_data

Format

A data frame with columns:

time

numerical: a representation of an x value:
The x aesthetic could also be a normal numbering, or a longitude

ratio

numerical: solvency II ratio, a representation of an y value:
y aesthetic could also be a lattitude

description

character: component of the structure

id

number: a grouping item

value

numerical: positive for risks, negative for diversification effects

comparewithid

numerical: a reference to the id of another datapoint

Source

the structure is based on public SFCR 2017 report of NN group, with a possible wrong interpretation of diversification effects towards 'market basis and CPD risk'
#' See preview.tinyurl.com/ggsolvencyii-001, page 33 linking to www.nn-group.com /nn-group /file?uuid=e3e89829 -e7bd -495a -9fed -4bc54a9349eb&owner =c5df72fd -8a65 -4f75 -956d -5e37307aa50c &contentid =2311
made from excel-file in github.com/vanzanden, from there transfered to R environment with code in preparingtables.R in the same directory.

Examples

installedtable <- sii_z_ex6_data
installedtable

sii_z_ex6_data2

Description

example dataset of a internal model of a large Dutch insurer (NN group). Values are fictious.
To show 'counterparty default risk (CPD)' separate from the two components 'type 1' and 'type 2' the following assumption is made: The (fictious) diversification towards the higher level from CPD risk is transferred to a position between CPD and its two components. A similar approach is used to show 'business risk', 'life risk', 'morbidity risk' and 'non-life risk' and their (7,4,4 and 4) components

Usage

sii_z_ex6_data2

Format

A data frame with columns:

time

numerical: a representation of an x value:
The x aesthetic could also be a normal numbering, or a longitude

ratio

numerical: solvency II ratio, a representation of an y value:
y aesthetic could also be a lattitude

description

character: component of the structure

id

number: a grouping item

value

numerical: positive for risks, negative for diversification effects

comparewithid

numerical: a reference to the id of another datapoint

#'

Source

the structure is based on public SFCR 2017 report of NN group, with a possible wrong interpretation of diversification effects towards 'market basis and CPD risk'
#' See preview.tinyurl.com/ggsolvencyii-001, page 33 linking to www.nn-group.com/ nn-group/file? uuid=e3e89829 -e7bd -495a -9fed -4bc54a9349eb&owner =c5df72fd -8a65 -4f75 -956d -5e37307aa50c &contentid =2311 made from excel-file in github.com/vanzanden, from there transfered to R environment with code in preparingtables.R in the same directory.

Examples

installedtable <- sii_z_ex6_data2
installedtable

sii_z_ex6_edgecolors

Description

a colorset, as named list, where each risk has the edgecolor of the "motherlevel", as defined in the ..fillcolors.. variable.

Usage

sii_z_ex6_edgecolors

Format

A list with items in the form "description"= "#colorcode":

Source

made with preparingtables.R (not included in this package) which can be found on github.com/vanzanden/ggsolvencyii

Examples

installedtable <- sii_z_ex6_edgecolors
installedtable

sii_z_ex6_fillcolors

Description

a colorset, as named list, where each accumulation-level and each type of risk has it's own color, where ".._other" has the same color as the "motherlevel", i.e. 'market_other' has the same color as 'market' while other 'm_..' risks have a different hue.

Usage

sii_z_ex6_fillcolors

Format

A list with items in the form "description"= "#colorcode":

Source

made with preparingtables.R (not included in this package) which can be found on github.com/vanzanden/ggsolvencyii

Examples

installedtable <- sii_z_ex6_fillcolors
installedtable

sii_z_ex6_levelmax

Description

maximum number of items in a level, 99 items for levels 1-3 (SCR, BSCR/OR/ADJ, Market/life/... risks) and 3 items for lower level risk (equity/longevity/...)

Usage

sii_z_ex6_levelmax

Format

A data frame with columns:

Source

made from excel-file in github.com/vanzanden, from there transfered to R environment with code in preparingtables.R.

Examples

installedtable <- sii_z_ex6_levelmax
installedtable

sii_z_ex6_plotdetails #' A table for geom_sii_risksurface and geom_sii_riskoutline indicating which outlines of each item should be shown, specified per level and/or description. the latter overrule the former.
when defining an item (or the squared = TRUE transformation) 4 lines can be distinguished, a radialline going outwards, a circle segment (clockwise), a radialline going inwards, a circle segment (counterclockwise). These are numbered as outline1 to outline4.

Description

sii_z_ex6_plotdetails #' A table for geom_sii_risksurface and geom_sii_riskoutline indicating which outlines of each item should be shown, specified per level and/or description. the latter overrule the former.
when defining an item (or the squared = TRUE transformation) 4 lines can be distinguished, a radialline going outwards, a circle segment (clockwise), a radialline going inwards, a circle segment (counterclockwise). These are numbered as outline1 to outline4.

Usage

sii_z_ex6_plotdetails

Format

A data frame with columns:

levelordescription

string with format 'level(numeric)' [<point> 'sublevel(numeric)'] ['d'] i.e. 1, 2.01, 3.1d where d indicates a diversification component AND/OR description(s) from the corresponding structure

surface

boolean (logical): the surface

outline1

boolean (logical): the radial line

outline2

boolean (logical): the outer line

outline3

boolean (logical): the radial line

outline4

boolean (logical): the inner line

outline11

NOT YET IMPLEMENTED: boolean (logical): analogue to outline1, but but only for the first plotted component of that level. The components in each level are plotted clockwise

outline13

NOT YET IMPLEMENTED: boolean (logical): analogue to outline3, but but only for the last plotted component of that level.

Source

determined based on specification of EIOPA standard formula Solvency II structure made from excel-file in github.com/vanzanden, from there transfered to R environment with code in preparingtables.R.

Examples

installedtable <- sii_z_ex6_plotdetails
installedtable

sii_z_ex6_structure

Description

a standard formula structure (as of 2016), with descriptions in English.

Usage

sii_z_ex6_structure

Format

A data frame with columns:

description

string: the name of the component

level

string with format 'level(numeric)' [<point> 'sublevel(numeric)'] ['d'] i.e. 1, 2.01, 3.1d where d indicates a diversification component

childlevel

string, same format as level, indicating the level of which the components combine into this level

Source

determined based on specification of EIOPA standard formula Solvency II structure.
made from excel-file in github.com/vanzanden, from there transfered to R environment with code in preparingtables.R.

Examples

installedtable <- sii_z_ex6_structure
installedtable

sii_z_ex7_data

Description

example dataset, in tidyverse format, with all columns of the complete SF16 structure present in the data but with only a few risks filled with non-zero values,

Usage

sii_z_ex7_data

Format

A data frame with columns:

tijd

numerical: a representation of an x value:
The x aesthetic could also be a normal numbering, or a longitude

ratio

numerical: solvency II ratio, a representation of an y value:
y aesthetic could also be a lattitude

description

character: component of the structure

id

number: a grouping item

waarde

numerical: positive for risks, negative for diversification effects

vergelijkmet

numerical: a reference to the id of another datapoint

#'

Source

loosely based on public SFCR report of a medium sized dutch life insurer made from excel-file in github.com/vanzanden, from there transfered to R environment with code in preparingtables.R.

Examples

installedtable <- sii_z_ex7_data
installedtable

sii_z_ex7_plotdetails #' A table for geom_sii_risksurface and geom_sii_riskoutline indicating which outlines of each item should be shown, specified per level and/or description. the latter overrule the former.
when defining an item (or the squared = TRUE transformation) 4 lines can be distinguished, a radialline going outwards, a circle segment (clockwise), a radialline going inwards, a circle segment (counterclockwise). These are numbered as outline1 to outline4.

Description

sii_z_ex7_plotdetails #' A table for geom_sii_risksurface and geom_sii_riskoutline indicating which outlines of each item should be shown, specified per level and/or description. the latter overrule the former.
when defining an item (or the squared = TRUE transformation) 4 lines can be distinguished, a radialline going outwards, a circle segment (clockwise), a radialline going inwards, a circle segment (counterclockwise). These are numbered as outline1 to outline4.

Usage

sii_z_ex7_plotdetails

Format

A data frame with columns:

levelordescription

string with format 'level(numeric)' [<point> 'sublevel(numeric)'] ['d'] i.e. 1, 2.01, 3.1d where d indicates a diversification component AND/OR description(s) from the corresponding structure

surface

boolean (logical): the surface

outline1

boolean (logical): the radial line

outline2

boolean (logical): the outer line

outline3

boolean (logical): the radial line

outline4

boolean (logical): the inner line

outline11

NOT YET IMPLEMENTED: boolean (logical): analogue to outline1, but but only for the first plotted component of that level. The components in each level are plotted clockwise

outline13

NOT YET IMPLEMENTED: boolean (logical): analogue to outline3, but but only for the last plotted component of that level.

Source

determined based on specification of EIOPA standard formula Solvency II structure made from excel-file in github.com/vanzanden, from there transfered to R environment with code in preparingtables.R.

Examples

installedtable <- sii_z_ex7_plotdetails
installedtable

stat_sii_risksurface

Description

returns a 'ggplot2' object with filled, concentric circle(part)s, defined by the values of a hierarchy of levels.

Usage

stat_sii_risksurface(mapping = NULL, data = NULL,
  geom = "sii_risksurface", position = "identity",
  show.legend = TRUE, inherit.aes = TRUE, na.rm = FALSE,
  levelmax = 99, structure = ggsolvencyii::sii_structure_sf16_eng,
  maxscrvalue = NULL, aggregatesuffix = "_other", scalingx = 1,
  scalingy = 1, rotationdegrees = NULL, rotationdescription = NULL,
  squared = FALSE, plotdetails = NULL, ...)

Arguments

mapping

required aes(thetics) : x (i.e. time, longitude), y (i.e SCR ratio, lattitude), id, description (), value

data

the dataset in tidyverse format (column 'description' as a factor). see examples in sii_z_ex2_data or sii_z_ex3_data

geom

the default is geom_sii_risksurface

position

standard ggplot function

show.legend

standard ggplot function

inherit.aes

standard ggplot function

na.rm

standard ggplot function

levelmax

(integer or dataframe, default = 99)
a positive integer or a dataframe with columns 'level' and 'levelmax'.
The maximum amount of items in a certain level to be plotted. The smallest items are combined to one item. In the case level consisting of 7 items has a levelmax of 5 this results in 4 separate items and one grouped item.
For a less detailed plot sii_levelmax_sf16_995 and sii_levelmax_sf16_993 are present in the package where the components of market, life, non-life, health are combined in 5 or 3 items.

structure

(dataframe: default = sii_structure_sf16_eng)
A representation of the buildup from individual risks to the SCR. columns are

  1. description (chr),

  2. level (chr),

  3. childlevel (chr)

. In the standard formula structure, SCR has level 1, with childlevel 2. This means it consists of all datalines with level == 2, ie. "BSCR", "operational" and "Adjustment-LACDT". lines in the dataset with a suffix "d" behind the levelnumber are diversification items. As of now these are not used in any calculation. the values in column "description" in the dataset need to match the description in this file. The package contains also a file sii_structure_sf16_nld with Dutch terms in description column.

maxscrvalue

(optional, double, default = NULL)
the scale of the different plot elements is is by default measured to the largest level 1 element (i.e. SCR) in the dataset, this can be overridden by this parameter for example when combining several plots

aggregatesuffix

(string, default = "_other")
When a certain level contains more items than specified by levelmax the smallest items are combined. The description is of the name of the one higher level (lower number) with a suffix

scalingx

(optional, positive value ,default = 1)
for plots where units in x and y are different in magnitude distortion can occur. This parameter scales only in x-direction

scalingy

(optional, positive value ,default = 1)
for plots where units in x and y are different in magnitude distortion can occur. This parameter scales only in y-direction

rotationdegrees

(optional, integer, -360 to 360, default = NULL)
when given, the fixed amount of degrees (positive is clockwise) of which each item is rotated (as in a compass, -90 is a quarter rotation anti-clockwise), additive to possible rotation to description

rotationdescription

(optional, string, default = NULL)
default the orientation of the lower level (higher number) circles is based on the structure. When this parameter is not NULL then the circles are rotated in such a way that the indicated item lies in the "north-east" part of the circle.

squared

(optional, boolean, default = FALSE)
when set to TRUE plot returns a square representation. Compared with a circle representation of the same data the height and width of the square are smaller than the radius of the circle. Segments which fall in the corner parts of the square are smaller than equally sized part which fall in the vertical or horizontal parts of the square.

plotdetails

(optional) a table with columns 'levelordescription' and 'surface', indicating which circle elements to plot. When no table is provided all segments are plotted. example 3 shows how to combine geom_sii_risksurface and geom_sii_riskoutline by using using table sii_z_ex3_plotdetails. geom_sii_riskoutline uses other columns in the same table

...

ellipsis, a standard R parameter

Value

a ggplot object


statistics

Description

This behaviour can be switched off by means of calling " " When switche on a reminder is given in regular intervals. This behaviour can also be switched off by calling " "

Usage

statistics(caller = "stat_usage.csv")

Arguments

caller

(default = "stat_usage.csv") the filename which will be downloaded, for each geom is a separate file available

Value

nothing

Examples

# library(ggsolvencyii)
ggsolvencyii:::statistics()
sii_setoption_statistics_httpfailurecounter <- function(cnt = 52)
ggsolvencyii:::statistics(caller = "404notfound.csv")
sii_setoption_statistics_httpfailurecounter <- function(cnt = 0)
sii_setoption_statistics_participate(participate = TRUE)