Saltar al contenido principal
FREE BETA
Motor
Referencia Matemática Estática · KaTeXPipeline Causal SPEC · Precisión Numérica · Inferencia No Paramétrica

Fundamentos Matemáticos de TrueAlpha1 (DFA α₁)

Formulación formal del motor causal implementado en el reloj Garmin (IEEE-754 binary32) y de las herramientas de diagnóstico espectral, calibración de umbrales ventilatorios y auditoría de parciales de TrueAlpha1 Lab.

1. Variational Formulation of Smoothness Priors and Numerical Conditioning

Tarvainen et al. (2002)

Before evaluating short-term fractal dynamics, it is essential to extract the non-stationary very-low-frequency trend (autonomic drift and HR acceleration). The Smoothness Priors filter poses a discrete second-order Tikhonov regularization problem over the artifact-corrected RR-interval series x∈RNx \in \mathbb{R}^N:

t^=arg⁡min⁡t∈RN{∥x−t∥22+λ2∥D2t∥22}\hat{t} = \arg\min_{t \in \mathbb{R}^N} \left\{ \|x - t\|_2^2 + \lambda^2 \|D_2 t\|_2^2 \right\}

where D2D_2 is the second-order finite-difference operator:

(D2t)i=ti+2−2ti+1+ti,D2∈R(N−2)×N(D_2 t)_i = t_{i+2} - 2 t_{i+1} + t_i, \qquad D_2 \in \mathbb{R}^{(N-2)\times N}

The first-order optimality condition leads to the symmetric positive definite (SPD) pentadiagonal linear system:

A t^=x,A=IN+λ2D2TD2≻0A\,\hat{t} = x, \qquad A = I_N + \lambda^2 D_2^{\mathsf{T}} D_2 \succ 0

Because it possesses a strictly pentadiagonal structure (half-bandwidth b = 2), the square-root-free symmetric factorization admits an exact solution in linear time and memory:

A=LDLT,bandwidth b=2,cost O(N)A = L D L^{\mathsf{T}}, \qquad \text{bandwidth } b = 2, \qquad \text{cost } \mathcal{O}(N)
Conditioning Theorem in IEEE-754 binary32 (Garmin watch)

The eigenvalues of D2TD2D_2^{\mathsf{T}} D_2 lie in the interval [0, 16], so for the standard parameter λ=500\lambda = 500 (μ=λ2=2.5×105\mu = \lambda^2 = 2.5\times 10^5), the spectral condition number of A scales quadratically with λ:

κ2(A)=λmax⁡(A)λmin⁡(A)≈1+16λ2→λ=5004.000001×106\kappa_2(A) = \frac{\lambda_{\max}(A)}{\lambda_{\min}(A)} \approx 1 + 16\lambda^2 \xrightarrow{\lambda = 500} 4.000001 \times 10^6

In single-precision binary32\text{binary32} arithmetic without FMA, the product κ2(A) εmach(32)≈(4×106)(1.19×10−7)≈0.48\kappa_2(A)\,\varepsilon_{\mathrm{mach}}^{(32)} \approx (4\times 10^6)(1.19\times 10^{-7}) \approx 0.48 indicates that ~6.6 decimal digits of precision are lost when solving the linear system. Accordingly, the numerical audit compares the watch's binary32\text{binary32} engine at every instant against the exact binary64\text{binary64} reference, verifying the absence of rounding drift in the residual u = x − t̂:

u=x−t^=(IN−(IN+λ2D2TD2)−1)xu = x - \hat{t} = (I_N - (I_N + \lambda^2 D_2^{\mathsf{T}} D_2)^{-1}) x

2. DFA-1 Estimator, Exact OLS Weights, and RSA Crossover Effect

Peng et al. (1995) · Gronwald & Hoos

From the stationary residual u obtained after Smoothness Priors filtering, the zero-mean cumulative profile is constructed:

Y(k)=∑i=1k(ui−uˉ),k=1,…,NY(k) = \sum_{i=1}^{k} \bigl(u_i - \bar{u}\bigr), \qquad k = 1, \dots, N

