fit_single_exp_covar {BPrinStratTTE} | R Documentation |
Fit single model to data from a two-arm trial with an exponentially distributed time-to-event endpoint and one predictor of the intercurrent event
Description
Fit single model to data from a two-arm trial with an exponentially distributed time-to-event endpoint and one predictor of the intercurrent event
Usage
fit_single_exp_covar(data, params, summarize_fit = TRUE)
Arguments
data |
Data frame of a structure as generated by |
params |
List, containing model parameters:
|
summarize_fit |
Logical, if |
Details
The data supplied as params
are used either as priors (prior_delta
, prior_0N
, prior_1N
, prior_1T
), to inform the model setup (tg
, p
, t_grid
), or as parameters to rstan::sampling()
which is invoked internally (chains
, n_iter
, warmup
, cores
, open_progress
, show_messages
).
Value
tibble()
containing a summary of results on key parameters, or a stanfit
object (S4 class), depending on summarize_fit
.
See Also
fit_single_exp_nocovar()
and rstan::sampling()
Examples
d_params_covar <- list(
n = 1000,
nt = 500,
prob_X1 = 0.4,
prob_ice_X1 = 0.5,
prob_ice_X0 = 0.2,
fu_max = 48*7,
T0T_rate = 0.2,
T0N_rate = 0.2,
T1T_rate = 0.15,
T1N_rate = 0.1
)
dat_single_trial <- sim_dat_one_trial_exp_covar(
n = d_params_covar[["n"]],
nt = d_params_covar[["nt"]],
prob_X1 = d_params_covar[["prob_X1"]],
prob_ice_X1 = d_params_covar[["prob_ice_X1"]],
prob_ice_X0 = d_params_covar[["prob_ice_X0"]],
fu_max = d_params_covar[["fu_max"]],
T0T_rate = d_params_covar[["T0T_rate"]],
T0N_rate = d_params_covar[["T0N_rate"]],
T1T_rate = d_params_covar[["T1T_rate"]],
T1N_rate = d_params_covar[["T1N_rate"]]
)
m_params_covar <- list(
tg = 48,
p = 2,
prior_delta = matrix(
c(0, 5, 0, 5),
nrow = 2, byrow = TRUE),
prior_0N = c(1.5, 5),
prior_1N = c(1.5, 5),
prior_0T = c(1.5, 5),
prior_1T = c(1.5, 5),
t_grid = seq(7, 7 * 48, 7) / 30,
chains = 2,
n_iter = 3000,
warmup = 1500,
cores = 2,
open_progress = FALSE,
show_messages = FALSE
)
fit_single <- fit_single_exp_covar(
data = dat_single_trial,
params = m_params_covar,
summarize_fit = FALSE
)
print(fit_single)