apopt.comCBE 493R Data-Driven Athletics

Course / Tutorials / Week 7 / CS-8

Case study CS-8 · Week 7 · about 60 min · Extension

Find a lactate threshold, and see if it moved

Apply four threshold rules to two SIMULATED step tests made with the production–clearance model, compare them with the true threshold the model knows, estimate each rule's typical error, and decide whether eight weeks of training moved the threshold.

  1. 1Gather (used)
  2. 2Statistics (used)
  3. 3Visualize (used)
  4. 4Cleanse (used)
  5. 5Features (used)
  6. 6Balance
  7. 7Scale
  8. 8Split
  9. 9Deploy
  1. Ask (this week)
  2. Collect
  3. Check (this week)
  4. Interpret (this week)
  5. Coach (this week)
  6. Reassess (this week)

Every cell runs in this page; the first run downloads Python (about 30 s). Nothing you load leaves your browser. Helpful first: Q-19 Interpolate a threshold from four points, CS-7 Critical speed from a watch archive.

The decision

A runner (invented for this study) did a lactate step test, trained for eight weeks, and did it again. Her coach wants to know: did the threshold move? If it did, her threshold sessions get faster; if the tests cannot tell, the paces stay and the testing plan changes.

Predict first

Training raised her lactate clearance capacity by 10%. Predict how far her true threshold speed moved, and whether one test before and one after will show it.

The raw data

Data dictionary
FieldMeaningUnitRangeMissing
testwhich test—A or Bnone
datetest date (invented)YYYY-MM-DD2027-01-11 and 2027-03-08none
stagestage numbercount1–8none
speed_kmhtreadmill speed for the stagekm/h10–17none
stage_minstage lengthmin3none
lactate_mmolsimulated blood lactate at the end of the stageread to 0.1mmol/L0.7–8.3empty when no reading
notewhat happened at the stagetext—empty

What is wrong with it: the data are simulated, so they hold only the faults that were put in. Those are meter noise (standard deviation 0.1 mmol/L plus 4% of the value), readings rounded to 0.1 mmol/L, a 2% day-to-day variation in production, and one failed strip in test B. Real tests add more: stage timing, sampling technique, diet and sleep before the test, and the meter itself. The stage length, 3 minutes, is short enough that lactate near the threshold has not reached its steady value when it is sampled.

Step by step

Every number in this study is simulated. There are no real step tests in the course files, and nobody in the course is asked to give blood. Instead, two step tests of one invented runner were generated from the production–clearance model of Section 7.4, with the meter noise and day-to-day variation a real test has. That has one large advantage: the true threshold is known, so you can see which threshold rules find it.

Step 1 · Gather

PythonStep 1 · Two simulated step tests, eight weeks apart

Type a prediction to enable Run.

Show the expected result without running
test       date  stage  speed_kmh  stage_min  lactate_mmol                    note
   A 2027-01-11      1       10.0          3           0.7                        
   A 2027-01-11      2       11.0          3           0.7                        
   A 2027-01-11      3       12.0          3           0.9                        
   A 2027-01-11      4       13.0          3           0.8                        
   A 2027-01-11      5       14.0          3           1.4                        
   A 2027-01-11      6       15.0          3           2.0                        
   A 2027-01-11      7       16.0          3           4.1                        
   A 2027-01-11      8       17.0          3           8.3                        
   B 2027-03-08      1       10.0          3           0.9                        
   B 2027-03-08      2       11.0          3           0.8                        
   B 2027-03-08      3       12.0          3           NaN strip error, no reading
   B 2027-03-08      4       13.0          3           1.2                        
   B 2027-03-08      5       14.0          3           1.2                        
   B 2027-03-08      6       15.0          3           2.1                        
   B 2027-03-08      7       16.0          3           3.6                        
   B 2027-03-08      8       17.0          3           8.2

Each test is a row per 3-minute stage, from 10 km/h upward by 1 km/h, stopped after the first stage above 6 mmol/L. One reading of test B is missing: the strip failed.

Step 2 · Statistics

PythonStep 2 · Profile each test

Show the expected result without running
            date  stages  readings  lowest  highest  top_speed
test                                                          
A     2027-01-11       8         8     0.7      8.3       17.0
B     2027-03-08       8         7     0.8      8.2       17.0

