Learn R Programming

morse (version 3.3.4)

predict.survFit: Predict method for survFit objects

Description

This is the generic predict S3 method for the survFit class. It provides simulation for "SD" or "IT" models under constant or time-variable exposure.

It provides the simulated number of survivors for "SD" or "IT" models under constant or time-variable exposure.

It provides the simulated number of survivors for "SD" or "IT" models under constant or time-variable exposure.

This is a method to replace function predict_Nsurv used on survFit object when computing issues happen. predict_nsurv_ode uses the deSolve library to improve robustness. However, time to compute may be longer.

Usage

# S3 method for survFit
predict(
  object,
  data_predict = NULL,
  spaghetti = FALSE,
  mcmc_size = NULL,
  hb_value = TRUE,
  ratio_no.NA = 0.95,
  hb_valueFORCED = NA,
  extend_time = 100,
  ...
)

predict_Nsurv(object, ...)

# S3 method for survFit predict_Nsurv( object, data_predict = NULL, spaghetti = FALSE, mcmc_size = NULL, hb_value = TRUE, hb_valueFORCED = NA, extend_time = 100, ... )

predict_Nsurv_ode( object, data_predict, spaghetti, mcmc_size, hb_value, hb_valueFORCED, extend_time, interpolate_length, interpolate_method, ... )

# S3 method for survFit predict_Nsurv_ode( object, data_predict = NULL, spaghetti = FALSE, mcmc_size = 1000, hb_value = TRUE, hb_valueFORCED = NA, extend_time = 100, interpolate_length = NULL, interpolate_method = "linear", ... )

Value

a list of data.frame with the quantiles of outputs in df_quantiles or all the MCMC chaines df_spaghetti

an object of class predict_Nsurv.

The function returns an object of class survFitPredict_Nsurv, which is a list with the two following data.frame:

df_quantile

A data.frame with 10 columns, time, conc, replicate, Nsurv (observed number of survivors) and other columns with median and 95% credible interval of the number of survivors computed with 2 different way refers as check and valid: Nsurv_q50_check, Nsurv_qinf95_check, Nsurv_qsup95_check, Nsurv_q50_valid, Nsurv_qinf95_valid, Nsurv_qsup95_valid. The _check refers to the number of survivors at time \(t\) predicted using the observed number of survivors at time \(t-1\), while the _valid refers to the number of survivors predicted at time \(t\) based on the predicted number of survivors at time \(t-1\).

df_spaghetti

NULL if arguement spaghetti = FALSE. With spaghetti = TRUE, it returns a dataframe with all simulations based on MCMC parameters from a survFit object.

an object of class predict_Nsurv_ode.

a list of data.frame with the quantiles of outputs in df_quantiles or all the MCMC chaines df_spaghetti

Arguments

object

An object of class survFit.

data_predict

A dataframe with three columns time, conc and replicate used for prediction. If NULL, prediction is based on x object of class survFit used for fitting.

spaghetti

If TRUE, return a set of survival curves using parameters drawn from the posterior distribution.

mcmc_size

Can be used to reduce the number of mcmc samples in order to speed up the computation. mcmc_size is the number of selected iterations for one chain. Default is 1000. If all MCMC is wanted, set argument to NULL.

hb_value

If TRUE, the background mortality hb is taken into account from the posterior. If FALSE, parameter hb is set to 0. The default is TRUE.

ratio_no.NA

A numeric between 0 and 1 standing for the proportion of non-NA values required to compute quantile. The default is \(0.95\).

hb_valueFORCED

If hb_value is FALSE, it fix hb.

extend_time

Length of time points interpolated with variable exposure profiles.

...

Further arguments to be passed to generic methods

interpolate_length

Length of the time sequence for which output is wanted.

interpolate_method

The interpolation method for concentration. See package deSolve for details. Default is linear.