create_model()
takes one or more prior-specifications for an
SRP multi-state model and combines them into a single model object.
Groups are still treated as independent.
Usage
define_srp_prior(
p_mean = 0.5,
p_n = 3,
p_eta = 0,
p_min = 0,
p_max = 1,
median_t_q05 = c(1, 1, 1),
median_t_q95 = c(60, 60, 60),
shape_q05 = rep(0.9, 3),
shape_q95 = rep(2.5, 3),
visit_spacing = 1,
recruitment_rate = 1
)
create_srpmodel(
...,
maximal_time = 10 * 12,
states = c("stable", "response", "progression"),
censored = "EOF"
)
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
- ...
named
srp_prior
objects; the argument names serve as group labels- 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.
- states
character vector of three states (initial, intermediate, terminal)
- censored
string, indicator of premature censoring events; no data is imputed after this point.
Value
define_srp_prior()
returns an object of class srp_prior
,
all inputs are accessible via
$x
where x
is the name of the input argument in the function call except
for the two parameters visit_spacing
and recruitment_rate
.
These two parameters are saved as attributes
and can be retrieved directly using attr(mdl, "visit_spacing")
and
attr(mdl, "recruitment_rate")
.
create_srpmodel()
returns an object of class c("srpmodel", "list")
that
holds information about potentially multiple groups in a compact format and
can be accessed using the list operator $name
.
group_id
is a character vector with the group names,
maximal_time
is the maximal follow-up time since the first visit in the
study, visit_spacing
is the vector of per-group difference between visits
(only relevant for forward sampling), recruitment_rate
is the vector of
per-group recruitment rates, stan_model
is the pre-compiled 'stan' model
used for inference, states
is the vector of state names in the multi-state
model, and prior
is a list of hyperparamters for the model prior with
elements p
, vector, for the response probability per group,
median_t
is an c(n_groups, 3, 2)
dimensional array where
median_t[i,j,1]
holds the 5% quantile of the the lognormal prior on median transition time
for group i
and transition j
and median_t[i,j,2]
the corresponding
upper 95% quantile. The shape
hyperparamter has the same format and
specified the corresponding quantiles for the Weibull shape parameter.
Details
define_srp_prior()
specifies a prior distribution for a
three state model (stable, response, progression) for
a single group.
Examples
# a model with prior 25% response rate and variance equivalent to
# 10 data points (i.e. a Beta(2.5, 7.5) distribution).
grp <- define_srp_prior(p_mean = 0.25, p_n = 10)
attr(grp, "recruitment_rate")
#> [1] 1
# a model with two groups and different priors on the respective response
# probabilities
mdl <- create_srpmodel(
A = define_srp_prior(),
B = define_srp_prior(p_mean = 0.33, p_n = 10)
)
mdl$median_t
#> NULL