Both tests reached 17 km/h and stopped there, above 6 mmol/L. The lowest readings differ (0.7 against 0.8 mmol/L), which matters for any rule that starts from the lowest value.

Step 3 · Visualize, and Step 4 · Cleanse

The cleaning rule is short and written first: a stage without a reading is left out, never filled in, because every threshold rule below interpolates between stages anyway, and a filled value would be a guess dressed as a measurement.

PythonSteps 3–4 · The two curves, missing reading left out

Show the expected result without running
kept 15 of 16 stages; left out: [['B', 12.0, 'strip error, no reading']]
Simulated blood lactate in mmol/L against speed in km/h for test A (circles) and test B (squares). Both stay near 1 mmol/L to 14 km/h and bend upward; at 16 km/h B reads 3.6 against 4.1 for A, and both reach about 8 at 17 km/h.

The two curves nearly overlap. Test B reads a little lower at 16 km/h (3.6 against 4.1) and the same at 17. Whether there is a real shift under that noise is the question of this study.

Step 5 · Features: four threshold rules

A threshold is a rule applied to the curve, and there are dozens (Faude and colleagues counted 25 concepts in three families). Four common ones:

PythonStep 5 · Four rules on both tests

Type a prediction to enable Run.

Show the expected result without running
                    A      B  B - A
fixed 2.0       15.00  14.89  -0.11
fixed 4.0       15.95  16.09   0.13
baseline + 1.0  14.50  14.67   0.17
Dmax            14.88  15.02   0.14

The four rules spread over 1.45 km/h on the same test (14.50 to 15.95 km/h on test A), and they disagree on the change too: from −0.11 to +0.17 km/h. A coach who switched rules between tests could report almost any change. The rule must be fixed before the first test.

Which, if any, is right? In real life nobody knows. Here the model is known, so ask it.

Step 5 · The model behind the curves

Lactate is made all the time and used all the time: it is a major fuel for other tissues and the main raw material from which the liver makes glucose (Brooks, 2018). Section 7.4 writes blood lactate as a tank: V dL/dt = P − R(L). Production P rises with speed as faster fibres are recruited; clearance R grows with L but saturates at a ceiling, Rmax. While P stays below Rmax, lactate settles at a steady value, L* = K·P / (Rmax − P). Above it, no steady state exists and lactate climbs for as long as the pace is held. The speed where P = Rmax is the true threshold of this runner, the highest speed with a steady state. The simulation used K = 0.5 mmol/L and Rmax = 3.0 mmol/L per minute before training, 3.3 after (10% more clearance, a size chosen for illustration; MacRae and colleagues found higher lactate clearance after nine weeks of endurance training).

PythonStep 5 · True thresholds, and three 30-minute runs

Show the expected result without running
true threshold: A 15.62, B 16.06 km/h; moved +0.44 km/h
true steady-state lactate at the true threshold minus 0.5 km/h (A): 5.2 mmol/L
Two panels. Left, steady-state lactate against speed for the model before (solid) and after training (dashed), each rising steeply to a vertical asymptote at its true threshold, 15.62 and 16.06 km/h, with the simulated step-test readings as points; the region above each threshold is shaded as the severe domain. Right, lactate against time for 30-minute runs before training at 15.1, 15.5 and 16.0 km/h: the first flattens toward a plateau, the second is still climbing at 30 minutes, the third climbs steeply.

The true threshold moved by +0.44 km/h. On the right, half a kilometre an hour below it lactate flattens toward its steady value of 5.2 mmol/L; a little closer, at 15.5 km/h, it is still climbing after 30 minutes; above the threshold it never stops rising. Far below the threshold, at easy speeds, lactate settles within a few minutes. These are the three intensity domains that physiologists describe for lactate and oxygen uptake: a quick steady state (moderate), a late and high one (heavy), and none at all (severe). In people the boundary between heavy and severe is critical power, or critical speed for a runner (CS-7), and the maximal lactate steady state measured with blood sits on average about 7% below it (Jones and colleagues, 2019). The model has one boundary, the true threshold here; where its curve "first rises" is a matter of definition, which is one reason the rules disagree.