For each scale n∈[nmin⁡,nmax⁡]n \in [n_{\min}, n_{\max}] (default 4..16 beats), the profile is partitioned into Kn=⌊N/n⌋K_n = \lfloor N/n \rfloor non-overlapping boxes (or 2Kn2K_n when bidirectional traversal from both ends is enabled) and a local OLS line p^j,1(m)\hat{p}_{j,1}(m) is fitted in each box, yielding the root-mean-square fluctuation function:

F(n)=1Kn n∑j=1Kn∑m=1n(Yj(m)−p^j,1(m))2F(n) = \sqrt{\frac{1}{K_n\, n} \sum_{j=1}^{K_n} \sum_{m=1}^{n} \Bigl(Y_{j}(m) - \hat{p}_{j,1}(m)\Bigr)^2}

Because the scale support n is fixed within each evaluation, the ordinary least-squares regression slope on the log-log plot reduces to a dot product with precomputed zero-sum weights wnw_n (∑nwn=0,∑nwnln⁡n=1\sum_{n} w_n = 0, \qquad \sum_{n} w_n \ln n = 1):

α^1=∑n=nmin⁡nmax⁡wnln⁡F(n),wn=ln⁡n−ln⁡n‾∑k=nmin⁡nmax⁡(ln⁡k−ln⁡n‾)2\hat{\alpha}_1 = \sum_{n=n_{\min}}^{n_{\max}} w_n \ln F(n), \qquad w_n = \frac{\ln n - \overline{\ln n}}{\sum_{k=n_{\min}}^{n_{\max}} (\ln k - \overline{\ln n})^2}
Respiratory Sinus Arrhythmia (RSA) crossover phenomenon

During intense efforts or pronounced shifts in respiratory frequency f_resp, vagal modulation driven by the ventilatory cycle introduces a characteristic scale in beats:

nRSA≈HRbpm60 fresp≈RR‾−1frespn_{\mathrm{RSA}} \approx \frac{\mathrm{HR}_{\mathrm{bpm}}}{60 \, f_{\mathrm{resp}}} \approx \frac{\overline{\mathrm{RR}}^{-1}}{f_{\mathrm{resp}}}

Below n_RSA, fluctuations exhibit a steeper slope (short α over 4–8) than above the breakpoint (α over 9–16 and 17–32). The Mathematical Inspector reports both sub-slopes and detects the regime-change elbow to avoid false positives in α^1\hat{\alpha}_1.

3. Lomb-Scargle Spectrum vs. Interpolation Low-Pass Bias

Lomb (1976) · Scargle (1982)

The RR-interval series is indexed by the occurrence timestamp of each beat tit_i, forming an intrinsically unevenly sampled signal. The Lomb-Scargle periodogram projects the residual uiu_i directly onto harmonic subspaces at the actual beat timestamps without prior resampling:

PLS(ω)=12σ^2[(∑iuicos⁡ω(ti−τ))2∑icos⁡2ω(ti−τ)+(∑iuisin⁡ω(ti−τ))2∑isin⁡2ω(ti−τ)]P_{\mathrm{LS}}(\omega) = \frac{1}{2\hat{\sigma}^2} \left[ \frac{\left(\sum_i u_i \cos\omega(t_i - \tau)\right)^2}{\sum_i \cos^2\omega(t_i - \tau)} + \frac{\left(\sum_i u_i \sin\omega(t_i - \tau)\right)^2}{\sum_i \sin^2\omega(t_i - \tau)} \right]

where the phase offset τ(ω) ensures orthogonality between the sine and cosine basis functions over the irregular grid, preserving time-translation invariance:

tan⁡(2ωτ)=∑isin⁡(2ωti)∑icos⁡(2ωti)\tan(2\omega\tau) = \frac{\sum_i \sin(2\omega t_i)}{\sum_i \cos(2\omega t_i)}

