Signature
U = T_off + T_on * exp(k * psi); G = T_off + T_on - U
| Inputs | Definition | Unit |
|---|---|---|
T_off | Time from randomisation that the patient spent off the experimental treatment, zero or above | months, or another unit of time used for both T_off and T_on |
T_on | Time the patient spent on the experimental treatment, zero or above and zero for a patient who never receives it | the same unit as T_off |
k | Factor above zero that multiplies psi for the patient, set by the analyst at baseline; 1 gives the common treatment effect model | ratio, no unit |
psi | Causal parameter of the model, below zero for a beneficial treatment; exp(psi) is untreated time per unit of time on treatment and exp(-psi) is the acceleration factor | log ratio, no unit |
U | Survival the patient would have had with no experimental treatment, on the same origin as the observed time | months, or the unit of T_off |
|---|---|---|
G | Observed survival less U, positive when the treatment extends survival | months, or the unit of T_off |
Function
Counterfactual survival and re-censoring function for treatment switching in a randomised trial
Maps one trial patient's observed time off and on the experimental treatment, a treatment effect psi, a modifier k, the potential censoring time and the event indicator to the survival the patient would have had with no experimental treatment, the time the treatment added, and the re-censored time and event indicator used in the adjusted analysis. HE-FM-TRES-001 holds the rank preserving structural failure time model, HE-FM-TRES-002 the re-censoring step, and the Computational Function HE-CF-TRES-001 estimates psi by the g-test. Whole-time scaling at a percentile of a reference curve is HE-FM-AFT-002, and HE-FM-AFT-001 gives a time ratio from an accelerated failure time coefficient, so those records are cited, not restated. Censoring switchers and reweighting non-switchers is HE-FM-DCEN-001, HE-FM-DCEN-002 and HE-FM-DCEN-003. An adjusted hazard ratio fitted to the counterfactual data and its log-scale interval are HE-FM-HR-002 and HE-FM-HR-006. The article's ICERs of GBP 85,714 and GBP 51,429 per QALY are HE-FM-ICER-001 applied to an incremental cost of GBP 30,000 and QALY gains of 0.35 and 0.58333, the gains being HE-FM-QALY-001 with one period at a utility of 0.7. Notation follows the Treatment Switching article.
Computational function
Computational function for g-estimation of the treatment effect in a rank preserving structural failure time model
Estimates the treatment effect psi of HE-FM-TRES-001 from patient records by g-estimation. For each value of psi on a grid it computes every patient's counterfactual time, runs the log-rank test of those times between randomised groups and records the statistic Z(psi). The estimate is the value at which Z crosses zero, because Z is a step function of psi with a log-rank test, and the 95% interval is the set of psi with the absolute value of Z below 1.96 (Allison and colleagues, section Theory). At psi of 0 the counterfactual times are the observed times, so Z(0) is the intention-to-treat log-rank statistic (derived), which fits TSD 16's statement that the method maintains the intention-to-treat p-value. The calculator line evaluates Z at one psi for a six-patient trial with every patient dying and no tied times, written out term by term; the grid, re-censoring, censored patients, ties and the search for the crossing are in the Excel, R and Python code. Re-censoring in the code is HE-FM-TRES-002.
Inputs and outputs:
T_off_1toT_off_6andT_on_1toT_on_6are each patient's time off and on the experimental treatment in months; patients 1 to 3 are the experimental arm and patients 4 to 6 the control arm;psiis the trial value of the log treatment effect;k_0is the modifier for the control arm, with 1 in the experimental arm;U_1toU_6are counterfactual times in months;a_iandb_iare the numbers at risk in the experimental and control arms at timeU_i;OEis observed minus expected deaths in the experimental arm;V_LRis its variance;Zis the g-test statistic. In the codet_off,t_on,arm(1 experimental, 0 control),eventandCare vectors with one entry per patient, andkis a vector, which the R code also accepts as a single value while the Python code needs a list;rec_arming_testis the one arm re-censored, the control arm by default, so a trial with switching in both arms needs that condition widened; the outputs are the estimate at the midpoint of the first crossing, the number of crossings and the interval limits.Assumption: The assumptions of HE-FM-TRES-001 hold (HE-AS-TRES-001 to HE-AS-TRES-003). The grid is wide enough to hold the crossing and the interval limits, and the step is fine against the spacing of the times. There may be more than one crossing, so the count is reported; TSD 24 section 4.2.1 says some software averages multiple solutions and that the analyst should look at the g-estimation output, and Allison and colleagues report only the first root with a warning. A grid point at which Z is exactly 0 counts as two crossings and puts the estimate half a step below that point, in both languages (checked here), so a count of 2 is read against the Z values. Limits may lie outside the search range, which the code returns as missing. Other tests can replace the log-rank (a Wilcoxon, or a Cox or Weibull Wald test), and TSD 24 says the choice should be justified. The calculator line counts one death per time, so it needs distinct counterfactual times among deaths; the code uses the hypergeometric variance, which handles ties.
Worked example (Toy trial just below the crossing): An illustrative trial has experimental patients on treatment until death at 15, 21 and 34 months, and control patients who die at 10 months unswitched, at 16 months after switching at 6 (the article's switcher) and at 28 months after switching at 8. At psi of -0.56 the experimental arm has 0.4333 more deaths than expected and Z is 0.3936 (computed here).
T_off_1 = 0; T_on_1 = 15; T_off_2 = 0; T_on_2 = 21; T_off_3 = 0; T_on_3 = 34; T_off_4 = 10; T_on_4 = 0; T_off_5 = 6; T_on_5 = 10; T_off_6 = 8; T_on_6 = 20; k_0 = 1; psi = -0.56; OE = 0.4333; V_LR = 1.2122; Z = 0.3936Worked example (Toy trial just above the crossing): At psi of -0.55 the patient with 34 months on treatment moves after the control patient who switched at 8 months, and Z falls to -0.5147 (computed here). Z changes sign where 34 r = 8 + 20 r, that is r of 4/7 and psi of -0.5596 (derived), so exp(psi_hat) is about 0.571 and each month on treatment counts as about 0.57 untreated months.
T_off_1 = 0; T_on_1 = 15; T_off_2 = 0; T_on_2 = 21; T_off_3 = 0; T_on_3 = 34; T_off_4 = 10; T_on_4 = 0; T_off_5 = 6; T_on_5 = 10; T_off_6 = 8; T_on_6 = 20; k_0 = 1; psi = -0.55; OE = -0.5667; V_LR = 1.2122; Z = -0.5147Worked example (Psi of 0 returns the intention-to-treat statistic): With psi of 0 the counterfactual times are the observed times and Z is -0.6963, the value of
survival::survdiffon the observed data (checked here).T_off_1 = 0; T_on_1 = 15; T_off_2 = 0; T_on_2 = 21; T_off_3 = 0; T_on_3 = 34; T_off_4 = 10; T_on_4 = 0; T_off_5 = 6; T_on_5 = 10; T_off_6 = 8; T_on_6 = 20; k_0 = 1; psi = 0; OE = -0.7667; V_LR = 1.2122; Z = -0.6963Excel: Put one patient per row in rows 2 to 7, with time off in column A, time on in B, arm (1 or 0) in C, event (1 or 0) in D and a modifier in J, and a trial value in a cell named GridPsi. In row 2 and filled down, E holds the counterfactual time
=A2+B2*EXP(J2*GridPsi), F the number at risk=SUMPRODUCT(--($E$2:$E$7>=E2)), G the experimental number at risk=SUMPRODUCT(--($E$2:$E$7>=E2),--($C$2:$C$7=1)), H the observed minus expected term=D2*(C2-G2/F2)and I the variance term=D2*G2*(F2-G2)/F2^2. A cell named GTestStatistic holds=SUM(H2:H7)/SQRT(SUM(I2:I7)). A one-variable Data Table (Data, What-If Analysis) on the same sheet as GridPsi, with GridPsi as the column input cell and=GTestStatisticin the cell above the first result, fills Z down a grid with limits of -3 and 3 and steps of 0.001 in the columns named GridColumn and ZColumn. Where Z falls as psi rises, a cell named PsiHat holds=(INDEX(GridColumn,MATCH(0,ZColumn,-1))+INDEX(GridColumn,MATCH(0,ZColumn,-1)+1))/2. MATCH with -1 needs ZColumn in descending order, so PsiHat is used only where Z never rises on the grid, as in the toy trial (checked here), and otherwise the crossing is read from the column. SUMPRODUCT is used because COUNTIF turns the criterion into 15-digit text, and a time can then fail to count itself as at risk. This sheet counts one death per row, so it needs distinct times among deaths, and it has no re-censoring unless columns E and D takeU_staranddelta_starof HE-FM-TRES-002, since a new E alone would keep cut deaths as events. A blank modifier counts as 0 and gives the observed times. If every Z on the grid is below zero MATCH returns #N/A, and if every Z is at or above zero INDEX returns #REF!.R:
g_test <- function(psi, t_off, t_on, arm, event, k = 1, C = NULL, rec_arm = 0) { r <- exp(k*psi); U <- t_off+t_on*r; d <- event; if (!is.null(C)) { D <- pmin(C, C*r); x <- arm == rec_arm & U > D; U[x] <- D[x]; d[x] <- 0 }; s <- tryCatch(survival::survdiff(survival::Surv(U, d) ~ arm), error = function(e) if (grepl('singular', conditionMessage(e))) NULL else stop(e)); if (is.null(s)) return(NaN); (s$obs[2]-s$exp[2])/sqrt(s$var[2, 2]) }rpsftm_grid <- function(t_off, t_on, arm, event, k = 1, C = NULL, grid = seq(-3, 3, by = 0.001)) { z <- sapply(grid, g_test, t_off, t_on, arm, event, k, C); i <- which(z[-1]*z[-length(z)] <= 0); ci <- grid[which(abs(z) < 1.96)]; list(psi = if (length(i)) (grid[i[1]]+grid[i[1]+1])/2 else NA, crossings = length(i), lower = if (length(ci) && min(ci) > min(grid)) min(ci) else NA, upper = if (length(ci) && max(ci) < max(grid)) max(ci) else NA) }Called witht_off = c(0, 0, 0, 10, 6, 8),t_on = c(15, 21, 34, 0, 10, 20),arm = c(1, 1, 1, 0, 0, 0)andevent = rep(1, 6)it returns psi -0.5595, one crossing, a lower limit of -1.386 and a missing upper limit, since Z stays above -1.96 up to psi of 3. WithC = rep(36, 6)re-censoring applies in the control arm and the same estimate and limits come back on this small trial. The function needs the survival package. With only one arm in the datasurvdiffstops with an error. At a psi where the variance is 0, for example every death tied at one time,g_testreturns NaN, catching the singular-system errorsurvdiffcan raise, and a crossing across that grid point is not counted. With no crossing psi is NA.Python:
import mathdef g_test(psi, t_off, t_on, arm, event, k=None, C=None, rec_arm=0): k = k or [1]*len(arm); r = [math.exp(m*psi) for m in k]; U = [a+b*x for a, b, x in zip(t_off, t_on, r)]; D = [min(c, c*x) if g == rec_arm else float('inf') for c, x, g in zip(C, r, arm)] if C else [float('inf')]*len(arm); d = [e*(u <= w) for e, u, w in zip(event, U, D)]; U = [min(u, w) for u, w in zip(U, D)]; ts = sorted({u for u, e in zip(U, d) if e}); rows = [(sum(u >= t for u in U), sum(u >= t and g == 1 for u, g in zip(U, arm)), sum(e for u, e in zip(U, d) if u == t), sum(e for u, e, g in zip(U, d, arm) if u == t and g == 1)) for t in ts]; oe = sum(o-m*a/n for n, a, m, o in rows); v = sum(m*a*(n-a)*(n-m)/(n*n*(n-1)) for n, a, m, o in rows if n > 1); return oe/math.sqrt(v) if v > 0 else float('nan')def rpsftm_grid(t_off, t_on, arm, event, k=None, C=None, lo=-3.0, hi=3.0, step=0.001): n = int(round((hi-lo)/step)); g = [lo+i*step for i in range(n+1)]; z = [g_test(p, t_off, t_on, arm, event, k, C) for p in g]; i = [j for j in range(n) if z[j]*z[j+1] <= 0]; ci = [p for p, y in zip(g, z) if abs(y) < 1.96]; return ((g[i[0]]+g[i[0]+1])/2 if i else None, len(i), ci[0] if ci and ci[0] > lo else None, ci[-1] if ci and ci[-1] < hi else None)Standard library only; the same inputs return (-0.5595, 1, -1.386, None), rounded. Withk = [1, 1, 1, 0.5, 0.5, 0.5], half the effect in the control arm, the estimate moves to -0.2985 and the limits to -1.223 and 1.008 (computed here).g_testreturns nan when the variance is 0, for example with one arm only, andrpsftm_gridthen returns None for the estimate with 0 crossings, because comparisons with nan are false, and a crossing across a single nan grid point is not counted.Test (Statistic just above the crossing): With the toy trial and GridPsi at -0.55, GTestStatistic is compared with the hand value -0.5147. Expected result TRUE. FALSE shows arms coded the wrong way round, which gives 0.5147, and a doubled (-1.0294) or halved (-0.2573) cell. Excel check
=ABS(GTestStatistic+0.5147)<0.001Test (Psi of 0 returns the intention-to-treat statistic): With the toy trial and GridPsi at 0, GTestStatistic is compared with -0.6963, the value
survival::survdiffgives on the observed times. Expected result TRUE. FALSE shows a variance term whose denominator is not squared, which gives -0.3475, and a doubled (-1.3927) or halved (-0.3482) cell. Excel check=ABS(GTestStatistic+0.6963)<0.001Test (Estimate at the analytic crossing): With the toy trial and the grid in place, PsiHat is compared with log(4/7), -0.5596, the point at which 34 r equals 8 + 20 r. Expected result TRUE. FALSE shows a crossing read from steps of 0.5, whose midpoint is -0.75, and a doubled (-1.119) or halved (-0.2798) cell. Excel check
=ABS(PsiHat-LN(4/7))<0.001Common error (Searching on too coarse a grid): Z is a step function, so a coarse grid places the crossing only roughly. In the toy trial steps of 0.5 bracket it between -1 (Z of 0.9482) and -0.5 (Z of -0.5147), whose midpoint of -0.75 gives exp(psi) of 0.472 in place of 0.571 (computed here). The search needs a step fine against the spacing of the times.
Common error (Scaling only the control arm during the g-test): The g-test compares counterfactual times in both arms, so experimental patients' time on treatment is scaled as well. Scaling only the control arm leaves Z negative at every psi of zero or below in the toy trial, -0.6963 at psi of 0 and -2.2476 at psi of -1.5, so no crossing appears there (computed here). Comparing counterfactual control times with observed experimental times is the later step that gives an adjusted hazard ratio once psi is found (Allison and colleagues, section Theory).
Source: Allison A, White IR, Bond S. rpsftm: An R Package for Rank Preserving Structural Failure Time Models. The R Journal. 2017;9(2):342-353. doi:10.32614/RJ-2017-068. Section Theory, heading RPSFTM method and assumptions, the g-estimation procedure, the crossing of zero by a step-function statistic and the test-based interval; heading Re-censoring; section Trouble shooting, on the absence of a guarantee of unique solutions. Latimer NR, Abrams KR. NICE DSU Technical Support Document 16: Adjusting survival time estimates in the presence of treatment switching. NICE Decision Support Unit; July 2014. doi:10.15131/shef.data.33847621, Appendix A, heading RPSFTM, the point estimate at a test statistic of zero and the maintained intention-to-treat p-value. Bell Gorrod H, Latimer NR, Abrams KR. NICE DSU Technical Support Document 24: Adjusting survival time estimates in the presence of treatment switching: an update to TSD 16. NICE Decision Support Unit; April 2024. doi:10.15131/shef.data.33850897, section 4.2.1, the g-test and multiple solutions. Magirr D. Non-proportional hazards in immuno-oncology: is an old perspective needed? Preprint arXiv:2007.04767v1, 2020, published as Pharmaceutical Statistics 2021;20(3):512-527, doi:10.1002/pst.2091 (not seen), preprint section 2.1, the expected number of events and hypergeometric variance at an event time, and equation 1, the sum of observed minus expected and its normal limit.
U_1 = T_off_1 + T_on_1 * exp(psi); U_2 = T_off_2 + T_on_2 * exp(psi); U_3 = T_off_3 + T_on_3 * exp(psi); U_4 = T_off_4 + T_on_4 * exp(k_0 * psi); U_5 = T_off_5 + T_on_5 * exp(k_0 * psi); U_6 = T_off_6 + T_on_6 * exp(k_0 * psi); a_1 = (U_1 >= U_1) + (U_2 >= U_1) + (U_3 >= U_1); b_1 = (U_4 >= U_1) + (U_5 >= U_1) + (U_6 >= U_1); a_2 = (U_1 >= U_2) + (U_2 >= U_2) + (U_3 >= U_2); b_2 = (U_4 >= U_2) + (U_5 >= U_2) + (U_6 >= U_2); a_3 = (U_1 >= U_3) + (U_2 >= U_3) + (U_3 >= U_3); b_3 = (U_4 >= U_3) + (U_5 >= U_3) + (U_6 >= U_3); a_4 = (U_1 >= U_4) + (U_2 >= U_4) + (U_3 >= U_4); b_4 = (U_4 >= U_4) + (U_5 >= U_4) + (U_6 >= U_4); a_5 = (U_1 >= U_5) + (U_2 >= U_5) + (U_3 >= U_5); b_5 = (U_4 >= U_5) + (U_5 >= U_5) + (U_6 >= U_5); a_6 = (U_1 >= U_6) + (U_2 >= U_6) + (U_3 >= U_6); b_6 = (U_4 >= U_6) + (U_5 >= U_6) + (U_6 >= U_6); OE = 3 - a_1 / (a_1 + b_1) - a_2 / (a_2 + b_2) - a_3 / (a_3 + b_3) - a_4 / (a_4 + b_4) - a_5 / (a_5 + b_5) - a_6 / (a_6 + b_6); V_LR = a_1 * b_1 / (a_1 + b_1)^2 + a_2 * b_2 / (a_2 + b_2)^2 + a_3 * b_3 / (a_3 + b_3)^2 + a_4 * b_4 / (a_4 + b_4)^2 + a_5 * b_5 / (a_5 + b_5)^2 + a_6 * b_6 / (a_6 + b_6)^2; Z = OE / sqrt(V_LR)
Try this function
Implementations
Excel
Counterfactual survival time cell for one trial patient
Named input cells TimeOffExperimental, TimeOnExperimental, PsiEstimate and EffectModifier hold the inputs. The formula goes in a cell named CounterfactualTime. A blank TimeOnExperimental counts as 0, which is right for a non-switcher, but a blank EffectModifier also counts as 0 and returns the observed survival with no adjustment and no error message, so the cell is set to 1 for the standard model.
=TimeOffExperimental+TimeOnExperimental*EXP(EffectModifier*PsiEstimate)
Excel
Time added by the experimental treatment cell
A cell named TimeAddedBySwitch takes the observed survival, TimeOffExperimental plus TimeOnExperimental, less CounterfactualTime. For a patient in the control arm who switches it reads as the time the switch added, 4 months in the article's example.
=TimeOffExperimental+TimeOnExperimental-CounterfactualTime
Assumptions
Common treatment effect per unit of time on treatment
With k of 1 the effect relative to time on treatment is the same for every patient, whether randomised to the experimental treatment or switching to it later (Allison and colleagues; TSD 24 section 4.2.1). TSD 16 section 3.2.2 calls this assumption more problematic than the randomisation assumption, because a different effect in switchers biases the estimate for the experimental group. TSD 16 section 3.3.1 adds that assessing it with trial data alone is unreliable, and that mechanism of action and clinical expert opinion matter.
Only the treatment received differs between randomised groups
The model assumes that the counterfactual times are independent of the randomised group, so the only difference between groups is the treatment received (Allison and colleagues, section Theory). TSD 16 section 3.2.2 calls this the randomisation or exclusion restriction assumption and says it should be reasonable in a randomised trial, with some risk of baseline differences.
Each patient is either on or off one experimental treatment
The model needs a patient to be either on or off at any one time. TSD 16 section 3.3.1 says that when control patients receive an active treatment followed by supportive care the off category represents more than one type of treatment and the model is not appropriate unless causal parameters are added, and that multi-parameter versions have not been successful. TSD 24 section 4.2.1 says the standard model does not apply to a switch onto a subsequent treatment that is not standard care.
On treatment and treatment group definitions of T_on
TSD 24 section 4.2.1 describes two uses. On an on treatment basis T_on counts only time actually receiving the experimental treatment. On a treatment group basis T_on counts all time after starting it, which may suit an effect that lasts past discontinuation or an active control. The analysis states which is used.
Modifier fixed at baseline and chosen by the analyst
Allison and colleagues require k above zero, leave its value to the analyst and assume in their package that it is determined at baseline. A modifier observed after randomisation is valid for defining U but may need more complicated re-censoring. The article's example of switchers possibly benefiting less is the case k is meant to test.
Two-stage reading of the same algebra
In Jackson and colleagues' conventional two-stage estimation a control patient switches at the secondary baseline, usually progression, and U is the time to that baseline plus the later survival divided by the acceleration factor phi, which equals this formula at T_off = S, T_on = T_star and psi = -log(phi) (derived). The estimation differs. Phi comes from an accelerated failure time model fitted to post-baseline control data, so the method assumes no unmeasured confounding at the secondary baseline (TSD 24 section 4.2.3) and does not need a common treatment effect (TSD 16 section 3.2.4). The simple method also assumes no time-dependent confounding between progression and a later switch (TSD 24 section 4.2.3).
The estimate of psi carries uncertainty the formula does not show
U treats psi as known. TSD 24 section 4.2.1 says the uncertainty is captured by bootstrapping the whole adjustment and model fitting, or by using the p-value from the intention-to-treat analysis when an adjusted hazard ratio is derived. PMG36 section 4.6.26 asks that, when appropriate, the uncertainty of a method that adjusts for crossover is explored and quantified.
Worked examples
Article's control patient who switches at progression
The article's illustrative control patient progresses at 6 months, switches at once and dies at 16 months, with exp(psi) of 0.6, written here as psi = log(0.6) to six decimals. The 10 months on treatment count as 6 untreated months, so U is 12 months and the treatment added 4, as in the article. All inputs are illustrative.
T_off = 6; T_on = 10; k = 1; psi = -0.510826; U = 12.000; G = 4.000
Limiting case of a control patient who never switches
With no time on the experimental treatment U equals the observed survival and G is 0 for any psi, so a non-switcher's data pass through the adjustment unchanged. The inputs are illustrative.
T_off = 20; T_on = 0; k = 1; psi = -0.510826; U = 20.000; G = 0.000
Experimental-arm patient treated until death
A patient on the experimental treatment for all 26 months has U of 15.6 months and G of 10.4. With T_off of 0 the relation takes the form of HE-FM-AFT-002 solved for t_C with a time ratio of exp(-psi), 1.6667, applied to one patient's time and not to a percentile (derived), since 26 = 1.6667 * 15.6. The inputs are illustrative.
T_off = 0; T_on = 26; k = 1; psi = -0.510826; U = 15.600; G = 10.400
Switcher given half the treatment effect with psi held at the article value
Setting k to 0.5 for the article's switcher gives a multiplier of 0.7746 in place of 0.6, so U is 13.746 months and the treatment added 2.254 in place of 4. Psi is held at the article's value for the arithmetic only; a real sensitivity analysis estimates psi again with k in the g-test (HE-CF-TRES-001). The inputs are illustrative.
T_off = 6; T_on = 10; k = 0.5; psi = -0.510826; U = 13.746; G = 2.254
Published sensitivity estimate applied to an illustrative deferred-arm patient
Allison and colleagues report a log-rank estimate of psi of -0.1704745 in the simulated immdef data set when the deferred arm has k of 0.5, with k of 1 in the immediate arm. For an illustrative deferred-arm patient with 1 year off and 2 years on treatment the multiplier is 0.9183, so U is 2.837 years. The patient's times are illustrative.
T_off = 1; T_on = 2; k = 0.5; psi = -0.1704745; U = 2.837; G = 0.163
Two-stage shrinkage of a switcher with an acceleration factor of 1.25
An illustrative switcher reaches the secondary baseline at 8 months and survives 15 months after it, with an acceleration factor phi of 1.25 from HE-FM-AFT-001, so psi is -log(1.25). Jackson and colleagues' equation 2 gives 8 + 15 / 1.25 = 20 months, the same as this formula. All inputs are illustrative.
T_off = 8; T_on = 15; k = 1; psi = -0.223144; U = 20.000; G = 3.000
Common errors
Dividing by the factor where the model multiplies
Using exp(-psi) on the time on treatment turns the correction round. The article's switcher then gets 6 + 10 / 0.6 = 22.667 months in place of 12, longer than the 16 months observed, so the switch appears to have shortened survival (derived).
Scaling the whole survival time and not only the time on treatment
Multiplying the switcher's full 16 months by 0.6 gives 9.6 months in place of 12, which also shrinks the 6 months before the switch (derived). Whole-time scaling is HE-FM-AFT-002 and applies to a survival curve, not to a patient who was on treatment for part of follow-up.
Reading exp(psi) as the factor by which the treatment multiplies survival
Exp(psi) of 0.6 is untreated time per unit of time on treatment, and the factor by which the treatment stretches time is its reciprocal, 1 / 0.6 = 1.667, the article's stretch. Allison and colleagues call exp(-psi) the acceleration factor and say that lifetime is used up exp(psi) times as fast on treatment; TSD 24 section 4.2.1 attaches the label time ratio to psi itself, so a reported time ratio needs its direction checked before it goes into the formula.
Multiplying the factor by the modifier in place of psi
The modifier scales psi inside the exponential. With k of 0.5 the switcher's time on treatment is multiplied by 0.7746, not by 0.5 * 0.6 = 0.3, so U is 13.746 months and not 9 (derived). The wrong form also moves U in the wrong direction, since a smaller effect should leave U closer to the observed 16 months.
Holding psi fixed when the modifier changes
Changing k without running the g-test again changes U but does not give the sensitivity result. In Allison and colleagues' immdef example the estimate itself moves, from -0.181 to -0.170, when the deferred arm is given k of 0.5.
Applying the model to switches onto a third treatment
Treating time on a subsequent treatment other than the experimental one as T_on assumes it has the experimental treatment's effect. TSD 24 section 4.2.1 says the standard model is not applicable to a switch onto a subsequent treatment that is not standard care; its section 4.2.3 describes two-stage estimation for such switches.
Sources
Allison, White and Bond on the counterfactual model and the treatment-effect modifier
Allison A, White IR, Bond S. rpsftm: An R Package for Rank Preserving Structural Failure Time Models. The R Journal. 2017;9(2):342-353. doi:10.32614/RJ-2017-068. Section Theory, heading RPSFTM method and assumptions, equation 1, the observed time as time off plus time on and the counterfactual time as time off plus time on times exp(psi), with exp(-psi) called the acceleration factor; the independence of counterfactual times from randomised group and the common treatment effect assumption. Heading Sensitivity analysis, the unnumbered expression that multiplies psi by a factor k above zero, assigned by the user and assumed determined at baseline. Section Using package rpsftm, the immdef results quoted in the worked example and common error.
NICE DSU TSD 24 on the counterfactual model and its uses
Bell Gorrod H, Latimer NR, Abrams KR. NICE DSU Technical Support Document 24: Adjusting survival time estimates in the presence of treatment switching: an update to TSD 16. NICE Decision Support Unit; April 2024. doi:10.15131/shef.data.33850897. Section 4.2.1, RPSFTM and IPE, equation 1, counterfactual time as time on the control treatment plus exp(psi) times time on the experimental treatment, the common treatment effect, the limit to switches between control and experimental treatments, the on treatment and treatment group bases, and how uncertainty is captured. Section 4.2.3, the time ratio from the two-stage model used in a counterfactual model similar to equation 1, and the assumptions of the simple method.
NICE DSU TSD 16 on the counterfactual model in the appraisal setting
Latimer NR, Abrams KR. NICE DSU Technical Support Document 16: Adjusting survival time estimates in the presence of treatment switching. NICE Decision Support Unit; July 2014. doi:10.15131/shef.data.33847621. Appendix A, heading RPSFTM, equation A2 as an integral of exp(psi A(t)) over observed time, described as the sum of time off treatment and time on treatment multiplied by exp(psi). Section 3.2.2, the common treatment effect assumption and the randomisation assumption. Section 3.2.4, the simple two-stage method without that assumption. Section 3.3.1, the need for patients to be on or off at any one time and the unreliability of testing the assumption with trial data.
Jackson and colleagues on the conventional two-stage counterfactual time
Jackson D, Ran D, Zhang F, Ouwens M, Druker V, Sweeting M, Hettle R, White IR. New Methods for Two-Stage Treatment Switching Estimation. Pharmaceutical Statistics. 2025;24(1):e2462. doi:10.1002/pst.2462. Section 4, Conventional Two-Stage Estimation, model 1 for post-secondary baseline survival with acceleration factor phi = exp(alpha), and equation 2, the counterfactual time as the time to the secondary baseline plus the later survival divided by phi, for control patients who switch at that baseline.
Robins and Tsiatis as the origin of the rank preserving model
Robins JM, Tsiatis AA. Correcting for non-compliance in randomized trials using rank preserving structural failure time models. Communications in Statistics, Theory and Methods. 1991;20(8):2609-2631. doi:10.1080/03610929108830654. The title names the model. Allison and colleagues state that the method is due to this paper; the method's wording in these records follows Allison and colleagues and the two NICE documents.
NICE manual on simple adjustment and uncertainty after crossover
National Institute for Health and Care Excellence. NICE technology appraisal and highly specialised technologies guidance: the manual (PMG36). Published 31 January 2022, last updated 13 October 2026, section 4.6.26. It says that statistical methods adjusting for treatment switching can also be presented when an intention-to-treat analysis is considered inappropriate, that simple methods such as censoring or excluding patients who cross over should be avoided because they are very susceptible to selection bias, and that when appropriate the uncertainty of the method should be explored and quantified.
Canonical Identity
Stable URI · Machine-readable · Resolvable · CC BY 4.0