No rule found the true threshold of test A (15.62 km/h): three fell 0.6 to 1.1 km/h below it and fixed 4.0 landed 0.3 above. Nothing in the model makes 4.0 special; with other parameters a different rule would land closest. With 3-minute stages the blood has no time to reach its steady value near the threshold, so each reading there is below the steady state at that speed. Change the stage length in the model below and watch the curve move.

Model · lactate as a tank (simulated)
True limit (production = Rmax)
15.36 km/h
Fixed 4.0 mmol/L
13.78 km/h
Lowest + 1.0 mmol/L
12.11 km/h
Lowest + 0.5 mmol/L
11.31 km/h
0246810101112131415164 mmol/Ltrue limitspeed (km/h)lactate at end of stage (mmol/L)
Move over the chart to read values.

Raise the clearance capacity, as endurance training does, and the curve moves right: the same speed now makes less lactate. Shorten the stages and the curve moves right too, because lactate has not caught up with production by the end of a stage: the protocol moves the threshold. No rule finds the true limit exactly; each is a definition applied to a curve.

Step 5 · How much does a threshold move between two tests of the same runner?

Before saying the threshold moved, you need the typical error of each rule: how much it changes between two tests when nothing has changed. With a model, that is easy. Run test A 300 times with fresh meter noise and fresh day-to-day variation, and see how much each rule scatters.

PythonStep 5 · Typical error of each rule, by simulation

Type a prediction to enable Run.

Show the expected result without running
                mean (km/h)  typical error (km/h)  as % of mean  change without noise
fixed 2.0             14.49                  0.26          1.77                  0.66
fixed 4.0             15.83                  0.16          0.98                  0.38
baseline + 1.0        14.29                  0.26          1.84                  0.52
Dmax                  14.87                  0.09          0.58                  0.09

In the simulation each rule repeats within 0.09 to 0.26 km/h, under 2% of the speed. That is the noise that was put in, and no more. Real repeat tests are noisier: in 17 recreational runners tested twice in the same way, the threshold speed repeated with a coefficient of variation of 3.7% to 5.8%, depending on the curve model, and 5.4% for a fixed 3.5 mmol/L rule (Camargo Alves and colleagues, 2016). A simulation shows how the noise you know about propagates; it cannot tell you about the noise you left out.

The last column is what each rule would report with no noise at all: +0.09 to +0.66 km/h for a true change of +0.44. Even a perfect measurement depends on the rule.

Step 5 · Did it move?

Use the decision rule of Section 11.1. The coach and runner agreed beforehand that 0.2 km/h is worth having. For each rule, the noise in a change between two single tests is √2 × the typical error. Use two typical errors: the simulation's, and 4% of the speed, from real repeat tests.

PythonStep 5 · Chances of a real gain, rule by rule

Show the expected result without running
          rule        TE from  change  gain  trivial  loss
     fixed 2.0     simulation   -0.11  0.20     0.40  0.40
     fixed 2.0 real tests, 4%   -0.11  0.36     0.18  0.46
     fixed 4.0     simulation    0.13  0.38     0.55  0.06
     fixed 4.0 real tests, 4%    0.13  0.47     0.17  0.36
baseline + 1.0     simulation    0.17  0.46     0.37  0.16
baseline + 1.0 real tests, 4%    0.17  0.48     0.19  0.33
          Dmax     simulation    0.14  0.31     0.69  0.00
          Dmax real tests, 4%    0.14  0.47     0.19  0.34

The measured changes, −0.11 to +0.17 km/h, are smaller than any rule's noise-free change. The two test days were different: prepare.py gave test A a day with production 3.5% below average and test B a day 2.8% above, and that hid most of the gain. Even with the simulation's small errors no rule gives better than "possibly" (at most a 46% chance of a worthwhile gain), and with the error of real tests every rule sits near even odds. A true gain of +0.44 km/h, under 3% of the speed, cannot be seen in one test before and one after when a single test varies by about 4%. That is the finding, and it is about the measurement, not the runner. To see a change of this size, test twice each time with the rule and stage length fixed, or wait longer so the change can grow.

Without blood. Most athletes will never have a step test. Critical speed from a watch (CS-7) aims at the heavy–severe boundary itself (Jones and colleagues, 2019). The talk test aims lower: in 15 people the lactate threshold sat close to the last stages at which they answered "yes" or "yes, but" to "can you speak comfortably?" (Quinn and Coons, 2011). Section 7.4 rates four such methods; each has its own typical error, and the same arithmetic decides whether a change is real.

