Learn R Programming

expirest (version 0.1.6)

get_text_annotation: Prepare text annotation

Description

The function get_text_annotation() prepares a data frame for putting text on a plot prepared by the ggplot() function from the ‘ggplot2’ package.

Usage

get_text_annotation(
  model,
  rvu,
  x_range,
  y_range,
  rl_index = NULL,
  plot_option = "full",
  mtbs = "verified"
)

Value

A data frame with the columns ‘Time’, ‘Response’, Label and Colour is returned, where the column names ‘Time’ and ‘Response’ are placeholders for the corresponding variable names. If model is an ‘expirest_osle’ object, the data frame has up to three rows representing the relevant specification limit(s) (row 1 or rows 1 and 2) and the POI obtained from ordinary shelf life estimation (row 2 or 3). If model is an ‘expirest_wisle’ object, the data frame has up to seven rows representing the relevant specification limit(s), the worst case scenario limit (row 2 or 3), the intercept (row 3 or 4), the POI of the worst case scenario model (row 4 or 5), the POI obtained from ordinary shelf life estimation (row 5 or 6) and the release limit (row 6 or 7).

Arguments

model

An ‘expirest_osle’ or an ‘expirest_Wisle’ object, i.e. a list returned by the expirest_osle() or by the expirest_wisle() function.

rvu

A character string that specifies the unit associated with the response variable.

x_range

A numeric vector of the form c(min, max) that specifies the range of the time variable to be plotted.

y_range

A numeric vector of the form c(min, max) that specifies the range of the response variable to be plotted.

rl_index

A positive integer that specifies which of the release limit values that have been handed over to expirest_wisle() should be displayed. The default is NULL.

plot_option

A character string of either "full", "lean", "lean1", "lean2", "basic1" and "basic2", that specifies if additional information should be shown in the plot (option "full") or only basic information (options "lean" and "basic"). Full means the data points, the fitted regression line with the confidence or prediction interval, the specification limit(s) and the estimated shelf life. For ‘expirest_osle’ objects, only the options "full" and "lean" are relevant. The default is "full".

mtbs

A character string that specifies the “model to be shown”, i.e. either verified, which is the default, or one of cics, dics, dids or dids.pmse. The verified model is the model that was identified through the poolability check. It is thus also one of the possible optional models. The dids model represents the case where a separate model is fitted to the data of each individual batch while the dids.pmse model is the interaction model which includes the \(batch\) variable as main effect and in the interaction term with the \(time\) variable (\(batch \times time\)), i.e. a model where the mean square error is pooled across batches.

Details

The function get_text_annotation() expects various pieces of information characterising an ‘expirest_osle’ or an ‘expirest_wisle’ model. With this information, the function prepares a data frame that that is used by the functions plot_expirest_osle() or plot_expirest_wisle()) to put text annotations on the graph that is prepared by these functions.

See Also

plot_expirest_osle, plot_expirest_wisle, print_val, ggplot, geom_text.