Skip to content

Generate expanding chronological splits

Question

Implement expanding-window train/test index splits for sorted observations with a fixed test size and gap. State whether the gap itself is training data.

Short answer

At each split, train on indices before the gap and evaluate on the subsequent test block. The gap is excluded from that split's training and test. This row-based gap only models real time correctly when row spacing matches the intended policy.

Original question and answer written by SelfMadeQuant.com.

See the hint and the full worked solution in the question bank (free account).

Open the worked solution

Lessons behind this question

Start with a free lesson: Basic Statistics and Regression is part of a free topic. Create a free account, no card needed, to read it in full with worked solutions.

Read it free