How good is the number?

Against the truth. On test A the rules gave 14.50 to 15.95 km/h against a true threshold of 15.62: three below it by 0.6 to 1.1 km/h, fixed 4.0 above it by 0.3. That ordering is a property of the chosen model, not a law.

Repeat tests. Simulated repeat tests of an unchanged runner scatter by 0.09 to 0.26 km/h (under 2%), depending on the rule. Real repeat tests scatter more: a coefficient of variation of 3.7% to 5.8% in 17 recreational runners (Camargo Alves and colleagues, 2016). The simulation can only show the noise that was put into it.

The decision. With a worthwhile change of 0.2 km/h and noise of √2 × the typical error, no rule gives more than a 48% chance of a worthwhile gain from these two tests. The honest answer is "unclear".

Action card

Action card
Finding
One test before and one after cannot tell whether her threshold moved; the true gain (+0.44 km/h, known only because this is a simulation) was hidden.
Evidence
The four rules reported −0.11 to +0.17 km/h; with real-test noise of about 4%, every rule gave roughly even odds of a worthwhile gain.
How sure
Sure that the tests cannot decide; the simulated numbers themselves describe an invented runner.
Action
Keep threshold paces where they are, and fix one rule (for example Dmax or fixed 4.0) and one stage length for every future test.
Test again
Test twice, a few days apart, at the end of the next block, and compare the means of two tests.

Track it

Nothing from this study goes into a real athlete's record: the data are simulated. With real step tests, add one row per test and name the rule in the metric: test=lactate-step-3min, metric=speed_at_4mmol_kmh, value, unit=km/h, protocol_version=3min-1kmh-v1.

Open your athlete record

With your own data

If you have real step-test results from a coach or laboratory, put them in the same columns and apply the four rules and the decision rule. Nobody in this course is required to give blood; Section 7.4 lists field methods that need none.

Check the AI

Given the two tests, an assistant wrote:

> Using the Dmax method, your threshold rose from 14.88 to 15.02 km/h. The method is very > repeatable (about 0.6%), so this 0.9% gain is real: your training block worked, and your > threshold runs can be 0.14 km/h faster.

What is wrong with it?

The 0.6% is the simulation's repeatability, which holds only the noise that was put in. Real repeat tests vary by about 4%, and even with 0.6% the decision rule gives only a 31% chance of a worthwhile gain (69% trivial). The change is not shown to be real.

Check yourself

  1. Why can a simulation show which threshold rule is closest to the truth, when a real test cannot?

  2. Why does a 3-minute stage near the threshold read lower than the steady-state lactate at that speed?

  3. Two single tests, a change of +0.17 km/h, a typical error of 0.58 km/h (4% of 14.5), and a worthwhile change of 0.2 km/h. What is the noise in the change?

    km/h

  4. Which change to the testing plan helps most to see a real gain of about 3%?

0 of 4 answered · 0 right the first time

Challenge: Design a test that can see the change

One test before and one after could not see a true gain of +0.44 km/h. Use the model to design a testing plan that can, before anyone gives a drop of blood.

  1. Use the simulation of Step 5 to make 300 simulated pairs of tests (before and after training), with the same noise.
  2. For one rule, find the share of pairs in which the decision rule says "likely" or better for a gain, with one test each time and with the mean of two.
  3. Change the stage length from 3 to 5 and 8 minutes and repeat. Which rule is least biased against the true threshold, and does the bias change the measured gain?
  4. Write the testing plan you would give the coach.

Hand in

How it is judged

Hints

    The solution unlocks after you make an attempt. Comparing your own attempt with it is where the learning happens.

    The same method in another field

    A simulation with a known answer is how engineers test a measurement method before trusting it on a real plant: generate data from a model, add the noise you expect, and see whether the estimator recovers the truth and how often. See the Machine Learning for Engineers notebooks on differential equations and interpolation.

    Acknowledgements

    Simulated data; no person was tested. The tank model is the one of Data-Driven Athletics Section 7.4. Training information only, not medical advice.

    References

    Built 2026-11-30 with Python packages numpy 2.5.5, pandas 3.1.1, matplotlib 3.11.2, scipy 1.18.1. In the browser the same code runs on Pyodide, so the last digit can differ.