This function adds one (or multiple) linearized CDF(s) to an existing plot grid.
A plot object to which the population line(s) is (are) added or
NULL
. If NULL
the population line(s) is (are) plotted in an empty grid.
A numeric vector of length two or greater used for the x coordinates
of the population line. If length(x) == 2
a sequence of length 200 between
x[1]
and x[2]
is created. This sequence is equidistant with respect to the
scale of the x axis. If length(x) > 2
the elements of x
are the x
coordinates of the population line.
A data.frame
. See 'Details'.
Supposed distribution of the random variable. The distinction
between a threshold distribution and the respective standard variant is made with
dist_params_tbl
.
The failure probability is restricted to the interval
\([tol, 1 - tol]\). The default value is in accordance with the decimal
places shown in the hover for plot_method = "plotly"
.
A character string which is assigned to the legend trace.
Package, which is used for generating the plot output. Only
used when p_obj = NULL
. If p_obj != NULL
the plot object is used to
determine the plot method.
A plot object containing the linearized CDF(s).
dist_params_tbl
is a data.frame
with parameter columns. An overview of the
distribution-specific parameters and their order can be found in section
'Distributions'.
If only one population line should be displayed, a numeric vector is also supported. The order of the vector elements also corresponds to the table in section 'Distributions'.
The following table summarizes the available distributions and their parameters
location parameter \(\mu\),
scale parameter \(\sigma\) or \(\theta\) and
threshold parameter \(\gamma\).
The column order within dist_params_tbl
is given in the table header.
distribution | dist_params_tbl[1] | dist_params_tbl[2] | dist_params_tbl[3] |
"sev" | \(\mu\) | \(\sigma\) | - |
"weibull" | \(\mu\) | \(\sigma\) | (\(\gamma\)) |
"normal" | \(\mu\) | \(\sigma\) | - |
"lognormal" | \(\mu\) | \(\sigma\) | (\(\gamma\)) |
"logistic" | \(\mu\) | \(\sigma\) | - |
"loglogistic" | \(\mu\) | \(\sigma\) | (\(\gamma\)) |
"exponential" | \(\theta\) | (\(\gamma\)) | - |
x <- rweibull(n = 100, shape = 1, scale = 20000)
# Example 1 - Two-parametric straight line:
pop_weibull <- plot_pop(
p_obj = NULL,
x = range(x),
dist_params_tbl = c(log(20000), 1),
distribution = "weibull"
)
# Example 2 - Three-parametric curved line:
x2 <- rweibull(n = 100, shape = 1, scale = 20000) + 5000
pop_weibull_2 <- plot_pop(
p_obj = NULL,
x = x2,
dist_params_tbl = c(log(20000 - 5000), 1, 5000),
distribution = "weibull"
)
# Example 3 - Multiple lines:
pop_weibull_3 <- plot_pop(
p_obj = NULL,
x = x,
dist_params_tbl = data.frame(
p_1 = c(log(20000), log(20000), log(20000)),
p_2 = c(1, 1.5, 2)
),
distribution = "weibull",
plot_method = "ggplot2"
)
# Example 4 - Compare two- and three-parametric distributions:
pop_weibull_4 <- plot_pop(
p_obj = NULL,
x = x,
dist_params_tbl = data.frame(
param_1 = c(log(20000), log(20000)),
param_2 = c(1, 1),
param_3 = c(NA, 2)
),
distribution = "weibull"
)