plot.survFitVarExp: Plotting method for 'survFit' objects

View source: R/plot.survFitVarExp.R

plot.survFitVarExpR Documentation

Plotting method for survFit objects

Description

This is the generic plot S3 method for the survFit. It plots the fit obtained for each concentration profile in the original dataset.

Usage

## S3 method for class 'survFitVarExp'
plot(
  x,
  xlab = "Time",
  ylab = "Survival probability",
  main = NULL,
  spaghetti = FALSE,
  one.plot = FALSE,
  adddata = TRUE,
  mcmc_size = NULL,
  scales = "fixed",
  addConfInt = TRUE,
  ...
)

Arguments

x

An object of class survFit.

xlab

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

ylab

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

main

A main title for the plot.

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.

mcmc_size

A numerical value refering by default to the size of the mcmc in object survFit. This option is specific to survFitVarExp objects for which computing time may be long. mcmc_size can be used to reduce the number of mcmc samples in order to speed up the computation.

scales

Shape the scale of axis. Default is "fixed", but can be "free", or free in only one dimension "free_x", "free_y". (See ggplot2 documentation for more details.)

addConfInt

If TRUE, add a 95\% confidence interval on observed data from a binomial test

...

Further arguments to be passed to generic methods.

Details

The fitted curves represent the estimated survival probability as a function of time for each concentration profile. The black dots depict the observed survival probability 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% binomial credible intervals for the estimated survival probability (by default the grey area around the fitted curve) and 95% binomial confidence intervals for the observed survival probability (as black segments 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 (10% of the MCMC chains are randomly taken for this sample).

Value

a plot of class ggplot

Examples


# (1) Load the survival data
data("propiconazole_pulse_exposure")

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


# (3) Run the survFit function
out <- survFit(dataset , model_type = "SD")

# (4) Summary look the estimated values (parameters)
summary(out)

# (5) Plot the fitted curve
plot(out, adddata = FALSE)

# (6) Plot the fitted curve with ggplot style and CI as spaghetti
plot(out, spaghetti = TRUE)



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