Documentation

41.23 Case 5: three engines side by side, cheap checks first, and a run that survived an interruption

Three engines, one table; and a run that survived an interruption

What you will learn

  • Use inspect, validate and posterior as seconds-long checks before a long run.
  • Read the engine-comparison table of --method both, and the agreement labels in it.
  • Explain why the same candidate has a selection probability of 0.83 in one run and 0.88 in another.
  • Resume an interrupted stability run, confirm that it reproduces the uninterrupted result, and read the refusal when there is nothing to resume.

Prerequisites: 41.19, 41.20 and 41.22.

The question: where do the engines agree, and what do you do when a long run stops?

The evidence: the Chapter 25 bundles both, posterior_stage, resume_recovered and resume_uninterrupted_control, with the stored consoles of the inspect, validate, resume commands.

Three cheap commands before anything long

Before a stability run that takes minutes or hours, three commands cost almost nothing (the stored validate took 0.02 s and posterior 0.05 s) and catch most set-up mistakes.

Command What it does What the stored console shows
nlmx inspect … reads the model and data, builds the candidate list, fits nothing 5 candidates from 5 relationships, each with its equation; "Nothing was fitted (inspect)"
nlmx validate … --method both everything inspect does, plus an objective check and a sample of posterior feasibility base −2LL −1082.5614 over 60 subjects; OFV reproduction: nlmx −1082.561 vs the fit's −1082.561, difference −0.000; posterior feasibility 10 of 10 sampled subjects converged; "no blocking findings", total elapsed 0.02 s
nlmx posterior … reconstructs each subject's posterior and checks consistency, no stability selection 60 of 60 subjects from the stored estimates; the variance check of page 41.22: moment error 0.3 % and 0.5 %, shrinkage 2.9 % and 2.7 %; 12 files written

The OFV reproduction line is the useful one. It means the program, reading the stored fit, computes the same objective as the fit reported. If it did not, every later number would rest on a base that was not the one believed, and the right response would be to stop.

The engine comparison

--method both runs the frozen and the posterior engines on the same base and writes one table:

nlmx cov … --method both --seed 25048 --replicates 40 --draws-per-resample 1 \
           --learners adaptive-elastic-net,weighted-gls --no-uncertainty
Candidate Frozen Posterior (selection probability) Label
V ~ WT retained (p adj 3.6e-10) retained (0.950) concordant: retained by both
CL ~ WT uncertain (p adj 9.2e-6) retained (0.875) posterior retains; frozen does not confirm
CL ~ EGFR uncertain (p adj 3.5e-4) uncertain (0.775) uncertain in at least one engine
V ~ SEX rejected (p adj 0.95) rejected (0.000) concordant: rejected by both
CL ~ SEX rejected (p adj 0.95) rejected (0.050) concordant: rejected by both

The report's summary is Frozen: 1 retained / 2 uncertain of 5. Posterior: 2 retained / 1 uncertain of 5. The report states that "relationships retained by both engines carry the strongest evidence". Only V ~ WT earns that label; CL ~ WT has two partial endorsements; CL ~ EGFR has none from either engine alone.

The posterior engine's own joint refit of its two retained relationships (CL ~ WT and V ~ WT) has OFV −1141.867, 59.31 below the base: 1141.867 − 1082.561 = 59.306. That is the same number as the SCM's second forward step on page 41.20 (−1141.867 after adding V ~ WT and CL ~ WT), as it should be: the same two terms make the same model.

All three engines, one view

Candidate Frozen screen (41.19) SCM refit (41.20) Stability selection (41.22, 41.23)
V ~ WT retained retained retained
CL ~ WT uncertain retained retained
CL ~ EGFR uncertain retained uncertain
V ~ SEX rejected rejected rejected
CL ~ SEX rejected rejected rejected

Four of five candidates are classified the same way, or in a compatible way, by all three. The one candidate on which the engines disagree is CL ~ EGFR, and the disagreement has a clean description: the refit says that given the data as they are, removing it costs 15.9 OFV units (p 6.5e-5); the stability engine says that under half-sample resampling, it is selected 72–78 % of the time by the primary learner. Both statements are true. They answer different questions: whether the evidence in this data set is strong, and whether the selection would reproduce in a smaller or different sample.

The same candidate, two probabilities

