zahrcast
sia · methods · PIT

how the PIT works

The PIT histograms on each case study's diagnostics page ask one question of each patient: where did the observed outcome fall among the outcomes the model simulated for that patient? This page builds the answer one step at a time, with one example patient.

step 1

simulated event times for each patient

For every patient, the model simulates the patient's course many times, once for each posterior draw. Each simulation ends in an event week, or it reaches the end of the simulated follow-up without an event. The event is progression or death for progression-free survival, and death for overall survival. These simulated weeks are the patient's replicates. On the diagnostics pages each patient has about 2,000 of them, one per posterior draw. The example below uses 20 so that each one is visible.

The patient's observed week goes on the same axis, and the PIT counts the share of replicates that came earlier.

earlier—
same week—
PIT range—
plotted PIT—

An example patient with 20 replicate event weeks. Two of them reach the end of the simulated follow-up, week 60, without an event. Move the observed week, or mark the patient as censored, to see how the PIT changes.

step 2

the share of replicates that came earlier

PIT = (replicates with an event before the observed week) ÷ (all replicates)

A PIT of 0.30 means that 30% of the patient's replicates had the event earlier than the observed week. The observed week is then at the 30th percentile of the patient's predicted distribution. A PIT near 0 means the event came earlier than almost every replicate. A PIT near 1 means it came later than almost every replicate.

Two features of the data need more than this count. Weeks are whole numbers, and many patients have not had the event yet.

step 3

replicates in the observed week

Time is counted in whole weeks, so some replicates land in exactly the observed week. They are shown in the example as dots of the second color. A tied replicate is neither earlier nor later than the observed event, so the PIT is a range:

  • the low end counts only the replicates that are strictly earlier;
  • the high end also counts the tied replicates.

The histogram needs one number per patient, so the PIT is a point picked at random inside that range. Each patient has a fixed random number u between 0 and 1, so the histogram is the same on every page load:

PIT = low + u × (high − low)

Step 5 explains why the point is random and not the midpoint of the range.

step 4

patients who have not had the event

At an early data cut most patients are still event-free. For them, the event is only known to come after the observed week. Tick “censored” in the example to see this case.

Every replicate at or before that week is earlier than the real event. A replicate after it may be earlier or later, because the real event time is unknown. The PIT range therefore runs from the share of replicates at or before the censoring week up to 1, and the PIT is a point in that range picked with the same u.

event at week y: range from (share before y) to (share at or before y) censored at week y: range from (share at or before y) to 1

Two special cases:

  • A patient censored at week 0 has the range 0 to 1, which carries no information. These patients are left out, and the caption under each histogram gives how many.
  • An observed week after the end of the simulated follow-up is moved to the end and treated as censored, because the replicates do not extend beyond it.
step 5

why a calibrated model gives a flat histogram

Suppose the model is exactly right. Then the patient's real event time is one more draw from the same distribution as the replicates. Among the real time and the 20 replicates, the real time is equally likely to take any rank, from first to last. Its rank sets its PIT, so the PIT is equally likely to take any value from 0 to 1.

This holds for each patient. With one PIT per patient, a calibrated model gives a flat histogram. With 10 bins and n patients, each bin expects about n/10 patients.

The random point inside the range of a tie or a censored patient keeps this true. Always taking the low end of the range would move the PIT values toward 0, and always taking the midpoint would move them toward 0.5. A uniform random point inside the range keeps the histogram flat when the model is right. For censored patients this also requires that censoring is unrelated to when the event would have happened, which is the usual assumption in survival analysis.

step 6

shapes of the histogram

The five histograms below are made-up illustrations for 100 patients, not data. The dashed line is the flat count of 10 per bin.

The shaded band on the diagnostics pages shows how far a bin's count can move from n/10 by chance. Under a calibrated model a bin's count is Binomial(n, 0.1), and the band runs from its 10th to its 90th percentile. Each bin falls outside the band about 20% of the time by chance, so one or two of ten bins outside it is expected. A steady slope or a pile-up at one end is the pattern the band helps to separate from chance.

The caption under each histogram gives the share of PIT values from 0.1 to 0.9. A calibrated model puts about 80% of patients there. A share well below 80% means more outcomes in the tails than predicted, as in the U shape. A share well above 80% means the predictions are wider than the outcomes.

step 7

predicting each patient without their own data

The PIT in steps 1 to 6 is in sample. Each fit used the outcomes of the patients it predicts, so a patient's replicates already reflect that patient's own course. The leave-one-out PIT is the out-of-sample version. It asks where the observed outcome falls among the outcomes predicted by a fit that never saw the patient.

Refitting the model once per patient would take hundreds or thousands of fits. The existing posterior draws are reweighted instead. A draw under which all of the patient's data were likely gets a smaller weight, and a draw under which they were unlikely gets a larger one. The weighted draws then approximate a fit to every other patient. Pareto-smoothed importance sampling (PSIS) makes these weights stable by smoothing the largest of them.

