plot.survFitTKTD: Plotting method for 'survFitTKTD' objects

View source: R/plot.survFitTKTD.R

plot.survFitTKTDR Documentation

Plotting method for survFitTKTD objects

Description

This is the generic plot S3 method for the survFitTKTD. It plots the fit obtained for each concentration of chemical compound in the original dataset.

Usage

## S3 method for class 'survFitTKTD'
plot(
  x,
  xlab = "Time",
  ylab = "Survival probablity",
  main = NULL,
  concentration = NULL,
  spaghetti = FALSE,
  one.plot = FALSE,
  adddata = FALSE,
  addlegend = FALSE,
  style = "ggplot",
  ...
)

Arguments

x

An object of class survFitTKTD.

xlab

A label for the X-axis, by default Time.

ylab

A label for the Y-axis, by default Survival probablity.

main

A main title for the plot.

concentration

A numeric value corresponding to some specific concentration in data. If concentration = NULL, draws a plot for each concentration.

spaghetti

if TRUE, draws a set of survival curves using parameters drawn from the posterior distribution

one.plot

if TRUE, draws all the estimated curves in one plot instead of one plot per concentration.

adddata

if TRUE, adds the observed data to the plot with (frequentist binomial) confidence intervals

addlegend

if TRUE, adds a default legend to the plot.

style

graphical backend, can be 'generic' or 'ggplot'

...

Further arguments to be passed to generic methods.

Details

The fitted curves represent the estimated survival probablity as a function of time for each concentration When adddata = TRUE the black dots depict the observed survival probablity at each time point. Note that since our model does not take inter-replicate variability into consideration, replicates are systematically pooled in this plot. The function plots both 95% credible intervals for the estimated survival probablity (by default the grey area around the fitted curve) and 95% binomial confidence intervals for the observed survival probablity (as black error bars if adddata = TRUE). Both types of intervals are taken at the same level. Typically a good fit is expected to display a large overlap between the two types of intervals. If spaghetti = TRUE, the credible intervals are represented by two dotted lines limiting the credible band, and a spaghetti plot is added to this band. This spaghetti plot consists of the representation of simulated curves using parameter values sampled in the posterior distribution (2% of the MCMC chains are randomly taken for this sample).

Value

a plot of class ggplot

Examples


# (1) Load the survival data
data(propiconazole)

# (2) Create an object of class "survData"
dataset <- survData(propiconazole)


# (3) Run the survFitTKTD function ('SD' model only)
out <- survFitTKTD(dataset)

# (4) Plot the fitted curves in one plot 
plot(out)

# (5) Plot one fitted curve per concentration with credible limits as
# spaghetti, data and confidence intervals
# and with a ggplot style
plot(out, spaghetti = TRUE , adddata = TRUE, one.plot = FALSE,
     style = "ggplot")

# (6) Plot fitted curve for one specific concentration
plot(out, concentration = 36, style = "ggplot")



morse documentation built on Oct. 29, 2022, 1:14 a.m.