Takes an object produced by univariate_all()
, and plots the available input.
# S3 method for univ_all
autoplot(
x,
show_plots = c(1, 2, 3, 4),
ncol = 1,
background = TRUE,
labels = TRUE,
sort = FALSE,
dec.mark = ",",
color = "dodgerblue",
color_bg = "#E7B800"
)
univ_all object produced by univariate_all()
numeric vector of plots to be shown (default is c(1,2,3,4)), there are six available plots:
1. frequency (i.e. number of claims / expsore)
2. average severity (i.e. severity / number of claims)
3. risk premium (i.e. severity / exposure)
4. loss ratio (i.e. severity / premium)
5. average premium (i.e. premium / exposure)
6. exposure
number of columns in output (default is 1)
show exposure as a background histogram (default is TRUE)
show labels with the exposure (default is TRUE)
sort (or order) risk factor into descending order by exposure (default is FALSE)
control the format of the decimal point, as well as the mark between intervals before the decimal point, choose either "," (default) or "."
change the color of the points and line ("dodgerblue" is default)
change the color of the histogram ("#E7B800" is default)
a ggplot2 object
# NOT RUN {
library(ggplot2)
x <- univariate_all(MTPL2, x = area, severity = amount, nclaims = nclaims, exposure = exposure)
autoplot(x)
autoplot(x, show_plots = c(6,1), background = FALSE, sort = TRUE)
# }
Run the code above in your browser using DataLab