Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Case study: distinguishing a level shift from a trend

Support says churn “went up in June.” The churn table is a weekly snapshot with tenure, a churn score, and the snapshot date. We want to check whether a model based on tenure accounts for the increase, or whether its residuals show a level shift. The changes/residual_level finding estimates one such shift under a stated reference model.

The fixture adds 0.15 to the score from a fixed date and omits one week from the snapshot calendar. The analysis checks whether the score change looks like a gradual trend or a shift in the model residuals.

5800 rows × 3 columns (standard budget); 0 functional dependencies, 2 predictive dependencies, 0 conditional rules

First, check the snapshot dates and their cadence:

[gaps     ] column snapshot_date is missing 1 week at 2024-05-13..2024-05-27 (14 days elapsed)
[ordering ] column snapshot_date is non-decreasing with row order

The dates are non-decreasing and have a modal cadence of seven days. One expected week is missing. The residual-shift result should be read with that calendar gap in mind.

residual-shift findings for churn_score: 1
churn_score shifts after 2024-05-27 along snapshot_date: a training-selected residual correction reduces holdout squared error by 83.9%

   breakpoint: 2024-05-27
   residual mean before/after: -0.0464 / 0.1024
   holdout error reduction: 83.9%
   reference model: churn_score ~ tenure + {'tenure': 0.009948939540210531}

Reading the finding

The reference model is a linear fit of churn_score on tenure; its coefficients are recorded in the finding. The residuals, ordered by snapshot date, show one step. The centered cumulative-sum scan places the breakpoint at 2024-05-27, within the missing week. The estimated offset applies from the 2024-06-03 block onward. A fixed before/after offset correction reduces holdout squared error by 83.9%. Under this model, the June increase is a residual level shift rather than a trend.

┌─────────┬────────────┐
│ month   ┆ mean_score │
╞═════════╪════════════╡
│ 2024-01 ┆ 0.5976     │
│ 2024-02 ┆ 0.6095     │
│ 2024-03 ┆ 0.6084     │
│ 2024-04 ┆ 0.6057     │
│ 2024-05 ┆ 0.5923     │
│ 2024-06 ┆ 0.7516     │
│ 2024-07 ┆ 0.7428     │
└─────────┴────────────┘

The monthly means show a step around June. The finding supplies an estimated breakpoint, offsets, and the reference model used to compute residuals.

What the finding does not claim

No p-value is attached: this is a measured level change under a stated model, on disclosed train/holdout rows, from a pass that tests one breakpoint on the first date column. Multiple breaks, gradual ramps, and breaks driven by a column other than the first temporal one are out of scope today (Directions). The calendar finding also reports a missing week beginning May 20. Check the source that supplies the snapshot dates before interpreting the breakpoint.

For a reported change, the profile can test for a residual level shift under the specified model. The result provides a breakpoint and effect estimate for follow-up; it does not identify the cause.