| Title: | Mathematical Models of Training Load and Training Response |
|---|---|
| Description: | Implements mathematical models used in sport science to describe training load and its relationship with training response, including descriptors of daily training load and impulse-response models. |
| Authors: | Jorge del Rosario Fernández Santos [aut, cre, cph] (ORCID: <https://orcid.org/0000-0002-5047-2976>) |
| Maintainer: | Jorge del Rosario Fernández Santos <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.0.4 |
| Built: | 2026-11-30 11:36:52 UTC |
| Source: | https://github.com/JorgeDelro/trainingmodels |
Converts a data frame with one row per training session (or per day) into
a complete daily calendar with one row per athlete and day. This is the
single entry point for every analysis in the package: descriptors and
impulse-response models take a daily_load object.
as_daily_load( data, date, load, athlete = NULL, performance = NULL, gaps = c("rest", "missing"), max_gap = 7, date_format = NULL )as_daily_load( data, date, load, athlete = NULL, performance = NULL, gaps = c("rest", "missing"), max_gap = 7, date_format = NULL )
data |
A data frame with one row per session (or per day). |
date |
Name of the date column. The column must be of class |
load |
Name of the load column: numeric, |
athlete |
Name of the athlete identifier column, or |
performance |
Name of a numeric performance column, or |
gaps |
How to treat days with no row between an athlete's first and
last date: |
max_gap |
A single non-negative whole number. A warning is given for
each run of more than |
date_format |
Format used to parse a character date column, as in
|
An object of class c("daily_load", "data.frame") with one row per
athlete and day, sorted by athlete and date, and the columns:
athlete (character);
date (Date), consecutive within each athlete;
load (numeric), the sum of the day's sessions;
status (factor with levels "training", "rest", "missing");
n_sessions (integer), the number of rows in data for that day, 0
for filled days;
filled (logical), TRUE for days that had no row;
performance (numeric), only if performance was given.
The attributes gaps and load_name record the gap option used and the
name of the load column.
Every day has exactly one of three states (DECISIONS.md, D-015):
training: the load of the day is greater than 0;
rest: the load of the day is 0;
missing: the load of the day is not available (NA).
Sessions on the same day are summed. If any session of a day has an NA
load, the whole day is NA and its state is "missing": a missing load is
never silently replaced (D-016).
Each athlete's calendar runs from their own first to their own last date.
Days in between that have no row are added and marked filled = TRUE.
By default (gaps = "rest") they are treated as rest days with load 0;
with gaps = "missing" they get load NA and state "missing" (D-015).
The calendar ends at the athlete's last row: rest days after the last
session are not added, so trailing rest days must be given as rows with
load 0 to be included.
A message reports how many days were filled. Whatever gaps is, a warning
is given for every run of more than max_gap consecutive filled days,
because a long run without data is as likely to be missing data as rest.
A data file may hold several athletes (identified by the column named in
athlete) and several load columns; each call uses one load column
(D-017). Its name is kept in the attribute load_name.
print.daily_load(), summary.daily_load().
sessions <- data.frame( athlete = c("A", "A", "A", "A", "B", "B"), date = c("2026-01-01", "2026-01-01", "2026-01-02", "2026-01-05", "2026-01-03", "2026-01-04"), srpe = c(300, 150, 0, NA, 420, 380), jump = c(41.2, NA, NA, 40.5, NA, 38.9) ) x <- as_daily_load(sessions, date = "date", load = "srpe", athlete = "athlete", performance = "jump") x summary(x) # Days without a row treated as missing instead of rest as_daily_load(sessions, date = "date", load = "srpe", athlete = "athlete", gaps = "missing")sessions <- data.frame( athlete = c("A", "A", "A", "A", "B", "B"), date = c("2026-01-01", "2026-01-01", "2026-01-02", "2026-01-05", "2026-01-03", "2026-01-04"), srpe = c(300, 150, 0, NA, 420, 380), jump = c(41.2, NA, NA, 40.5, NA, 38.9) ) x <- as_daily_load(sessions, date = "date", load = "srpe", athlete = "athlete", performance = "jump") x summary(x) # Days without a row treated as missing instead of rest as_daily_load(sessions, date = "date", load = "srpe", athlete = "athlete", gaps = "missing")
Computes fitness, fatigue and predicted performance when the same load is done every day from day 1, with the closed forms of Morton et al. (1990, Eqs. 6, 9-11), the asymptote of predicted performance and the day of poorest performance (MODELS.md, M-04). Nothing is fitted: the parameters are given by the user. The initial state is 0.
constant_training( load, k1, tau1, k2 = NULL, tau2 = NULL, p0 = 0, model = c("two_component", "fitness_only"), days = 100, same_day_load = c("exclude", "include") )constant_training( load, k1, tau1, k2 = NULL, tau2 = NULL, p0 = 0, model = c("two_component", "fitness_only"), days = 100, same_day_load = c("exclude", "include") )
load |
Daily training load, a single finite number |
k1 |
Gain of fitness, a single finite number |
tau1 |
Time constant of fitness in days, a single finite number
|
k2 |
Gain of fatigue, a single finite number |
tau2 |
Time constant of fatigue in days, a single finite number
|
p0 |
Baseline performance, a single finite number. |
model |
|
days |
Last day of the curve, a single whole number |
same_day_load |
Timing convention: |
A list of class "constant_training" with the elements
curve: a data frame with the columns day (1 to days), fitness,
fatigue (NA for the fitness-only model) and predicted;
asymptote: predicted performance as days grow;
time_of_minimum: day of poorest performance, or NA;
load, model, same_day_load, days and parameters: the
arguments used.
For a daily load and the time constant of either
component,
under same_day_load = "include" and "exclude" (the default, D-012).
These equal simulate_banister() on a series of constant load.
The asymptote is the predicted performance as days grow. It depends on
the convention: since ,
the "exclude" asymptote is the "include" one minus
:
The day of poorest performance (Morton et al. 1990, Eq. 10; their
, named in words here, D-026) is
the same under both conventions. It is a continuous time: the day with the
lowest predicted value in curve is the nearest whole day.
time_of_minimum is NA when there is no minimum: when
, when the argument of the logarithm
is (fatigue is too small for performance to dip), when
(performance only falls), and for the fitness-only
model (performance only rises).
Morton RH, Fitz-Clarke JR, Banister EW (1990). Modeling human performance in running. Journal of Applied Physiology, 69(3), 1171-1177.
simulate_banister(), session_response(), half_life().
# Morton et al. (1990): load 100 every day constant_training(100, k1 = 1, tau1 = 45, k2 = 2, tau2 = 15, same_day_load = "include")# Morton et al. (1990): load 100 every day constant_training(100, k1 = 1, tau1 = 45, k2 = 2, tau2 = 15, same_day_load = "include")
half_life() gives the number of days for a component to fall to half,
, and time_constant() gives the time
constant of a half-life (MODELS.md, Notation).
half_life(tau) time_constant(half_life)half_life(tau) time_constant(half_life)
tau |
Time constants in days: a numeric vector of positive finite numbers. |
half_life |
Half-lives in days: a numeric vector of positive finite numbers. |
Impulse-response functions take time constants, never half-lives; print methods show the half-life next to each time constant (DECISIONS.md, D-024).
A numeric vector of the same length.
simulate_banister(), session_response().
half_life(c(45, 15)) time_constant(7)half_life(c(45, 15)) time_constant(7)
Computes Foster's (1998) training monotony and strain for every day, over
a rolling window of window days (7 by default), within each athlete
(MODELS.md, M-12).
monotony_strain(x, window = 7, same_day_load = c("include", "exclude"))monotony_strain(x, window = 7, same_day_load = c("include", "exclude"))
x |
A |
window |
Length of the window in days, a single whole number |
same_day_load |
Whether the window ends on the current day
( |
A data frame with one row per row of x, in the same order, and
the columns athlete, date, load, window_load, mean_load,
sd_load, monotony and strain. The attributes window and
same_day_load record the arguments used.
For the loads of the window,
where the window load is the sum of the loads and the SD is the sample
standard deviation (divisor ). Foster (1998) defines them over a
week; the package uses a rolling window computed every day (D-022). The
window is the one of rolling_load() (MODELS.md, M-11).
With same_day_load = "include" (the default) the window ends on the
current day; with "exclude" it ends on the previous day. The default
differs from the impulse-response models, whose default is "exclude"
(DECISIONS.md, D-021 and D-012).
A day with a missing load makes every window that contains it NA in
every result column (D-016). Windows that do not fit in the series are
NA: there are no partial windows.
Rest days count as load 0. Foster (1998) does not say how rest days are treated; the result depends on this choice.
When all loads of the window are equal (for example seven rest days),
sd_load is 0 and monotony and strain are NA (D-022). Equality is
tested on the loads themselves, not on the computed standard deviation.
Monotony divides by a standard deviation, so it is unstable when the days of the window are similar. The article "Monotony and strain" on the package website discusses its limitations.
chronic workload ratio: Ratios of rolling loads and EWMA-based loads are not provided here: see the ACWR package (DECISIONS.md, D-019).
Foster C (1998). Monitoring training in athletes with reference to overtraining syndrome. Medicine and Science in Sports and Exercise, 30(7), 1164-1168.
rolling_load(), srpe_load(), as_daily_load().
# The week of Foster (1998), Table 1 week <- data.frame( date = as.Date("2026-01-04") + 0:6, load = srpe_load(rpe = c(5, 7, 2, 6, 7, 2, 7), duration = c(180, 120, 20, 90, 75, 20, 120)) ) x <- as_daily_load(week, date = "date", load = "load") monotony_strain(x)# The week of Foster (1998), Table 1 week <- data.frame( date = as.Date("2026-01-04") + 0:6, load = srpe_load(rpe = c(5, 7, 2, 6, 7, 2, 7), duration = c(180, 120, 20, 90, 75, 20, 120)) ) x <- as_daily_load(week, date = "date", load = "load") monotony_strain(x)
Prints a header (number of athletes, date range, number of days, counts by day state and number of filled days) followed by the first rows.
## S3 method for class 'daily_load' print(x, n = 10, ...)## S3 method for class 'daily_load' print(x, n = 10, ...)
x |
A |
n |
Number of rows to show. |
... |
Passed to |
x, invisibly.
x <- as_daily_load( data.frame(date = c("2026-01-01", "2026-01-03"), load = c(300, 250)), date = "date", load = "load" ) print(x)x <- as_daily_load( data.frame(date = c("2026-01-01", "2026-01-03"), load = c(300, 250)), date = "date", load = "load" ) print(x)
Prints a header with the model, the timing convention, the parameters and the half-life of each time constant (DECISIONS.md, A-012 and D-024), followed by the first rows of the simulation.
## S3 method for class 'session_response' print(x, ...) ## S3 method for class 'constant_training' print(x, ...) ## S3 method for class 'banister_sim' print(x, n = 10, ...)## S3 method for class 'session_response' print(x, ...) ## S3 method for class 'constant_training' print(x, ...) ## S3 method for class 'banister_sim' print(x, n = 10, ...)
x |
A |
... |
Passed to |
n |
Number of rows to print. |
x, invisibly.
x <- as_daily_load( data.frame(date = as.Date("2026-01-01") + 0:9, load = rep(100, 10)), date = "date", load = "load" ) print(simulate_banister(x, k1 = 1, tau1 = 45, k2 = 2, tau2 = 15), n = 5)x <- as_daily_load( data.frame(date = as.Date("2026-01-01") + 0:9, load = rep(100, 10)), date = "date", load = "load" ) print(simulate_banister(x, k1 = 1, tau1 = 45, k2 = 2, tau2 = 15), n = 5)
Computes, for every day, the sum and the mean of the daily loads over a
window of window days, within each athlete (MODELS.md, M-11).
rolling_load(x, window = 7, same_day_load = c("include", "exclude"))rolling_load(x, window = 7, same_day_load = c("include", "exclude"))
x |
A |
window |
Length of the window in days, a single whole number |
same_day_load |
Whether the window ends on the current day
( |
A data frame with one row per row of x, in the same order, and
the columns athlete, date, load, rolling_sum and rolling_mean.
The attributes window and same_day_load record the arguments used.
For the daily loads of one athlete
and a window of days:
same_day_load = "include" (the default): the window ends on the
current day,
defined for ;
same_day_load = "exclude": the window ends on the previous day,
defined for . This is the form of Carey et
al. (2017, Eq. 1).
The rolling mean is . The two options are related by
"exclude" on day = "include" on day .
The default is same_day_load = "include" (DECISIONS.md, D-021). This
differs from the impulse-response models, whose default is "exclude"
(D-012).
A day with a missing load makes every window that contains it NA
(D-016); missing loads are never filled. Windows that do not fit in the
series (the first days with "include", the first with
"exclude") are NA: there are no partial windows. Rest days count as load
0. Days added by as_daily_load() count as rest or as missing according to
its gaps argument.
chronic workload ratio: Ratios of rolling loads and EWMA-based loads are not provided here: see the ACWR package (DECISIONS.md, D-019).
Carey DL, Blanch P, Ong K-L, et al. (2017). Training loads and injury risk in Australian football—differing acute:chronic workload ratios influence match injury risk. British Journal of Sports Medicine, 51, 1215-1220.
monotony_strain(), srpe_load(), as_daily_load().
x <- as_daily_load( data.frame(date = as.Date("2026-01-01") + 0:9, load = c(300, 0, 450, 500, 0, 0, 620, 410, 380, 0)), date = "date", load = "load" ) rolling_load(x, window = 3) rolling_load(x, window = 3, same_day_load = "exclude")x <- as_daily_load( data.frame(date = as.Date("2026-01-01") + 0:9, load = c(300, 0, 450, 500, 0, 0, 620, 410, 380, 0)), date = "date", load = "load" ) rolling_load(x, window = 3) rolling_load(x, window = 3, same_day_load = "exclude")
Opens the teaching app of the package in a browser: one screen, "Response
to a single session", with sliders for the parameters of the Banister
model and the curve, time_to_recover and time_to_peak given by
session_response(). The same app is published as a static site that runs
in the browser without R, at
https://jorgedelro.github.io/trainingmodels/app/ (DECISIONS.md, D-031).
run_app(...)run_app(...)
... |
Arguments passed to |
The app needs the shiny package, which is suggested but not required by trainingmodels.
Called for its side effect; returns when the app is stopped.
session_response() and the article "The Banister model".
if (interactive() && requireNamespace("shiny", quietly = TRUE)) { run_app() }if (interactive() && requireNamespace("shiny", quietly = TRUE)) { run_app() }
Computes the effect on predicted performance of one unit of load on the days after a single session (the influence curve), the time until that effect becomes positive and the time until it is largest (MODELS.md, M-05). Nothing is fitted: the parameters are given by the user.
session_response( k1, tau1, k2 = NULL, tau2 = NULL, model = c("two_component", "fitness_only"), days = 60, same_day_load = c("exclude", "include") )session_response( k1, tau1, k2 = NULL, tau2 = NULL, model = c("two_component", "fitness_only"), days = 60, same_day_load = c("exclude", "include") )
k1 |
Gain of fitness, a single finite number |
tau1 |
Time constant of fitness in days, a single finite number
|
k2 |
Gain of fatigue, a single finite number |
tau2 |
Time constant of fatigue in days, a single finite number
|
model |
|
days |
Last day of the curve, a single whole number |
same_day_load |
Timing convention: |
A list of class "session_response" with the elements
curve: a data frame with the columns day (0 to days) and
effect (effect on predicted performance per unit of load);
time_to_recover, time_to_peak (days) and peak_effect (per unit
of load), each a number or NA;
model, same_day_load, days and parameters: the arguments used.
The effect days after one unit of load is
for the two-component model, and
for the fitness-only model. For ,
and peak_effect is at time_to_peak. These are and
of Clarke & Skiba (2013) and Busso & Chalencon (2023); they are
named in words because Morton et al. (1990) use for a different
quantity, the time_of_minimum of constant_training() (DECISIONS.md,
D-026).
The times do not depend on the convention. Only the effect on the day of
the session (day 0 of curve) does: with
same_day_load = "include", 0 with "exclude" (the default, D-012).
From day 1 on, both conventions give .
The times are NA when they do not exist (D-026):
time_to_recover is NA when : the effect is
positive from the first day after the session, so there is nothing to
recover from.
time_to_peak and peak_effect are NA when
: the effect is
largest right after the session and only decreases.
Both are NA when (the effect is never positive),
when (fatigue does not fade faster
than fitness), and for the fitness-only model (there is no fatigue).
Clarke DC, Skiba PF (2013). Rationale and resources for teaching the mathematical modeling of athletic training and performance. Advances in Physiology Education, 37, 134-152.
Busso T, Chalencon S (2023). Validity and accuracy of impulse-response models for modeling and predicting training effects on performance of swimmers. Medicine & Science in Sports & Exercise, 55(7), 1274-1285.
Ceddia D, Bondell H, Taylor P (2025). Mathematical modelling and optimisation of athletic performance: tapering and periodisation. arXiv:2505.20859 (preprint).
simulate_banister(), constant_training(), half_life().
# Parameters of Morton et al. (1990) r <- session_response(k1 = 1, tau1 = 45, k2 = 2, tau2 = 15) r head(r$curve) # Fit of Clarke & Skiba (2013) session_response(k1 = 0.18258, tau1 = 35.821, k2 = 0.23016, tau2 = 21.340)# Parameters of Morton et al. (1990) r <- session_response(k1 = 1, tau1 = 45, k2 = 2, tau2 = 15) r head(r$curve) # Fit of Clarke & Skiba (2013) session_response(k1 = 0.18258, tau1 = 35.821, k2 = 0.23016, tau2 = 21.340)
Computes fitness, fatigue and predicted performance for every day of a daily training-load series, within each athlete, from parameters given by the user (MODELS.md, M-01 to M-03). Nothing is fitted: this version only simulates.
simulate_banister( x, k1, tau1, k2 = NULL, tau2 = NULL, p0 = 0, model = c("two_component", "fitness_only"), same_day_load = c("exclude", "include"), initial_fitness = 0, initial_fatigue = 0, missing_load = c("error", "zero") )simulate_banister( x, k1, tau1, k2 = NULL, tau2 = NULL, p0 = 0, model = c("two_component", "fitness_only"), same_day_load = c("exclude", "include"), initial_fitness = 0, initial_fatigue = 0, missing_load = c("error", "zero") )
x |
A |
k1 |
Gain of fitness, a single finite number |
tau1 |
Time constant of fitness in days, a single finite number
|
k2 |
Gain of fatigue, a single finite number |
tau2 |
Time constant of fatigue in days, a single finite number
|
p0 |
Baseline performance, a single finite number. |
model |
|
same_day_load |
Timing convention: |
initial_fitness, initial_fatigue
|
Fitness and fatigue on day 0, single
finite numbers |
missing_load |
What to do with missing loads: |
An object of class c("banister_sim", "data.frame") with one row
per row of x, in the same order, and the columns athlete, date,
load, fitness, fatigue (NA for the fitness-only model),
predicted and, if x has a performance column, observed. The
attributes model, same_day_load, parameters (named numeric vector)
and initial_state record the arguments used. Its print method shows
them, with the half-life of each time constant.
Fitness and fatigue are exponential filters of the daily
load with time constants and
(MODELS.md, M-01). The two-component model (M-02) predicts
and the fitness-only model (M-03) predicts
The columns fitness and fatigue are and without their
gains. They are computed in recursive form.
same_day_load = "exclude" (the default; Busso & Chalencon 2023): the
load of day affects performance from day ,
This corresponds to a performance test done before that day's training.
same_day_load = "include" (Morton et al. 1990, Eqs. 4-5): the load of
day counts on day at full weight,
The two conventions give different numbers: gains obtained under one are
not comparable with the other. The default "exclude" (DECISIONS.md, D-012)
differs from the default of the load descriptors such as rolling_load(),
which is "include" (D-021).
Fitness and fatigue start from initial_fitness and initial_fatigue
on day 0, both 0 by default (D-025). An initial value adds
to day under both
conventions (MODELS.md, M-01). Each athlete starts from the same initial
state on their first day.
Missing loads are never replaced silently (D-016). By default a series
with a missing load is an error that names the first missing day. With
missing_load = "zero" missing loads count as load 0 and a message says
how many; the load column of the result still shows them as NA.
Morton RH, Fitz-Clarke JR, Banister EW (1990). Modeling human performance in running. Journal of Applied Physiology, 69(3), 1171-1177.
Busso T, Chalencon S (2023). Validity and accuracy of impulse-response models for modeling and predicting training effects on performance of swimmers. Medicine & Science in Sports & Exercise, 55(7), 1274-1285.
Marchal A, Benazieb O, Weldegebriel Y, Méline T, Imbach F (2025). Statistical flaws of the fitness-fatigue sports performance prediction model. Scientific Reports, 15, 3706.
session_response() for the response to a single session,
constant_training() for constant daily training, half_life(),
as_daily_load(). The article "The Banister model" on the package
website discusses the limitations of the model.
# Morton et al. (1990): load 100 on days 1-60, then 60 days of rest x <- as_daily_load( data.frame(date = as.Date("2026-01-01") + 0:119, load = c(rep(100, 60), rep(0, 60))), date = "date", load = "load" ) sim <- simulate_banister(x, k1 = 1, tau1 = 45, k2 = 2, tau2 = 15, same_day_load = "include") sim which.min(sim$predicted) # Fitness-only model, default convention "exclude" simulate_banister(x, k1 = 1, tau1 = 45, model = "fitness_only")# Morton et al. (1990): load 100 on days 1-60, then 60 days of rest x <- as_daily_load( data.frame(date = as.Date("2026-01-01") + 0:119, load = c(rep(100, 60), rep(0, 60))), date = "date", load = "load" ) sim <- simulate_banister(x, k1 = 1, tau1 = 45, k2 = 2, tau2 = 15, same_day_load = "include") sim which.min(sim$predicted) # Fitness-only model, default convention "exclude" simulate_banister(x, k1 = 1, tau1 = 45, model = "fitness_only")
Computes the session rating of perceived exertion (RPE) load of Foster (1998) and Foster et al. (2001): the RPE of the session multiplied by its duration in minutes (MODELS.md, M-10).
srpe_load(rpe, duration)srpe_load(rpe, duration)
rpe |
Numeric vector of session RPE values, each between 0 and 10 or
|
duration |
Numeric vector of session durations in minutes, each
|
A numeric vector, rpe * duration. NA in either argument gives
NA.
RPE is rated on the 0-10 category-ratio scale: one global rating for the whole session, asked about 30 minutes after it ends.
Duration is the duration in minutes of the entire session, including warm-up, cool-down and recovery intervals.
Several sessions on the same day are summed when the loads are passed to
as_daily_load().
Session RPE load is in arbitrary units. Comparing it across athletes needs care.
Foster C (1998). Monitoring training in athletes with reference to overtraining syndrome. Medicine and Science in Sports and Exercise, 30(7), 1164-1168.
Foster C, Florhaug JA, Franklin J, et al. (2001). A new approach to monitoring exercise training. Journal of Strength and Conditioning Research, 15(1), 109-115.
as_daily_load() to build the daily series, rolling_load() and
monotony_strain() to describe it.
# The week of Foster (1998), Table 1 srpe_load(rpe = c(5, 7, 2, 6, 7, 2, 7), duration = c(180, 120, 20, 90, 75, 20, 120))# The week of Foster (1998), Table 1 srpe_load(rpe = c(5, 7, 2, 6, 7, 2, 7), duration = c(180, 120, 20, 90, 75, 20, 120))
Summarise a daily training-load series by athlete
## S3 method for class 'daily_load' summary(object, ...)## S3 method for class 'daily_load' summary(object, ...)
object |
A |
... |
Not used. |
A data frame with one row per athlete and the columns athlete,
first_date, last_date, n_days, n_training, n_rest,
n_missing, n_filled, longest_filled_run (the longest run of
consecutive filled days) and n_performance (days with a non-NA
performance value; 0 if there is no performance column).
x <- as_daily_load( data.frame(date = c("2026-01-01", "2026-01-03"), load = c(300, 250)), date = "date", load = "load" ) summary(x)x <- as_daily_load( data.frame(date = c("2026-01-01", "2026-01-03"), load = c(300, 250)), date = "date", load = "load" ) summary(x)