`R/plot_functions.R`

`plot_prob.Rd`

This function is used to apply the graphical technique of probability
plotting. It is either applied to the output of estimate_cdf
(`plot_prob.wt_cdf_estimation`

) or to the output of a mixture model from
mixmod_regression / mixmod_em (`plot_prob.wt_model`

). Note that in the
latter case no distribution has to be specified because it is inferred from
the model.

```
plot_prob(x, ...)
# S3 method for wt_cdf_estimation
plot_prob(
x,
distribution = c("weibull", "lognormal", "loglogistic", "sev", "normal", "logistic",
"exponential"),
title_main = "Probability Plot",
title_x = "Characteristic",
title_y = "Unreliability",
title_trace = "Sample",
plot_method = c("plotly", "ggplot2"),
...
)
# S3 method for wt_model
plot_prob(
x,
title_main = "Probability Plot",
title_x = "Characteristic",
title_y = "Unreliability",
title_trace = "Sample",
plot_method = c("plotly", "ggplot2"),
...
)
```

- x
A tibble with class

`wt_cdf_estimation`

returned by estimate_cdf or a list with class`wt_model`

returned by rank_regression, ml_estimation, mixmod_regression or mixmod_em.- ...
Further arguments passed to or from other methods. Currently not used.

- distribution
Supposed distribution of the random variable.

- title_main
A character string which is assigned to the main title.

- title_x
A character string which is assigned to the title of the x axis.

- title_y
A character string which is assigned to the title of the y axis.

- title_trace
A character string which is assigned to the legend trace.

- plot_method
Package, which is used for generating the plot output.

A plot object containing the probability plot.

If `x`

was split by mixmod_em, estimate_cdf with method `"johnson"`

is
applied to subgroup-specific data. The calculated plotting positions are
shaped according to the determined split in mixmod_em.

In mixmod_regression a maximum of three subgroups can be determined and thus being plotted. The intention of this function is to give the user a hint for the existence of a mixture model. An in-depth analysis should be done afterwards.

For `plot_method == "plotly"`

the marker label for x and y are determined by
the first word provided in the argument `title_x`

and `title_y`

respectively,
i.e. if `title_x = "Mileage in km"`

the x label of the marker is "Mileage".
The name of the legend entry is a combination of the `title_trace`

and the
number of determined subgroups (if any). If `title_trace = "Group"`

and the
data has been split in two groups, the legend entries are "Group: 1" and
"Group: 2".

Meeker, William Q; Escobar, Luis A., Statistical methods for reliability data, New York: Wiley series in probability and statistics, 1998

```
# Reliability data:
data <- reliability_data(
alloy,
x = cycles,
status = status
)
# Probability estimation:
prob_tbl <- estimate_cdf(
data,
methods = c("johnson", "kaplan")
)
# Example 1 - Probability Plot Weibull:
plot_weibull <- plot_prob(prob_tbl)
# Example 2 - Probability Plot Lognormal:
plot_lognormal <- plot_prob(
x = prob_tbl,
distribution = "lognormal"
)
## Mixture identification
# Reliability data:
data_mix <- reliability_data(
voltage,
x = hours,
status = status
)
prob_mix <- estimate_cdf(
data_mix,
methods = c("johnson", "kaplan")
)
# Example 3 - Mixture identification using mixmod_regression:
mix_mod_rr <- mixmod_regression(prob_mix)
plot_mix_mod_rr <- plot_prob(x = mix_mod_rr)
# Example 4 - Mixture identification using mixmod_em:
mix_mod_em <- mixmod_em(data_mix)
plot_mix_mod_em <- plot_prob(x = mix_mod_em)
```