fit_single_exp_nocovar {BPrinStratTTE}R Documentation

Fit single model to data from a two-arm trial with an exponentially distributed time-to-event endpoint and no 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 no predictor of the intercurrent event

Usage

fit_single_exp_nocovar(data, params, summarize_fit = TRUE)

Arguments

data

Data frame of a structure as generated by sim_dat_one_trial_exp_nocovar().

params

List, containing model parameters:

  • tg Positive integer value, number of intervals to calculate restricted mean survival time using the trapezoidal rule.

  • prior_piT Numeric vector of length 2, containing parameters (alpha, beta) of the beta prior on pi, indicating the probability of belonging to the stratum of subjects developing the intercurrent event if given treatment.

  • prior_0N Numeric vector of length 2, containing parameters (alpha, beta) of the gamma prior on lambda_0N.

  • prior_1N Numeric vector of length 2, containing parameters (alpha, beta) of the gamma prior on lambda_1N.

  • prior_0T Numeric vector of length 2, containing parameters (alpha, beta) of the gamma prior on lambda_0T.

  • prior_1T Numeric vector of length 2, containing parameters (alpha, beta) of the gamma prior on lambda_1T.

  • t_grid Numeric vector of length tg, containing time points defining the time grid (in months) to calculate restricted mean survival time using the trapezoidal rule.

  • chains Positive integer value, specifying the number of Markov chains.

  • n_iter Positive integer value, specifying the number of iterations for each chain (including warmup).

  • warmup Positive integer value, specifying the number of warmup (aka burnin) iterations per chain.

  • cores Positive integer value, specifying the number of cores to use when executing the chains in parallel.

  • open_progress Logical value, indicating whether the progress of the chains will be redirected to a file that is automatically opened for inspection.

  • show_messages Logical value, indicating whether to print the summary of informational messages.

summarize_fit

Logical, if TRUE (default), the output is restricted to a summary of results on key parameters over all chains, if FALSE, the complete stanfit object is returned.

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, depending on summarize_fit.

See Also

fit_single_exp_covar() and rstan::sampling()

Examples

d_params_nocovar <- list(
  n = 500L,
  nt = 250L,
  prob_ice = 0.5,
  fu_max = 336L,
  T0T_rate = 0.2,
  T0N_rate = 0.2,
  T1T_rate = 0.15,
  T1N_rate = 0.1
)
dat_single_trial <- sim_dat_one_trial_exp_nocovar(
  n = d_params_nocovar[["n"]], 
  nt = d_params_nocovar[["nt"]],
  prob_ice = d_params_nocovar[["prob_ice"]],
  fu_max = d_params_nocovar[["fu_max"]],  
  T0T_rate = d_params_nocovar[["T0T_rate"]],
  T0N_rate = d_params_nocovar[["T0N_rate"]],
  T1T_rate = d_params_nocovar[["T1T_rate"]],
  T1N_rate = d_params_nocovar[["T1N_rate"]] 
)
m_params_nocovar <- list(
  tg = 48L,
  prior_piT = c(0.5, 0.5),
  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 = 2L,
  n_iter = 3000L,
  warmup = 1500L,
  cores = 2L,
  open_progress = FALSE,
  show_messages = TRUE
)

fit_single <- fit_single_exp_nocovar(
  data = dat_single_trial,
  params = m_params_nocovar,
  summarize_fit = TRUE
)
print(fit_single)


[Package BPrinStratTTE version 0.0.7 Index]