plot.td2pLL_mod: Plot interactive td2pLL models

View source: R/plot.td2pLL_mod.R

plot.td2pLL_modR Documentation

Plot interactive td2pLL models

Description

plot.td2pLL_mod is the plot method for the S3 class td2pLL_mod. Model fits generated with the fit_td2pLL() function are of class c("td2pLL_mod", "nls") and can therefore be used for this plot method. If no fitted model but a through parameters pre-specified td2pLL model shall be plotted, this can be done via the plot_td2pLL. For details on the td2pLL model, see fit_td2pLL(). If the TDR() function is used which performs the two-step modeling pipeline, one can apply plot.td2pLL_mod() to the fit list entry of the object returned by TDR(), if fitting a td2pLL model was chosen in accordance to the anova pre-test (see td2pLL_anova()) calculated in TDR().

Usage

## S3 method for class 'td2pLL_mod'
plot(
  x = NULL,
  dose_lim = NULL,
  time_lim = NULL,
  add_model_data = TRUE,
  add_ext_data = NULL,
  n_grid = 100,
  title = NULL,
  xaxis_scale = "log",
  yaxis_scale = "-",
  xaxis_title = "Dose",
  yaxis_title = "Time",
  zaxis_title = "Response",
  add_ED50_line = TRUE,
  ED50_line_col = "red",
  ED50_line_width = 6,
  ...
)

Arguments

x

(td2pLL_mod object)
A td2pLL_mod object generatet via fit_td2pLL. If not provided, alternatively, td2pLL_coefs can be provided.

dose_lim

(numeric(2))
Boundaries of the doses (xaxis) for plotting. Note: If xaxis_scale = "log" (default), then dose_lim cannot include 0. If dose_lim shall include the 0, set xaxis_scale = "linear".

time_lim

(numeric(2))
Boundaries for the time (yaxis) for plotting.

add_model_data

(logical(1))
By default the original data used for the fit are added to the plot.

add_ext_data

(data.frame())
Optional numeric data.frame to add data points to the surface plot. Must include columns dose, time and resp.

n_grid

(integer(1))
n_grid*n_grid is the dose*time grid for surface evaluations that will be interpolated. Increase n_grid for a smoother plot.

title

(character(1))
Optional plot title.

xaxis_scale

(character(1) in c("log", "linear", "-")
Scale of x-axis (dose-axis).
If "-" is set, then plot_ly() tries to guess which scale to use.

yaxis_scale

(character(1) in c("log", "linear", "-")
Scale of y-axis (time-axis).
If "-" is set, then plot_ly() tries to guess which scale to use.

xaxis_title, yaxis_title, zaxis_title

(character(1))
Title for dose-axis, time-axis and response-axis.

add_ED50_line

(logical(1))
Indicates if the line of ED50 values shall be annotated (=TRUE).

ED50_line_col

(character(1))
Color for optionally added ED50 line.

ED50_line_width

(numeric(1))
Width for optionally added ED50 line.

...

any
Not used.

Details

For further details on the td2pLL model, check fit_td2pLL(). For details on the ANOVA used, see td2pLL_anova(). More over, the entire procedure is explained in duda et al. (2021). For plotting, the plot_ly function of package plotly is used.

Examples

data(cytotox)
data_subset <- cytotox[cytotox$compound == "ASP", c("expo", "dose", "resp")]
colnames(data_subset)[1] <- "time"
fit <- fit_td2pLL(data = data_subset)
plot(fit)
plot(fit, xaxis_scale = "linear")
plot(fit, title = "td2pLL model of Compound ASP", dose_lim = c(0.01, 100))
plot(fit, xaxis_scale = "linear", dose_lim = c(0, 15))
# If you want to see how the model looks like for certain parameters,
# use [plot_td2pLL]
plot_td2pLL(td2pLL_coefs = c(h = 2, delta = 3, gamma = 1.5, c0 = 1),
 dose_lim = c(0.01, 10), time_lim = c(1, 5))

jcduda/td2pLL documentation built on May 14, 2022, 6:48 p.m.