View source: R/check_weibull.R
check_weibull | R Documentation |
The weibull distribution is a generalization of the exponential distribution
It's often used to study "time-to-failure", where it gives a failure rate
proportional to a power of time (see https://en.wikipedia.org/wiki/Weibull_distribution).
check_weibull
takes in a data frame and returns a function for making
a CDF plot and a variant of CCDF plot on a log-log scale side by side on one
canvas of any continuous variable from the data frame. CCDF standands for
Complement CDF. If the -logCCDF on a log-log scale is a straight line, the
observed data follows a weibull distribution with the shape parameter
k = slope and the location parameter lambda = e^(-intercept / k).
check_weibull(df)
df |
A data frame. |
function(varname, linew = 0.7, xlab = varname, title_left, title_right,
subtitle_left, subtitle_right, caption_left, caption_right,
digits = 2, ...)
varname. String, name of a continuous variable. Its empirical CDF will be plotted along side its complement CDF.
linew. Number, width of the line. Default = 0.7.
xlab. String, x label of the left and the right figures. Default is varname.
title_left. String, title of the left figure.
title_right. String, title of the right figure.
subtitle_left. String, subtitle of the left figure.
subtitle_right. String, subtitle of the right figure.
caption_left. String, caption of the left figure.
caption_right. String, caption of the right figure.
digits. Integer, the number of digits after the decimal point for the estimated parameter values of the theoretical distribution. Default = 2.
.... Other parameters for making a CDF plot. A common one, for
example, is 'add_vline_median = TRUE', which will add a vertical line at
the median. Another common one is 'show_label_median = FALSE', which
will suppress the display of median value along the median vline. See
mk_cdfplot
for a full list of parameters.
est_params_weibull
for how the parameters of the
theoretical weibull distribution are estimated.
inst/examples/ex-check_weibull.R
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.