| Title: | Design and Analysis of Pilot Trials Assessing Recruitment Feasibility |
|---|---|
| Description: | Find optimal decisions rules for guiding progression decisions following a pilot trial, assuming a hierarchical recruitment model. Estimate the time until the main trial recruits to target, given the recruitment data observed in the pilot. |
| Authors: | Duncan Wilson [aut, cre, cph] (ORCID: <https://orcid.org/0000-0001-7949-8718>) |
| Maintainer: | Duncan Wilson <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 1.0.0.9000 |
| Built: | 2026-06-04 06:52:33 UTC |
| Source: | https://github.com/lictr/fahb |
Given the hyperparameters encoded in a fahb_problem object, return plots of
the three prior distributions and a plot of the prior predictive distribution
of the recruitment rate at a randomly selected site.
check_priors(problem)check_priors(problem)
problem |
an object of class |
a list of ggplot2 plots.
problem <- fahb_problem() check_priors(problem)problem <- fahb_problem() check_priors(problem)
fahb analysis objectGiven a fahb_problem object calculate summary statistics which can inform
progression decisions. These include both standard progression criteria
statistics, and the expectation of the posterior predictive distribution of
the time until the trial recruits.
fahb_analysis(n_pilot, t_pilot, problem, site_t = NULL, bayes_model = NULL)fahb_analysis(n_pilot, t_pilot, problem, site_t = NULL, bayes_model = NULL)
n_pilot |
integer vector of numbers recruited at each open site. |
t_pilot |
numeric vector of time (in years) each site has been open. |
problem |
object of class |
site_t |
In the case of an external pilot, the time taken for all pilot sites to open. |
bayes_model |
optional object of class |
An object of class fahb_analysis.
## Example illustrating a full analysis workflow ## (Not run on CRAN due to Bayesian model fitting) problem <- fahb_problem() problem <- forecast(problem) ## Pilot trial data n_pilot <- c(3, 5, 2) t_pilot <- c(0.5, 0.6, 0.4) analysis <- fahb_analysis( n_pilot = n_pilot, t_pilot = t_pilot, problem = problem ) print(analysis) plot(analysis)## Example illustrating a full analysis workflow ## (Not run on CRAN due to Bayesian model fitting) problem <- fahb_problem() problem <- forecast(problem) ## Pilot trial data n_pilot <- c(3, 5, 2) t_pilot <- c(0.5, 0.6, 0.4) analysis <- fahb_analysis( n_pilot = n_pilot, t_pilot = t_pilot, problem = problem ) print(analysis) plot(analysis)
fahb design objectGiven a fahb_problem object, find efficient progression decision rules.
These can include rules of the standard "progression criteria form", or rules
based on a Bayesian analysis of the pilot trial data, or both.
fahb_design(problem, quietly = TRUE)fahb_design(problem, quietly = TRUE)
problem |
an object of class |
quietly |
if this argument is set to FASLE then information about which steps have been completed will be printed to the console. Defaults to TRUE. |
an object of class fahb_design.
problem <- forecast(fahb_problem(), n_sims = 500) fahb_design(problem)problem <- forecast(fahb_problem(), n_sims = 500) fahb_design(problem)
fahb_problem objectGiven a trial design and a set of model hyperparameters, build an object
of class fahb_problem.
fahb_problem( N = 320, m = 20, t = 0.5, n_ext = NULL, m_ext = NULL, rel_thr = 1.2, so_hps = c(30, 2.85), mean_rr_hps = c(2, 0.329), sd_rr_hps = c(30, 100) )fahb_problem( N = 320, m = 20, t = 0.5, n_ext = NULL, m_ext = NULL, rel_thr = 1.2, so_hps = c(30, 2.85), mean_rr_hps = c(2, 0.329), sd_rr_hps = c(30, 100) )
N |
target sample size. |
m |
number of recruiting sites. |
t |
timing of the pilot analysis in years. |
n_ext |
number of participants to recruit to an external pilot. |
m_ext |
number of sites to open in an external pilot. |
rel_thr |
threshold which discriminates feasible and infeasible trials, as a multiple of the expected time to recruit. |
so_hps |
site opening rate hyperparameters (shape and rate for a Gamma prior). |
mean_rr_hps |
mean site recruitment rate hyperparameters (mean and sd for a lognormal prior). |
sd_rr_hps |
variance in site recruitment rates hyperparameters (shape and rate for a Gamma prior). |
an object of class fahb_problem
fahb_problem()fahb_problem()
Generate probabilistic forecasts of trial recruitment
forecast(problem, n_sims = 10^4, overwrite = FALSE)forecast(problem, n_sims = 10^4, overwrite = FALSE)
problem |
an object of class |
n_sims |
number of replicates to use in the simulation. |
overwrite |
boolean indicating if we want to overwrite any simulation data currently held (defaults to FALSE). |
an object of class fahb_problem.
problem <- fahb_problem() problem <- forecast(problem, n_sims = 10^3)problem <- fahb_problem() problem <- forecast(problem, n_sims = 10^3)
fahb analysisTakes an object of class fahb_analysis and plots the posterior
distributions of the predicted time for the trial to recruit and of the three
model parameters.
## S3 method for class 'fahb_analysis' plot(x, ...)## S3 method for class 'fahb_analysis' plot(x, ...)
x |
object of class |
... |
further arguments passed to or from other methods. |
no return value, called for side effects.
Takes an object of class fahb_design and plots the estimated operating
characteristics of decision rules - based on standard progression criteria,
an approximate Bayesian analysis, or both.
## S3 method for class 'fahb_design' plot(x, ...)## S3 method for class 'fahb_design' plot(x, ...)
x |
object of class |
... |
further arguments passed to or from other methods. |
no return value, called for side effects.
fahb analysis objectThe default print method for a fahb_analysis object.
## S3 method for class 'fahb_analysis' print(x, ...)## S3 method for class 'fahb_analysis' print(x, ...)
x |
object of class |
... |
further arguments passed to or from other methods. |
no return value, called for side effects.
The default print method for a fahb_design object.
## S3 method for class 'fahb_design' print(x, coarse = TRUE, ...)## S3 method for class 'fahb_design' print(x, coarse = TRUE, ...)
x |
object of class |
coarse |
binary indicator that only a coarse subset of all decision rules should be printed. Defaults to TRUE. |
... |
further arguments passed to or from other methods. |
no return value, called for side effects.