The replicates are those with effects redrawn from the population. A replicate built on the patient's own estimated effects would still carry the patient's data through those effects. The PIT is then computed as in steps 2 to 4, with each replicate counting by its weight:

PIT = (weight of replicates with an event before the observed week) ÷ (total weight)

Ties and censored patients are handled as before, with weights in place of counts.

The weights can fail for a patient whose data pull the fit strongly, such as a patient unlike the others. A few draws then carry almost all of the weight. PSIS gives each patient a number, Pareto k^, that measures this. At most 0.5 is good, 0.5 to 0.7 is acceptable, and above 0.7 the weights, and that patient's leave-one-out PIT, are unreliable. The weights cover all of a patient's data at once, so a patient has one k^ for both endpoints.

step 8

scoring fits on the month after them

The leave-one-out PIT removes one patient at a time, but the fit still saw every later outcome of the other patients. The leave-future-out PIT scores each fit only on outcomes that came after its data. It needs a model refitted at many dates, so it is shown only for case studies where those fits were run.

Sia is refitted once a month, each time using only the data available at that date. Each fit is scored on a window that runs from its date to the date of the next fit. The last fit is scored up to the final data cut. A patient enters a window for an endpoint if the patient was in that fit, had not had the event at its date, and was followed past that date by the end of the window.

For each of these patients, the fit simulates replicates that start from the patient's record at its date, so every replicated event comes after that date. The observed week is the patient's status at the end of the window: the event week, or the last week the patient was known to be event-free. The PIT is then computed from the replicates exactly as in steps 2 to 4, including the random point for ties and for patients without the event.

The histograms pool all windows. A patient who has not had the event is scored again in each later window, so one patient can give several PIT values. These are patient-windows, and the histograms count them in place of patients. Values from the same patient are not independent. The shaded band assumes independent values, so it is narrower than the range the counts can take by chance. Single windows are not shown, because a late window can hold only one or two patients.

Each leave-future-out histogram also gives the C-index pooled over the windows. It measures how well the fits rank patients by risk. For each patient in a window, the forecast risk is the share of replicates with an event by the end of the window. Within a window and arm, a pair of patients is comparable when one had the event before the other was last seen. The pair is concordant when the patient with the earlier event had the higher forecast risk. Pairs with equal forecast risk count as half concordant. The C-index is the share of comparable pairs that are concordant, over all windows. A random ranking gives 0.5 and a perfect ranking gives 1.

step 9

on the diagnostics pages

choicewhat the pages showreason
histogramsone per endpoint and arm, for the selected fitCalibration can differ by arm and by endpoint.
patientsthe target trial's patients, one PIT eachThese are the patients the forecasts are about.
observed weekeach patient's status at the data cut: the event week, or the last week the patient was known to be event-freeAt a data cut only the follow-up up to that date is known, and the fit used only that data.
replicatesabout 2,000 per patient, one per posterior draw, from the patient's baseline covariates and burden; with effects redrawn from the population, the patient-level effects are drawn again from the fitted population distributionA check on single patients needs predictions for single patients.
barssplit into patients with an event and censored patients, for arms with at least 20 patientsAt early cuts most patients are censored, and the split shows which group fills a bin. Smaller arms show only the total, so that no bar describes one patient.
left outpatients censored at week 0Their PIT range is 0 to 1.
in or out of samplea control switches the histograms between the in-sample PIT, the leave-one-out PIT, which is available for the full data fit, and, where the monthly fits were run, the leave-future-out PIT, which is then shown firstThe leave-one-out weights are computed once, for the fit to all the data. The leave-future-out PIT pools many fits and does not depend on the fit selected.
Pareto k^the number of patients in each class, in the caption under each leave-one-out histogramThe counts describe how reliable a histogram is without giving any one patient's value.
leave-future-out valuespooled over all windows, in the histogram and the caption: patient-windows, events, mean PIT and C-indexA late window can hold one or two patients, so a value for one window could describe a single patient.
limits

what to keep in mind

  • Small arms give noisy histograms. At an early cut an arm can have 5 patients. Ten bins over 5 patients cannot show a shape, and the share in the caption is also uncertain.
  • Censored patients carry less information. Their PIT is a random point in a wide range, so an arm with mostly censored patients gives a flatter histogram than its patients with events alone would. Patients with an event give the sharper check.
  • The fit has seen these patients. Each fit used the data up to its cut, including these patients, so even a calibrated model moves the PIT values slightly toward the middle. For this reason a hump is weaker evidence of predictions that are too wide than a U shape is of predictions that are too narrow. The leave-one-out PIT in step 7 removes this effect, as far as the weights are reliable, and the leave-future-out PIT in step 8 removes it.
  • Leave-future-out values are not independent. One patient can be scored in several windows, so the shaded band understates how far the counts can move by chance.

The PIT histograms for each fit are on the diagnostics page of each case study: small-cell lung cancer, colorectal cancer, prostate cancer, pancreatic cancer.