CL ~ WT has a selection probability of 0.833 in the Chapter 24 run (60 replicates, three learners) and 0.875 in this one (40 replicates, two learners). This is not a contradiction. A probability from n selections has a sampling interval: the Wilson interval of the first is 0.757–0.889, and the second, 35 of 40, has 0.739–0.945. The two values lie well inside each other's intervals. When the number of replicates is small, probabilities near a threshold carry that much noise, and the way to reduce it is more replicates: the long run below uses 400.

The long run, interrupted

The Chapter 25 resume demonstration is a stability run with 400 replicates and one learner: 400 × 1 × 1 × 2 ETAs = 800 fits, with a checkpoint written after every unit (checkpoint_every = 1). The stored console of the first attempt ends:

scheduling 800 learner fit(s): 1 base draw(s) x 400 resample(s) x 1 posterior draw(s) x 1 learner(s) x 2 ETA(s)
progress 6/800 (0%) — stability replicates
FAILED during stage `stability selection`: cannot write checkpoint `…\checkpoint.json`: Access is denied. (os error 5)
exit code 3 (file discovery or I/O failure)

The run stopped because the operating system refused to write a file, not because anything was wrong with the analysis; the exit code is the I/O class. The stored checkpoint says what survived: 4 of 800 fits complete, next unit 2. Resuming is one command, without repeating the settings:

nlmx resume --run-dir <the run folder> --threads 2

The console shows that the program found the checkpoint (4 of 800 fit(s) merged), rebuilt the posteriors, and continued (resuming after 2 completed unit(s)) to 800 of 800. The report: Posterior engine: retained 2 of 5 parameter-covariate pairs (1 uncertain, 2 rejected) from 800 completed fit(s). With 400 replicates the primary-learner probabilities are V ~ WT 0.917, CL ~ WT 0.843, CL ~ EGFR 0.735, V ~ SEX 0.045 and CL ~ SEX 0.040.

Did the interruption change anything?

The test is to compare the recovered run with an uninterrupted control run from the same settings. The stored check compares the ten endpoint artifacts byte by byte (SHA-256):

analysis_results.json · selection_probabilities.csv · coefficient_stability.csv · form_stability.csv · learner_summary.csv · variance_consistency.json · retained_relationships.json · draft_model.ctl · draft_covariate_block.txt · equations.csv

Compared: 10. Byte-identical: 10. Different: 0. Logs, checkpoints, manifests and checksums are not expected to be identical, because they preserve the different histories of the two runs (one with an interruption). This is the right way to state a reproducibility claim: name the files, name the exceptions, give the count.

Resuming something that is finished

The last stored console tries to resume the recovered run again:

FAILED during stage `startup`: the run in `…\resume_recovered` already completed
exit code 11 (resume/checkpoint incompatibility)
hint: nothing to resume; start a new run to change settings

Exit 11 is the class for a run that cannot be resumed; here it is a refusal to redo finished work. The same class is used when a checkpoint is bound to different settings, so a changed analysis cannot silently continue from an old checkpoint.

The decision

Question Evidence Decision Reversible?
Which relationships does the covariate model contain? all three engines V ~ WT and CL ~ WT in every case; CL ~ EGFR kept, with its evidence stated yes
Is the set-up sound? validate: OFV reproduction, 10 of 10 feasible yes yes
Can an interrupted long run be trusted after resume? 10 of 10 endpoints identical yes yes

The choice about CL ~ EGFR is a judgement, and the case's honest record of it is: retained by the refit (ΔOFV 15.9 on removal), selected in 72–91 % of resamples depending on the design. The next page quantifies how large the effect is, which is what a reader needs to judge whether it matters.

What this case does not show

The resume demonstration shows one interruption at one point (after four fits). It does not show interruptions at every point, and it does not claim anything about an interruption that corrupts the checkpoint itself. The comparison table of --method both combines two engines' classes; it is not a third test.

Review checklist

  • Do you run inspect and validate before every long run, and read the OFV reproduction line?
  • Is a candidate's class on which engines differ written with each engine's evidence?
  • Do you state replicate counts next to selection probabilities?
  • After a resume, did you compare the endpoint files of an uninterrupted run, and name the files you expect to differ?

See the previous page, the next page and the complete case-study reference.