Unlike a classical FFT over cubic splines or zero-order hold (ZOH), which introduce frequency-dependent low-pass attenuation across the respiratory HF band (0.15–1.20 Hz):

∣HZOH(f)∣2=sinc⁡2(f/fs),fs≈4 Hz|H_{\mathrm{ZOH}}(f)|^2 = \operatorname{sinc}^2(f / f_s), \qquad f_s \approx 4\text{ Hz}

Lomb-Scargle avoids high-frequency spectral bias when heart rate drops or shifts abruptly, allowing peak respiratory rate (rpm = 60 · f_peak) to be extracted with physical fidelity.

4. Non-Parametric Threshold Inference: Theil-Sen and Moving-Block Bootstrap

Robust Regression · Autocorrelated Series

Estimating the physiological thresholds HRVT1 (α1 = 0.75) and HRVT2 (α1 = 0.50) from stationary pairs (α1,i, yi)(\alpha_{1,i},\, y_i), where yiy_i is the HR (or speed) interpolated at each window timestamp and excluding transitional windows ~ and windows with HR < 100 bpm, is vulnerable to residual outliers. The Theil-Sen estimator achieves a 29.3% breakdown point via the median of pairwise slopes:

β^TS=median⁡1≤i<j≤M(yj−yiα1,j−α1,i),β^0=median⁡i(yi−β^TS α1,i)\hat{\beta}_{\mathrm{TS}} = \operatorname{median}_{1 \le i < j \le M} \left( \frac{y_j - y_i}{\alpha_{1,j} - \alpha_{1,i}} \right), \qquad \hat{\beta}_0 = \operatorname{median}_i \left( y_i - \hat{\beta}_{\mathrm{TS}}\,\alpha_{1,i} \right)

Evaluating the robust model at the ventilatory targets yields the HR and speed thresholds:

HRVT^k=β^0+β^TS α1,target(k),α1,target(1)=0.75,α1,target(2)=0.50\widehat{\mathrm{HRVT}}_k = \hat{\beta}_0 + \hat{\beta}_{\mathrm{TS}} \, \alpha_{1,\mathrm{target}}^{(k)}, \qquad \alpha_{1,\mathrm{target}}^{(1)} = 0.75, \quad \alpha_{1,\mathrm{target}}^{(2)} = 0.50

Because sliding DFA windows of width W = 120 s sampled every Δt_step exhibit strong serial autocorrelation, an i.i.d. bootstrap would drastically underestimate variance. Therefore, Moving-Block Bootstrap is used with block length ℓ≥W/Δtstep\ell \ge W / \Delta t_{\mathrm{step}}, the number of consecutive points sharing a window (a shorter block would resample strongly dependent points as independent and artificially narrow the interval):

ℓ=⌈WΔtstep⌉,B=200 block replicates B1,…,BK\ell = \left\lceil \frac{W}{\Delta t_{\mathrm{step}}} \right\rceil, \qquad B = 200\text{ block replicates } \mathcal{B}_1, \dots, \mathcal{B}_{K}

