Why Numerical Root Finding Is Needed
A projected event count is often calculated from enrollment timing, follow-up, survival probabilities, and censoring rules. Even when each ingredient is straightforward, their combination may not yield an equation that can be rearranged to give the calendar time directly. In that case, the date for a target event count is found by evaluating the projection at trial dates and narrowing down where the target is reached.
The earlier material on solving for the date a target is reached motivates the equation. Here the emphasis is on how to solve it reliably when the projection must be evaluated numerically. The method is not just a calculator technique: a valid bracket, a suitable projection function, and a stated stopping tolerance are essential parts of the answer.
The quantity \(E(t)\) is an expectation, so it need not be an integer. A solution such as 27.4 months means the model's expected cumulative event count reaches the target at about that elapsed time; it does not imply that the realized trial will have exactly the target count then. The projection assumptions must be held fixed while solving. If enrollment, event probabilities, or censoring rules change between evaluations, the root-finding calculation no longer solves one well-defined equation.
Conditions for a Valid Bracket
Bisection is a bracketed method. Choose two dates \(a\) and \(b\), with \(a<b\), such that \(f(a)\) and \(f(b)\) have opposite signs: one is at or below zero and the other is at or above zero. If \(f\) is continuous on \([a,b]\), the intermediate value theorem guarantees at least one root in that interval. For an event projection that increases continuously over time, the usual pattern is \(E(a)\leq D\leq E(b)\).
A nondecreasing \(E(t)\) is expected when the quantity is the cumulative number of events by a cutoff under a consistent model: moving the cutoff later cannot remove events that have already occurred. If \(E(t)\) is strictly increasing near the target, there is at most one root there. Strict increase is useful for interpreting a unique target date, but is not required for bisection to retain a sign-changing interval. Flat portions can instead make the date poorly determined or non-unique.
Before using the algorithm, verify that the model evaluator returns the same value for the same date, that its time units are consistent, and that dates in the bracket lie within the range for which the projection assumptions are defined. With Monte Carlo estimates, repeated evaluations can fluctuate because of simulation error. A changing sign caused by that noise is not necessarily evidence of a genuine crossing; use sufficient simulation precision or a deterministic projection evaluator before treating a narrow bracket as meaningful.
The Bisection Procedure and Its Error Bound
At each iteration, evaluate the midpoint \(m=(a+b)/2\). If \(f(m)=0\), the target is reached exactly within the calculation's precision. Otherwise, retain the half-interval whose endpoints still have opposite signs. Continue until the interval is narrow enough for the intended use. The final estimate is often the midpoint of the retained interval, reported with a precision that the interval supports.
Evaluate \(E(a)\) and \(E(b)\). Confirm that the target lies between these values and that \(a<b\).
Set \(m=(a+b)/2\), then compute \(f(m)=E(m)-D\).
If \(f(m)\) has the same sign as \(f(a)\), replace \(a\) with \(m\); otherwise replace \(b\) with \(m\). If \(f(m)=0\), stop.
Stop when the time interval is sufficiently narrow or the event-count discrepancy is sufficiently small. State which criterion was used.
The interval-width guarantee follows directly from the midpoint operation. If the initial bracket has width \(b_0-a_0\), then after \(k\) iterations its width is \((b_0-a_0)/2^k\), provided a sign-changing half is retained at each step. The root remains in the interval, so its distance from the interval midpoint is at most half the width.
This is a bound on date error, not on event-count error. A small date interval may still correspond to a noticeable event-count change if \(E(t)\) rises steeply. Conversely, when \(E(t)\) is nearly flat, a small event-count discrepancy may correspond to a wide range of dates. Choose a stopping rule that matches the intended reporting precision and inspect both the retained interval and the projected counts.
Worked Example: Bisection With a Cohort-Based Projection
Consider a hypothetical projection, valid for \(t\geq6\) months, with an ongoing component that accrues at 2.2832 expected events per month and a cohort entering at month 6. The cohort has 50 members, each with an exponential event hazard of 0.02 per month after entry. Its expected event contribution by time \(t\) is \(50[1-\exp\{-0.02(t-6)\}]\). Thus,
The goal is \(D=80\) expected events. The function is continuous and increasing for \(t\geq6\): its first term increases with \(t\), and the second term also increases because \(1-\exp\{-0.02(t-6)\}\) increases. At 25 months the components are
The second contribution is \(50(1-\exp(-0.38))\approx15.8069\), which rounds to 15.81; the total is approximately 72.8869, or 72.89 events. At 30 months,
So the target is bracketed between 25 and 30 months. Bisection gives the following first iterations. Values are rounded for display; the calculation should retain more digits internally.
The first midpoint is above 80, so the retained bracket is \([25,27.5]\). The next midpoint is below 80, giving \([26.25,27.5]\); the third is also below 80, giving \([26.875,27.5]\). Further iterations narrow the bracket around approximately 27.41 months. For example, at 27.41 months the first contribution is \(2.2832(27.41)=62.5825\), and the second is approximately \(50[1-\exp(-0.4282)]=17.416\), giving about 80.00 expected events. The projected target date is therefore approximately 27.41 months, under this hypothetical model.
Numerical Projection Evaluators
In some projections, \(E(t)\) is itself computed by numerical integration or by averaging event probabilities over individual enrollment times. The root-finding logic is unchanged: the evaluator supplies \(E(t)\), and the algorithm works with \(f(t)=E(t)-D\). What changes is that every evaluation has numerical accuracy limits. Record the evaluator's precision and avoid reporting a root more precisely than its inputs support.
Worked Example: Bracketing an Integrated Projection
Suppose a hypothetical projection averages event probabilities across staggered enrollment times using numerical integration. The resulting expected event counts are shown below. The target is 75 events.
| Elapsed time (months) | Projected expected events | Comparison with target |
|---|---|---|
| 20.00 | 69.80 | Below 75 |
| 21.00 | 73.60 | Below 75 |
| 21.50 | 75.40 | Above 75 |
| 22.00 | 77.10 | Above 75 |
The initial bracket \([20,22]\) has endpoint counts 69.80 and 77.10, so it contains a crossing if the numerically evaluated projection is continuous. The midpoint 21.00 gives 73.60, so retain \([21,22]\). Its midpoint, 21.50, gives 75.40, so retain \([21,21.5]\). The midpoint 21.25 gives 74.50, so retain \([21.25,21.5]\). At this point, the bracket is 0.25 month wide and its midpoint is 21.375 months; the root is within 0.125 month of that midpoint. A suitable report is approximately 21.4 months, with the stated bracket showing the numerical resolution. These hypothetical integration outputs are used as given; in practice, their accuracy and stability should be checked.
When the Target Cannot Be Reached
A failed bracket is diagnostically important. It may mean the search interval is too narrow, but it may also mean the target is unreachable under the model. For a finite enrolled population, the expected number of events may approach the number of participants as follow-up grows, without reaching that limit at any finite time. In such a case, a target equal to that limiting count has no finite solution.
Worked Example: An Unreachable Finite-Time Target
Suppose a hypothetical projection has 50 enrolled participants, each with event probability \(1-\exp\{-0.08(t-2)\}\) by time \(t\geq2\) months. Then
The target is 50 expected events. For every finite \(t\geq2\), the exponential term is positive, so
For example, at 60 months, \(E(60)=50[1-\exp(-4.64)]\approx49.52\) events. The count approaches 50 as \(t\) increases but never equals 50 at a finite date. Thus no finite bracket can straddle a root for \(D=50\). Extending the search indefinitely or forcing a numerical solver to return a date would conceal the model's actual implication. The right conclusion is that the target is not attained in finite time under this projection.
Diagnostics, Alternatives, and Limitations
A numerical answer should be accompanied by checks rather than treated as a black-box output. Confirm that the retained endpoints still straddle the target, that the bracket shrinks as intended, and that evaluating the final date gives a count close to \(D\). For an expected cumulative count, check that later dates do not produce smaller values unless the projection definition itself explains that behavior. A decrease can indicate an inconsistent cutoff, a coding error, or numerical noise.
- No sign change: expand or reposition the search interval only after checking the attainable range of \(E(t)\). The target may be impossible under the assumptions.
- Unexpected reversals: inspect how enrollment, follow-up, censoring, and event probabilities are combined. A deterministic cumulative expectation should not fluctuate from one repeated evaluation to another.
- Unstable midpoint values: check integration or simulation precision. Do not interpret random evaluation noise as a stable root bracket.
- Excessive reported precision: round the date to match the bracket width and the accuracy of the event projection.
Bisection is slower than some alternatives, but it is robust: once a valid bracket is established, it does not require derivatives or a good initial guess, and it cannot jump outside the bracket. Linear interpolation or the secant method can converge faster when the function behaves smoothly, but may leave the bracket unless safeguarded. Newton's method can also be fast, but requires a useful derivative and can fail when its step is too large or the slope is near zero. A grid search is easy to audit, but its resolution is limited by the chosen grid. For an operationally important root, a safeguarded approach can use interpolation for speed while retaining bisection as the fallback that preserves the bracket.
All methods solve only the mathematical equation supplied to them. They do not validate the survival assumptions, enrollment pattern, loss-to-follow-up adjustment, or other inputs that determine \(E(t)\). Nor does a root give a prediction interval for the realized date on which the trial will observe the target number of events. It is a date implied by the specified expected-count projection. Distinguishing that model-based point from uncertainty in event accrual is essential when communicating the result.
Check Your Understanding
Answer each question, then compare with the brief solutions.
- If \(E(18)=64\) and \(E(24)=82\), what target values are bracketed by these dates, assuming continuity?
- A bisection bracket has width 2 months. How many iterations are needed to reduce its width to at most 0.125 month?
- Why is a target of 50 not attained at any finite date when \(E(t)=50[1-\exp\{-0.1(t-1)\}]\) for \(t\geq1\)?
- What should be checked if repeated evaluations at the same date return different projected event counts?
Solutions. (1) Any target \(D\) between 64 and 82 events is bracketed, including the endpoints. (2) The width after \(k\) iterations is \(2/2^k\); requiring \(2/2^k\leq0.125\) gives \(2^k\geq16\), so 4 iterations suffice. (3) For finite \(t\), \(\exp\{-0.1(t-1)\}>0\), hence \(E(t)<50\); it approaches 50 only as \(t\) tends to infinity. (4) Check for simulation randomness, numerical integration error, or nondeterministic inputs, and stabilize the evaluator before interpreting a sign change as a root bracket.