41.32 Case 7: a covariate method tested on known truth, with too few replicates
What you will learn
- Say what
simulate-studymeasures: the operating characteristics of a covariate method on data whose truth is known.- Define sensitivity, false-positive rate, proxy rate, exact recovery and agreement, and compute them from replicate rows.
- See, in executed replicates, a false positive, an overestimated effect, and the refusal of a data set.
- Work out how many replicates a claim needs, and decline a claim the bundle cannot support.
Prerequisites: 41.31 and Chapter 29.
The question: the covariate engines of Case 5 (the frozen score engine, the posterior-stability engine and the refit-based search) each select covariates. How often does each select the right ones, and how often a wrong one?
The evidence: five Chapter 29 study bundles: study_primary, study_scm, study_stress, study_seed_a and study_seed_b. They are deliberately small (one or two replicates), and the lesson of the page is what that does to the evidence.
What a study does
nlmx simulate-study repeats a loop. For each scenario and replicate it simulates a data set from a known truth, fits the base model, runs the covariate analysis with the chosen engine(s), and compares each tested relationship with the truth. Every relationship has a truth label:
| Label | Meaning in these studies |
|---|---|
| true | a real effect: CL |
| proxy | CL~CRCL, a covariate that is a near-copy of eGFR: selecting it is not wrong, but not the true variable either |
| null | CL~SEX, with no effect: selecting it is a false positive |
and each engine gives every relationship a classification: retained (counts as selected), uncertain (does not count) or rejected. The study reports, per scenario and engine:
| Measure | Definition |
|---|---|
| Sensitivity | the share of the true relationships that were retained |
| False-positive rate | the share of the null relationships that were retained |
| Proxy rate | the share of replicates that retained the proxy |
| Exact recovery | the share of replicates that retained all the true ones and none other |
| Agreement | the share of relationships classified the same as the reference engine (the refit-based search when --scm-reference is given, otherwise the posterior engine is compared with the frozen one) |
The command of the first bundle:
nlmx simulate-study --scenarios rich,sparse --study-replicates 2 --subjects 50 \
--method both --model analytic --seed 29010 --threads 4
rich and sparse are two sampling schemes of the generated study; --method both runs the frozen and the posterior engine on each data set.
What two replicates look like
| Scenario | Engine | Replicates | Sensitivity | False-positive rate | Exact recovery | Seconds per replicate |
|---|---|---|---|---|---|---|
| rich | frozen | 2 | 0.33 | 0.50 | 0.00 | 0.8 |
| rich | posterior | 2 | 0.33 | 0.00 | 0.00 | 1.7 |
| sparse | frozen | 2 | 0.33 | 0.00 | 0.00 | 0.7 |
| sparse | posterior | 2 | 0.17 | 0.00 | 0.00 | 5.4 |
Read as a result, this table says the engines recover a third of the truth and the frozen engine has a 50 % false-positive rate. Read as the output of two replicates, it says almost nothing. With three true relationships and two replicates there are six chances, so sensitivity can only be 0, 1/6, 2/6 and so on (the 0.17 and 0.33 above); with one null relationship the false-positive rate can only be 0, 0.5 or 1. The value 0.50 is one replicate in which the null covariate was retained.
The per-replicate rows are stored (study_results.csv), and reading them is more instructive than the summary:
| Replicate (rich, frozen engine) | CL~WT | V~WT | CL~EGFR | CL~SEX (null) |
|---|---|---|---|---|
| 1 | retained (est. 0.665) | retained (0.972) | rejected (0.557) | rejected (−0.164) |
| 2 | uncertain (1.168) | uncertain (1.021) | uncertain (1.292) | retained (−0.740) |
In replicate 1 the engine found the two weight effects. In replicate 2 a different draw of 50 subjects left all three true effects uncertain and retained the null covariate with an estimate of −0.74: the one false positive in the table. Nothing here shows a software defect. Any selection rule with a non-zero threshold retains a null covariate now and then, and with two replicates one of them happened to be such a draw.
How many replicates a claim needs
A rate from R replicates has a binomial uncertainty, and the Wilson interval of the book (Chapter 24) gives it. For a false-positive rate of zero observed in R replicates the upper 95 % limit is 3.84/(R + 3.84):
| Replicates with no false positive | Upper 95 % limit of the rate |
|---|---|
| 2 | 0.66 |
| 10 | 0.28 |
| 30 | 0.11 |
| 73 | 0.05 |
| 100 | 0.037 |
So showing that a method's false-positive rate is below 5 % needs at least 73 replicates with none, and a rate that has to be judged against a nominal 5 % needs many more, because an observed 1 in 20 is exactly what a correct method would give. Sensitivity has the same arithmetic, three times over. The conclusion is operational: the number of replicates in a study is chosen from the claim to be made, and the claim "the engine is accurate" needs two orders of magnitude more than these bundles have. What the bundles are good for is the mechanics: they prove the loop runs, and they show what its rows look like.
One refit is worth a column: the frozen engine against the search
study_scm adds --scm-reference: the refit-based stepwise search (Case 5, page 41.20) is run on the same data set as the frozen engine, one replicate of 40 subjects.
| Relationship | Truth | Frozen engine | Estimate | Refit search | Estimate |
|---|---|---|---|---|---|
| CL~WT | 0.75 | uncertain | 1.139 | retained | 0.674 |
| V~WT | 1.0 | retained | 1.060 | retained | 0.966 |
| CL~EGFR | 0.6 | rejected | 0.509 | rejected | 0.509 |
| CL~SEX (null) | 0 | rejected | 0.174 | rejected | 0.174 |
| CL~CRCL (proxy) | – | rejected | 0.328 | rejected | 0.328 |
The two engines agree on four of five relationships (agreement 0.80) and differ on the one that matters, the clearance–weight effect. The frozen engine's one-step estimate is 1.139, a bias of +0.389 from the truth of 0.75; the refit finds 0.674, a bias of −0.076, and retains it. The same pattern is in the covariate case of this chapter (page 41.19): a conditional one-step quantity is not a refit, and a quantity that was uncertain in the frozen run can be resolved by refitting. The cost is in the last column of the report: 4.8 s per replicate for the refit search, 0.4 s for the frozen engine. One replicate does not tell how often this happens; it tells where to look.
Stress scenarios, and a guard that refused
study_stress runs three harder scenarios on 40 subjects with the frozen engine.
- correlated (strongly correlated covariates). The estimates are far from the truth: CL
WT 1.845 (truth 0.75), CLEGFR 1.467 (0.6), VWT 1.620 (1.0), with the two clearance effects classified uncertain and VWT retained, all on estimates inflated by 60–145 %. Inflated, unstable estimates are what strongly correlated covariates produce, since each estimate can absorb part of the other's effect; one replicate cannot isolate the cause, but it shows the symptom to look for. - rare-category (few subjects at one level of SEX, a real effect on clearance). Only V
WT is retained (sensitivity 0.25, one of four true effects); the real CLSEX effect, true value 0.4, is estimated at 0.393 and still rejected, most likely because a rare level leaves too little information to separate it from zero. A close estimate with an unconvincing test is the signature of an underpowered covariate. - high-shrinkage (strong shrinkage of the random effects). It produced no result at all. The report's Failures list says: OMEGA is not positive definite (diagonal [1.4757e-1, −1.0000e-7]). One variance of the fitted random-effects matrix is −1 × 10⁻⁷, at its boundary, and the covariate stage refuses to start from a matrix that is not positive definite. The scenario row shows 0 replicates and the second line of the report says why.
Two more bundles, study_seed_a and study_seed_b (20 subjects, seeds 111 and 999999, one replicate each), end the same way for a different reason: covariate SEX level 0 has only 9 subject(s). The study program checks the covariate data and refuses a data set in which a categorical level has too few subjects to estimate its effect. Both seeds produced the same refusal, so no replicate completed and no rate was reported (the operating-characteristics rows are empty). The right response is not to relax the check, but to raise the number of subjects: the guard is the rule of page 41.5 applied to simulated data.
The decision
| Question | Evidence | Decision | Reversible? |
|---|---|---|---|
| Is the study loop working? | five bundles, rows for every relationship, failures listed | yes | yes |
| What are the operating characteristics of the engines? | one or two replicates per scenario | cannot be decided; run at least ~70 replicates | yes |
| Does the frozen score agree with the refit? | 4 of 5 relationships; the one difference is CL~WT | no more than a pointer; see page 41.19 | yes |
| What does a refusal tell us? | 9 subjects in one level; 0 replicates | enlarge the simulated study; keep the failure in the report | yes |
What this case does not show
It does not show any operating characteristic with a usable precision, and it should not be quoted as one. It shows, in one place, what a study is, what one of its outputs looks like at the level of a row, and four failure modes (a false positive, an inflated estimate under collinearity, a data set refused for a sparse category, a base fit that could not be used). The Chapter 29 command has options to run a full study; the bundles here do not.
Review checklist
- Does the study report how many replicates completed, per scenario and engine, beside every rate?
- Can you say, for each rate you quote, the upper limit when zero events were observed?
- Do you keep the Failures list of a study in the report, rather than reporting only what ran?
- Do you read the replicate rows before the summary?
Navigation
See the previous page, the next page and the complete case-study reference.