Skip to contents

This function takes one or more prior-specifications for an SRP multi-state model and combines them into a joint model. Groups are still treated as independent.

This function takes one or more prior-specifications for an SRP multi-state model and combines them into a joint model. Groups are still treated as independent.

Usage

srp_group_prior(
  p_mean = 0.5,
  p_n = 3,
  p_eta = 0,
  p_min = 0,
  p_max = 1,
  median_t_q05 = c(1, 1, 3),
  median_t_q95 = c(12, 12, 24),
  shape_q05 = rep(0.99, 3),
  shape_q95 = rep(1.01, 3),
  visit_spacing = 1,
  recruitment_rate = 1
)

create_srp_model(..., maximal_time = 10 * 12)

# S3 method for srp_model
format(x, ...)

# S3 method for srp_model
visits_to_mstate(
  tbl_visits,
  model,
  now = max(tbl_visits$t),
  eof_indicator = "EOF"
)

# S3 method for srp_model
compute_pfs(
  model,
  t,
  parameter_sample = NULL,
  warmup = 500L,
  nsim = 1000L,
  seed = NULL,
  ...
)

# S3 method for srp_model
plot_mstate(
  data,
  model,
  now = max(tbl_mstate$t_max),
  relative_to_sot = TRUE,
  ...
)

# S3 method for srp_model
plot_transition_times(
  model,
  parameter_sample = NULL,
  seed = 42L,
  nsim = 500L,
  warmup = 250,
  nuts_control = list(),
  dt_interval = NULL,
  dt_n_grid = 25,
  dt_expand = 1.1,
  dt_grid = NULL,
  confidence = NULL,
  ...
)

# S3 method for srp_model
plot_response_probability(
  model,
  parameter_sample = NULL,
  seed = 42L,
  nsim = 500L,
  warmup = 250,
  nuts_control = list(),
  ...
)

# S3 method for srp_model
plot_pfs(
  model,
  parameter_sample = NULL,
  seed = 42L,
  nsim = 500L,
  warmup = 250,
  nuts_control = list(),
  dt_interval = NULL,
  dt_n_grid = 25,
  dt_expand = 1.1,
  dt_grid = NULL,
  confidence = NULL,
  ...
)

# S3 method for srp_model
plot(
  x,
  parameter_sample = NULL,
  seed = 42L,
  nsim = 500L,
  warmup = 250,
  nuts_control = list(),
  dt_interval = NULL,
  dt_n_grid = 25,
  dt_expand = 1.1,
  dt_grid = NULL,
  confidence = NULL,
  ...
)

Arguments

p_mean

numeric, mean of the beta prior for the response probability

p_n

numeric, beta prior equivalent sample size (a + b)

p_eta

numeric, robustification parameter for beta prior; actual prior is (1 - eta) beta + eta; i.e., eta is the non-informative weight.

p_min

numeric, minimal response probability

p_max

numeric, maximal response probability

median_t_q05

numeric of length three, 5% quantiles of the log-normal distributions for the median time-to-next-event for the three transitions s->r, s->p, r->p.

median_t_q95

numeric of length three, 95% quantiles of the log-normal distributions for the median time-to-next-event for the three transitions s->r, s->p, r->p.

shape_q05

numeric of length three, 5% quantiles of the log-normal distributions for the shapes of the time-to-next-event distributions for the three transitions s->r, s->p, r->p.

shape_q95

numeric of length three, 95% quantiles of the log-normal distributions for the shapes of the time-to-next-event distributions for the three transitions s->r, s->p, r->p.

visit_spacing

numeric, fixed duration between visits

recruitment_rate

numeric, constant recruitment rate

...

further arguments passed to method implementations

maximal_time

the maximal overall runtime of the trial as measured from the first visit of any group. No visits past this point are sampled.

x

the model to plot

tbl_visits

visit data in long format

model

a multi-state model object

now

time point since start of trial (might be later than last recorded visit)

eof_indicator

state name indicating (exactly observed) end of follow up.

t

a vector of time-points at which the PFS rate should be computed

parameter_sample

a stanfit object with samples from the respective model.

warmup

integer, number of warmup samples for the rstan sampler before retaining samples; these are used to tune the hyperparameters of the MCMC algorithm.

nsim

number of samples to draw

seed

integer, fixed random seed; NULL for no fixed seed

data

a data table with multi-state data

relative_to_sot

Boolean, should the timeline be relative to the start of trial or the start of treatment for each individual

nuts_control

control parameters for NUTS algorithm see rstan::stan()

dt_interval

numeric vector of length two with minimal and maximal time (relative to individual first visit) to use for plotting

dt_n_grid

number of grid points to use when automatically choosing plotting interval

dt_expand

expansion factor for upper plotting limit when using automatic interval detection

dt_grid

numeric vector of time points to use for plotting

confidence

numeric in (0, 1) confidence level for point-wise confidence bands around mean; none plotted if NULL.

Value

An object of type srp_group_prior holding all prior information in a list-like structure; visit_spacing and recruitment_rate are accessible as attributes.

an object of class srp_model; a named list of the group_ids, the maximal time, the visit spacing, the recruitment rate, and a list of prior parameters for the response probability, the median transition times, and the shape of the transition time distribution (Weibull)