Statistics and Data Science Education / Scatterplot Regression Defense
Turn explanation into prediction by showing the state transitions before the code runs.
Step 3 of 5
60% Complete
Checkpoint 3
Trace Mode Analysis
The student now has to simulate execution from memory. This converts explanation into prediction and exposes whether they really understand the state changes inside the modeling workflow.
Use the active scenario to predict state changes before the code runs, then carry that reasoning into the mutation stage.
psychology
Active Scenario
Trace the workflow on a small data frame with hours_studied and exam_score.
The goal is not speed. The goal is to show that each update to the cleaned rows, fitted formula, and plotted layers can be predicted before R executes the workflow.
scatterplot_regression_defense.R
1 def lengthOfLongestSubstring(s: str) -> int: 2 char_map = {} 3 max_len = start = 0 4 for i, char in enumerate(s): 5 if char in char_map and start <= char_map[char]: 6 start = char_map[char] + 1 7 else: 8 max_len = max(max_len, i - start + 1) 9 char_map[char] = i 10 return max_len
terminal