> ## Documentation Index
> Fetch the complete documentation index at: https://offthepace.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# int_lap_residual_stint_detrend

> Per-stint linear drift of driver_skill_residual_s against lap_in_stint, fit on pre-cliff laps only (cliff_onset_passed = FALSE) via OLS REGR_SLOPE.

<Note>Part of the [Residual](/transform/families/residual) family.</Note>

Per-stint linear drift of driver\_skill\_residual\_s against lap\_in\_stint, fit on pre-cliff laps only (cliff\_onset\_passed = FALSE) via OLS REGR\_SLOPE. One row per stint with >= 3 pre-cliff laps; stints with fewer laps get drift\_s\_per\_lap = 0.0 (no detrending, no data). Consumed by fct\_cliff\_prediction\_features to produce next\_lap\_degradation\_jump\_detrended\_s the per-lap first-difference with this per-stint drift (fuel burn / track evolution leaking into the residual) removed. Diagnostic: pooled median slope ≈ -0.072 s/lap across \~5,950 stints.

## Lineage

```mermaid theme={null}
flowchart LR
  int_lap_residual_decomposed --> int_lap_residual_stint_detrend
  int_lap_residual_stint_detrend --> fct_cliff_prediction_features
  style int_lap_residual_stint_detrend fill:#e40404,stroke:#e40404,color:#fff
```

## Overview

| Property          | Value                                                          |
| ----------------- | -------------------------------------------------------------- |
| Layer             | `intermediate`                                                 |
| Family            | [Residual](/transform/families/residual)                       |
| Contract enforced | No                                                             |
| Upstream          | [`int_lap_residual_decomposed`](./int_lap_residual_decomposed) |

**3 tests** [guard](/transform/ci/overview) this model  -  2 generic, 1 singular.

## Columns

| Column            | Type | Nullable | Tests                                  | Description                                                                                                                                                                                                 |
| ----------------- | ---- | -------- | -------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `stint_id`        |      | Yes      | [`not_null`](/transform/ci/structural) | Surrogate key combining race\_year, race\_id, driver\_id, stint\_number (grain).                                                                                                                            |
| `drift_s_per_lap` |      | Yes      | [`not_null`](/transform/ci/structural) | OLS slope of driver\_skill\_residual\_s vs lap\_in\_stint over pre-cliff laps (seconds per lap). Negative = residual trending faster through the stint. 0.0 when the stint has fewer than 3 pre-cliff laps. |
