**Closed form solution for homogenous accrual (created 2010-12-01)**.

This page is moving to a new website.

It's very easy to simulate the final trial sample size or the final trial duration for a simple accrual model with exponential waiting times. But there is also a closed form solution that is instructive to review.

Use the gamma distribution for the prior distribution for the accrual rate. The probability density function of the gamma distribution is

During a time interval of length t, the number of patients expected to enter the study during this time period is Poisson with rate parameter λt. This has probability mass function.

Since λ is variable, you can't use the Poisson distribution directly. The trick is to compute the joint distribution and then integrate out the value of λ.

In this case, it works out to

This can be thought of as a weighted average of a family of Poisson distributions. Pull out everything that does not depend on λ.

The integral above has the heart of a gamma probability density function, and we just need to adjust by the normalizing constant

this leads to the equation

This distribution is negative binomial (though some people might quibble a bit if α is not a whole number). The α and β terms here are just placeholders for the corresponding values in the posterior distribution. Assume that the planned duration of the clinical trial is T and that the expected number of patients is n. You place a prior distribution on the accrual rate using a gamma prior with α = nP and β = TP (or equivalently place a prior distribution on the average waiting time using an inverse gamma prior). Here P is a number between 0 and 1 and it represents the weight given to the prior relative to the weight given to the total planned sample size.

After conducting the trial for time period t_{m},
you accumulate m patients. You want to know how many patients you will need
for the remaining time period (T-t_{m}).

The posterior distribution for the accrual
rate is α = nP+m and β = TP+t_{m}. The number of patients you will
recruit in the remaining T-t_{m} time frame is negative binomial with r = nP+m
and p = (T-t_{m}) / (T+TP). The mean for a negative binomial random
variable is rp/(1-p) which for this example would be

If you need to obtain an additional k = n - m patients, the waiting time is the sum of k exponential random variables, which is equivalent to a single gamma random variable with shape parameter equal to k.

Again, you need to produce the joint distribution of the waiting time and the accrual rate, λ, and then integrate out λ.

Pull out everything that does not depend on λ.

This integral has the heart of a Gamma distribution, so it needs the normalizing constant

This produces

which is closely related to the beta distribution.