plot_expirest_wisle {expirest} | R Documentation |
Illustrating the what-if (approach for) shelf life estimate (wisle)
Description
The function plot_expirest_wisle()
makes a graphical display of the
shelf life estimate done by the expirest_wisle()
function.
Usage
plot_expirest_wisle(
model,
rl_index = 1,
show_grouping = "yes",
response_vbl_unit = NULL,
x_range = NULL,
y_range = NULL,
scenario = "standard",
mtbs = "verified",
plot_option = "full",
ci_app = "line"
)
Arguments
model |
An ‘ |
rl_index |
A positive integer that specifies which of the release limit
values that have been handed over to |
show_grouping |
'r lifecycle::badge("deprecated")'
'show_grouping = \"yes\" or \"no\"' is no longer supported. Use the
|
response_vbl_unit |
A character string that specifies the unit
associated with the response variable. The default is |
x_range |
A numeric vector of the form |
y_range |
A numeric vector of the form |
scenario |
A character string that specifies if the plot should be
extended (with respect to the |
mtbs |
A character string that specifies the “model to be shown”,
i.e. either |
plot_option |
A character string of either |
ci_app |
A character string of either |
Details
The function plot_expirest_wisle()
uses the data and the
information about the linear model that was used for the estimation of
the shelf life by aid of the expirest_wisle()
function. It
plots a graph of the time course of a parameter, a linear regression line
fitted to the data and the associated confidence or prediction interval.
In addition, it shows features of the worst case scenario shelf life
estimation.
For plotting, the ggplot()
function from the
‘ggplot2
’ package is used. The various arguments can be
used to control the appearance of the plot. The ‘ggplot2
’
object of the generated plot is contained in the Graph
element of
the list that is returned by plot_expirest_wisle()
and can be
used to modify the appearance of the graph.
Value
An object of class ‘plot_expirest_wisle
’ is returned
invisibly consisting of the following elements:
Model |
The ‘ |
Expiery |
A data frame of type |
Graph |
A ‘ |
Prediction |
A data frame of the predicted values. |
text |
A data frame of the text elements on the plot. |
hlines |
A data frame of the horizontal line elements on the plot. |
vlines |
A data frame of the vertical line elements on the plot. |
segments |
A data frame of segment line elements on the plot. |
arrow |
A data frame of arrow elements on the plot. |
See Also
expirest_wisle
, expirest_osle
,
plot_expirest_osle
.
Examples
# Start by making a "what-if (approach for) shelf life estimation" (wisle)
res1 <-
expirest_wisle(data = exp1[exp1$Batch %in% c("b2", "b5", "b7"), ],
response_vbl = "Potency", time_vbl = "Month",
batch_vbl = "Batch", rl = 98, rl_sf = 3, sl = 95,
sl_sf = 3, srch_range = c(0, 500), sf_option = "loose")
# Pass the 'expirest_wisle' object on to the plot_expirest_wisle() function.
# This function does not produce any output. It returns a 'plot_expirest_wisle'
# object that is essentially an 'expirest_wisle' object augmented by a 'ggplot'
# object.
gg1 <- plot_expirest_wisle(
model = res1, rl_index = 1, response_vbl_unit = "%", x_range = NULL,
y_range = c(93, 105), scenario = "standard", mtbs = "verified",
plot_option = "full", ci_app = "line")
## Not run:
gg1
# Since the element gg1$Graph is a 'ggplot' object it can be used for further
# manipulation by aid of 'ggplot2' functions.
if (requireNamespace("ggplot2")) {
library(ggplot2)
gg1$Graph + labs(title = "What-if Shelf Life Estimation (WISLE)",
x = "Time [months]", y = "Potency [% LC]") +
scale_x_continuous(limits = c(-5, 31), breaks = seq(0, 30, 6))
}
## End(Not run)
# Repeat this for a different intercept / different slope (dids) model.
res2 <-
expirest_wisle(data = exp1[exp1$Batch %in% c("b4", "b5", "b8"), ],
response_vbl = "Potency", time_vbl = "Month",
batch_vbl = "Batch", rl = 98, rl_sf = 3, sl = 95,
sl_sf = 3, srch_range = c(0, 500), sf_option = "loose")
gg2 <- plot_expirest_wisle(
model = res2, rl_index = 1, response_vbl_unit = "%", x_range = c(0, 26),
y_range = c(89, 107), scenario = "standard", mtbs = "verified",
plot_option = "full", ci_app = "ribbon")
## Not run:
gg2
## End(Not run)
# In case of different intercept / different slope models, individually fit
# linear models are shown by default, i.e. with the 'mtbs' parameter set
# as "verified". To get the different intercept / different slope model
# displayed where the mean square error is pooled across batches, i.e. the
# dids.pmse model, the 'mtbs' parameter has to be set accordingly.
gg3 <- plot_expirest_wisle(
model = res2, rl_index = 1, response_vbl_unit = "%", x_range = c(0, 26),
y_range = c(89, 107), scenario = "standard", mtbs = "dids.pmse",
plot_option = "full", ci_app = "ribbon")
## Not run:
gg3
## End(Not run)