In a clinical study, assume that the investigator needs to recruit
n subjects. Based on previous trial experience and the potential available patient population, the investigator plans to finish recruitment in
T days. Suppose that the trial starts at time
t
0, and that new patients enter the study sequentially, at
t
1,
t
2,
t
m
… Then the waiting time for each successive patient is calculated as
$$ {w}_i = {t}_i - {t_i}_{-1}, $$
and
w
i
is assumed to follow an exponential distribution, that is
$$ {w}_i\sim exp\left(\theta \right), $$
in which
θ represents the average accrual time for the
ith subject. To apply the Bayesian constant accrual model [
6], we assume that the prior distribution of
θ is inverse gamma, that is
$$ \theta \sim IG\left(nP,\kern0.28em TP\right), $$
where
P is defined as the investigator’s confidence of finishing the trial in the original planned time, measured on a 0–1 scale [
6]. In the process of a trial, suppose that
m subjects have been collected within time
T
m
(
T
m
= ∑
i= 1
m
w
i
). Then the posterior distribution for
θ is
$$ f\left(\theta \Big|m,{T}_m\right)=\frac{{\left(TP+{T}_m\right)}^{nP+m}\;}{\Gamma \left(nP+m\right)}{\theta}^{-\left(nP+m+1\right)}{e}^{-\frac{TP+{T}_m}{\theta }} $$
(1)
Using R, the Bayesian method for simple accrual [
6] can easily be conducted using simulations. To speed up the calculation, it is better to develop a closed-form solution that can be used in Java. For fixed
T, assuming that the rest of subjects can be recruited after time
T
m
are
$$ \eta \sim \mathrm{P}\mathrm{o}\mathrm{i}\left(\frac{T-{T}_m}{\theta}\right), $$
then the posterior predictive distribution of
η is
$$ \begin{array}{c}\kern1em g\left(\eta \right)={\displaystyle {\int}_0^{\infty}\frac{{\left(TP+{T}_m\right)}^{nP+m}\kern0.28em }{\Gamma \left(nP+m\right)}{\theta}^{-\left(nP+m+1\right)}{\mathrm{e}}^{-\frac{TP+{T}_m}{\theta }}\frac{{\left(\frac{T-{T}_m}{\theta}\right)}^{\eta }}{\eta !}{\mathrm{e}}^{-\frac{T-{T}_m}{\theta }}\mathrm{d}\theta}\kern1em \\ {}\kern1em =\frac{{\left(TP+{T}_m\right)}^{nP+m}{\left(T-{T}_m\right)}^{\eta}\kern0.28em }{\Gamma \left(nP+m\right)\eta !}{\displaystyle {\int}_0^{\infty }{\theta}^{-\left(nP+m+\eta +1\right)}{\mathrm{e}}^{-\frac{TP+T}{\theta }}\mathrm{d}\theta}\kern1em \end{array} $$
(2)
$$ =\frac{{\left(TP+{T}_m\right)}^{nP+m}{\left(T-{T}_m\right)}^{\eta}\Gamma \left(nP+m+\eta \right)}{{\left(TP+T\right)}^{\mathrm{nP}+\mathrm{m}+\eta}\Gamma \left(nP+m\right)\eta !}. $$
(3)
As discussed by Jiang et al. [
10], the closed form of the time frame of accrual shows an inverse beta distribution. We can use a normal approximation approach (Additional file
1), which can greatly accelerate the speed of calculation. The normal approximation works well if
r is large and
p is neither too small nor too large. To meet the requirement, we recommend that at the very beginning of the trial, when
m and
T
m
are zero or small, the prior
P should be relatively large (e.g., 0.5). After the trial starts, for example, when
\( {T}_m=\frac{T}{2} \),
p will be in the range of 0.5 and 0.75. The value of prior
P will almost have no effect on the normal approximation.
The derivation of the closed form also makes it possible to adopt the Bayesian constant accrual model in Java, which lacks built-in sampling algorithms.