plot_weights {SWIM} | R Documentation |
Plotting the scenario weights of a Stressed Model
Description
Plots the scenario weights of a stressed model against a model component.
Usage
plot_weights(
object,
xCol = 1,
wCol = "all",
n,
x_limits,
y_limits,
displ = TRUE
)
Arguments
object |
A |
xCol |
Numeric or character, (name of) the column of the underlying data
of the |
wCol |
Vector, the columns of the scenario weights
of the |
n |
Integer, the number of points used to plot
( |
x_limits |
Vector, the limits of the x-axis of the plot, the
value for |
y_limits |
Vector, the limits of the y-axis of the plot, the
value for |
displ |
Logical, if |
Value
If displ = TRUE
, a plot displaying the scenario
weights of a stochastic model against a model component.
If displ = FALSE
, a data.frame for customised plotting with
ggplot
. The data.frame contains the following columns:
grid
, the grid points to plot the quantiles,
stress
(the stresses) and value
(the quantile values).
Denote by res
the return of the function call, then
ggplot
can be called via:
ggplot(res, aes(x = res[ ,1], y = value))
+ geom_lines(aes(color = factor(stress))).
See Also
See plot_quantile
for plotting sample quantiles of a
stressed model and plot_cdf
for plotting empirical
distribution functions.
Examples
## example with a stress with \code{credit_data} data set:
data("credit_data")
## two stresses in VaR
model_stress <- stress_VaR(credit_data, alpha = c(0.9, 0.95), q_ratio = 1.1, k =1)
plot_weights(model_stress, xCol = "L", wCol = 1:2)
## additional stress on VaR and ES
model_stress <- stress_VaR_ES(model_stress, alpha = 0.9, q_ratio = 1.1, s_ratio = 1.2, k =1)
plot_weights(model_stress, xCol = "L", wCol = "all", n = 1000, x_limits = c(0, 3500),
y_limits = c(0, 10))