Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

plot.survFitPredict

Plotting method for survFitPredict objects


Description

This is the generic plot S3 method for the survFitPredict. It plots the predicted survival probability for each concentration of the chemical compound in the provided dataset.

Usage

## S3 method for class 'survFitPredict'
plot(
  x,
  xlab = "Time",
  ylab = "Survival probability",
  main = NULL,
  spaghetti = FALSE,
  one.plot = FALSE,
  mcmc_size = NULL,
  ...
)

Arguments

x

An object of class survFitPredict.

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.

mcmc_size

A numerical value refering by default to the size of the mcmc in object survFitPredict. This option is specific to survFitPredict 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.

...

Further arguments to be passed to generic methods.

Details

The fitted curves represent the predicted survival probability as a function of time for each concentration. The function plots both the 95% credible band and the predicted survival probability over time. 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).

Examples

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

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

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

# (4) Create a new data table for prediction
data_4prediction <- data.frame(time = 1:10, conc = c(0,5,5,5,0,0,5,5,5,5),
 replicate= rep("predict", 10))

# (5) Predict on a new dataset
predict_out <- predict(out, data_predict = data_4prediction, spaghetti = TRUE)

# (6) Plot the predicted curve
plot(predict_out)
plot(predict_out, spaghetti = TRUE)

## End(Not run)

morse

Modelling Tools for Reproduction and Survival Data in Ecotoxicology

v3.3.1
GPL (>= 2)
Authors
Virgile Baudrot [aut], Sandrine Charles [aut], Marie Laure Delignette-Muller [aut], Wandrille Duchemin [ctb], Benoit Goussen [ctb], Nils Kehrein [ctb], Guillaume Kon-Kam-King [ctb], Christelle Lopes [ctb], Philippe Ruiz [aut], Alexander Singer [ctb], Philippe Veber [aut]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.