From the empirical distribution of the B replicates, the 2.5th and 97.5th percentiles (q2.5, q97.5) are extracted. Because neighboring points are not independent, the interval can never be narrower than the classical confidence interval for the mean regression response computed with the effective number of independent windows neff instead of n (Student's t quantile with neff − 2 degrees of freedom, s the residual SD of the fit, and y^\hat{y} the fitted HR or pace value at the target):

CI95%=[ min⁡(q2.5, y^−h), max⁡(q97.5, y^+h)],h=t0.975; neff−2  s 1neff+(α1target−αˉ1)2neff Var(α1)\mathrm{CI}_{95\%} = \Bigl[\, \min\bigl(q_{2.5},\ \hat{y} - h\bigr),\ \max\bigl(q_{97.5},\ \hat{y} + h\bigr) \Bigr], \qquad h = t_{0.975;\,n_{\mathrm{eff}}-2}\; s\,\sqrt{\frac{1}{n_{\mathrm{eff}}} + \frac{(\alpha_1^{\mathrm{target}} - \bar{\alpha}_1)^2}{n_{\mathrm{eff}}\,\mathrm{Var}(\alpha_1)}}

These 95% confidence bands are displayed in both the session regression plot and the longitudinal trends view.

Rejection gates: when no threshold is estimated

Consecutive DFA windows share nearly all of their beats, so n valid points correspond to only a few independent windows. The session is rejected (the table displays "Not estimable" and the reason) unless it satisfies all of these conditions over valid points (finite α1, non-transitional, HR ≥ 100 bpm):

  • At least 12 valid points.
  • Sufficient independent windows, given nval valid points:
    neff=nvalW/Δtstep  ≥  6n_{\mathrm{eff}} = \frac{n_{\mathrm{val}}}{W / \Delta t_{\mathrm{step}}} \;\ge\; 6
    Below ~6 independent windows (about 12 min of 120 s windows), even an honest confidence interval would not be informative.
  • Robust HR contrast, measured with percentiles rather than min-to-max because warm-ups, stops, and ramp edges stretch the raw range (a 3 × 15 min steady-pace session yields 20 bpm min-max but only 8 bpm P5–P95): P95(HR)−P5(HR)≥15 bpmP_{95}(\mathrm{HR}) - P_{5}(\mathrm{HR}) \ge 15\ \text{bpm}.
  • Span of α1 of at least 0.25 and minimum no higher than the HRVT1 target + 0.12; otherwise estimating the threshold would require extrapolation.
  • Negative Theil-Sen slope of HR versus α1.
  • No time confounding, because α1 also falls with fatigue and cardiac drift. Using Spearman rank correlations: if HR is not nearly a monotonic function of time, the partial correlation must satisfy ρS(α1,HR∣t)≤−0.3\rho_S(\alpha_1, \mathrm{HR} \mid t) \le -0.3; if it is (∣ρS(HR,t)∣≥0.9|\rho_S(\mathrm{HR}, t)| \ge 0.9, a ramp where intensity and time coincide by design and the partial correlation is ill-conditioned), HR must rise by at least 0.5 bpm/min (cardiac drift at constant intensity is typically below 0.3 bpm/min; ramps lie between 1 and 3).

Explicit consequence: a steady-pace session is rejected. Its HR barely varies (P5–P95 < 15 bpm) or, if it drifts, it tracks time rather than intensity (time confounding). Pace thresholds additionally require at least 12 points with speed, the same neff ≥ 6, a P5–P95 speed contrast of at least 0.3 m/s, and a negative slope.

5. Per-Lap Metrics (LAP): Boundary, Tail α1, 4-min α1, and Trend

Short-Interval Integrity

Every causal evaluation of α^1\hat{\alpha}_1 at time t integrates the preceding W = 120 s of RR intervals. In interval sessions where lap duration satisfies t_lap < W, any window ending within the lap inevitably overlaps with the preceding lap (for example, mixing a Zone 1 recovery with a Zone 4 effort):

tlap<W=120 s  ⟹  [tend−W, tend]∩Ilap−1≠∅t_{\mathrm{lap}} < W = 120\text{ s} \implies [t_{\mathrm{end}} - W,\, t_{\mathrm{end}}] \cap \mathcal{I}_{\mathrm{lap}-1} \neq \varnothing

Furthermore, the rapid heart-rate transient at the onset of an interval triggers the non-stationarity flag (~) whenever the HR of 10 s blocks within the window differs (max minus min) by 10% or more of the mean HR. Therefore, within each lap only evaluations with t − t0 ≥ W (the entire window lies inside the lap), finite, and non-transitional count. Three metrics are computed from them.

Tail α1

Mean of eligible evaluations over the final Ttail=60 sT_{\mathrm{tail}} = 60\text{ s} of the lap (default value; at least 2 are required):

αˉ1,tail=1n∑t∈Eα1(t),E={ t∈[t1−Ttail, t1]:t−t0≥W ∧ valid(t) ∧ ¬trans(t)},n=∣E∣≥2\bar{\alpha}_{1,\mathrm{tail}} = \frac{1}{n} \sum_{t \in \mathcal{E}} \alpha_1(t), \qquad \mathcal{E} = \bigl\{\, t \in [t_1 - T_{\mathrm{tail}},\, t_1] : t - t_0 \ge W \,\land\, \text{valid}(t) \,\land\, \neg\text{trans}(t) \bigr\}, \quad n = |\mathcal{E}| \ge 2

Each evaluation integrates W = 120 s and is computed every few seconds, so tail windows overlap almost completely: they are not independent samples and their empirical standard deviation semp underestimates the true uncertainty. The half-width ± (approximate 95% CI) therefore takes the larger of semp and the nominal SD of a single evaluation σW, divided by an effective number of independent windows:

±=1.96 max⁡(semp, σW)neff,σW=0.064120W,neff=min⁡ ⁣(n, max⁡(1, ΔE+WW))\pm = 1.96\,\frac{\max\bigl(s_{\mathrm{emp}},\ \sigma_W\bigr)}{\sqrt{n_{\mathrm{eff}}}}, \qquad \sigma_W = 0.064\sqrt{\frac{120}{W}}, \qquad n_{\mathrm{eff}} = \min\!\Bigl(n,\ \max\bigl(1,\ \frac{\Delta_{\mathcal{E}} + W}{W}\bigr)\Bigr)

Here ΔE=max⁡E−min⁡E\Delta_{\mathcal{E}} = \max\mathcal{E} - \min\mathcal{E} is the time span covered by the tail evaluations: their union covers ΔE + W seconds of RR data, i.e., about (ΔE + W)/W independent windows (≈ 1.5 for a 60 s tail with 120 s windows), bounded between 1 and n. The SD σW = 0.064 corresponds to a 120 s evaluation (averaged across HR from 100 to 190 bpm) and scales as 1/√W: 0.075 at 90 s, 0.052 at 180 s, and 0.045 at 240 s. If the interval [α1 − ±, α1 + ±] crosses HRVT1 or HRVT2, the table does not assign a single zone: it shows a neutral badge ≈ AER/TRN (or ≈ TRN/ANA) with both possible zones.

4-min α1

A single DFA over the final 240 s of corrected RR intervals in the lap, rather than averaging overlapping windows. A single 240 s estimate has SD σ240 ≈ 0.045, compared with 0.064 for a 120 s window:

α1, 4 min=DFA(corrected RR in [t1−240 s, t1]),±=1.96 σ240=1.96⋅0.064120240≈0.089\alpha_{1,\,4\,\mathrm{min}} = \mathrm{DFA}\bigl(\text{corrected RR in } [t_1 - 240\ \text{s},\, t_1]\bigr), \qquad \pm = 1.96\,\sigma_{240} = 1.96 \cdot 0.064\sqrt{\tfrac{120}{240}} \approx 0.089

It is computed only if all of these requirements are met; if any fails, the table displays "—":

  • the lap lasts at least 300 s;
  • the 240 s contain at least 100 beats, corrected RR covers at least 95% of the segment, and it does not cross any signal break (GAP);
  • fewer than 3% corrected beats in the segment;
  • stationarity: no transitional marker (~) and mean HR of the two halves of the segment differing by less than 5%.

Trend Δα1

Theil-Sen slope of α1 (per minute) over eligible evaluations after the first max(240 s, W) of the lap, ignoring onset kinetics after rest. The drift is that slope multiplied by the minutes spanned by the evaluations:

m^=median⁡i<jα1(tj)−α1(ti)(tj−ti)/60,Δα1=m^⋅max⁡t−min⁡t60,t≥t0+max⁡(240 s, W)\hat{m} = \operatorname{median}_{i<j} \frac{\alpha_1(t_j) - \alpha_1(t_i)}{(t_j - t_i)/60}, \qquad \Delta\alpha_1 = \hat{m}\cdot\frac{\max t - \min t}{60}, \qquad t \ge t_0 + \max(240\ \text{s},\, W)

At least 8 evaluations spanning 60 s or more are required; otherwise no trend is shown in the table. In the table, red if Δα1 ≤ −0.10 (α1 falling), green if ≥ +0.10; values in between lie within single-window noise.

Lap-table guardrail: If lap duration is shorter than the window W (or the tail lacks 2 eligible contamination-free evaluations), the lap table blocks the estimator and explicitly displays — (<120s) instead of propagating a boundary-contaminated value.

6. Automatic Stages: Segmentation by Speed and Heart Rate

Exact Optimal Partition · Deterministic

Watch laps depend on the athlete pressing the lap button, or on auto-laps or virtual splits that ignore session structure. When there are no laps, only a single lap, or all laps are exact 1 km / 5 min virtual splits, the table opens on stages detected directly from telemetry, and each stage receives the same metrics as a lap. The procedure uses no randomness (ties resolve to the earliest boundary):

  1. Speed and HR are resampled to 1 Hz, smoothed with a 15 s moving median, and averaged into 5 s blocks. If one of the two signals is missing, the other is used.
  2. Each channel is normalized by a "meaningful change" scale (30% of median speed v~\tilde{v} and 10% of median HR), so both carry equal weight:
    zi=(vi0.30 v~, HRi0.10 HR~)z_i = \left( \frac{v_i}{0.30\,\tilde{v}},\ \frac{\mathrm{HR}_i}{0.10\,\widetilde{\mathrm{HR}}} \right)
  3. Exact optimal partitioning (dynamic programming, the same objective as PELT): minimizes the sum of squared deviations from each segment mean Sk plus a constant penalty per changepoint (wi are the seconds of each block):
    min⁡K, τ1<⋯<τK ∑k=0K∑i∈Skwi ∥zi−zˉSk∥2+βK,β=60 u2 ⁣⋅s\min_{K,\ \tau_1 < \dots < \tau_K}\ \sum_{k=0}^{K} \sum_{i \in S_k} w_i \,\lVert z_i - \bar{z}_{S_k} \rVert^2 + \beta K, \qquad \beta = 60\ \text{u}^2\!\cdot\text{s}
    With this penalty, the shortest acceptable stage lasts the minimum duration and differs from its two neighbors by roughly one normalized unit.
  4. Each boundary is refined on the 1 Hz series (within a one-block neighborhood). Any segment shorter than 120 s is then merged with its closest neighbor, except stops: segments of at least 30 s whose speed is less than half that of their neighbors, vˉk<0.5 vˉk±1\bar{v}_k < 0.5\,\bar{v}_{k \pm 1}. A stop between two work bouts is preserved as its own stage so the bouts remain separated.

7. Pauses and Smart Recording: RR-Stream Breaks

Time-Axis Integrity

A normal TrueAlpha1 file contains one record per second (if one record is dropped, the step is 2 s). A larger jump between the timestamps of two records indicates that the watch was not recording: stopwatch pause, auto-pause, or Smart Recording. During that gap beats are lost, and cumulative RR time would drift from wall-clock time if the stream were not split there. A GAP is inserted whenever the inter-record jump Δtrec exceeds 3 s and the beats in the closing record fail to cover it, with a 1.5 s slack:

Δtrec>3 s  ∧  ∑RRvalid<Δtrec−1.5 s  ⟹  GAP\Delta t_{\mathrm{rec}} > 3\ \text{s} \;\land\; \sum \mathrm{RR}_{\text{valid}} < \Delta t_{\mathrm{rec}} - 1.5\ \text{s} \;\Longrightarrow\; \text{GAP}

With Smart Recording and all beats present, the sum of RR intervals covers the jump and no gap is created; only the uncovered portion exceeding the slack counts. The break is equivalent to the rr_flag = 6 marker the watch writes after a stopwatch pause: the beat time axis is re-anchored to record timestamps. Each subsequent segment resets the RR corrector and does not emit α1 until accumulating W seconds of its own data, so that no DFA window crosses a gap; nor does the 4-min α1.