DEVELOPED COURSE TEXT
Define an estimand, preserve raw data and freeze the analysis plan
One enterprise record and two different questions
The fictional company Harbor records 32 consecutive months of sales, posted price, advertising and a promotion indicator. Price is in dollars, advertising in thousands of dollars and sales in hundreds of units. Months 1–24 are development data; months 25–32 are a locked future holdout. A decision made before each sales month knows the planned price, advertising and promotion plus the calendar index, but not that month's sales. These timing assumptions make the later prediction exercise well-defined. A forecast using realized future spending unavailable at the decision time would answer a different question.
Harbor asks both how well it can predict sales and how much a deliberate price change would alter sales. A predictive regression and a causal price response are distinct estimands. A coefficient can help predict within an observed operating regime while being biased for an intervention because managers choose prices when they anticipate stronger demand. The raw record therefore includes a teaching-only latent-demand column: it reveals the simulation mechanism for later identification analysis but is not available to the deployment model.
Document how the fictional observations were generated
The supplied generator uses NumPy's default random generator with seed 614. It draws latent demand z, then price approximately 20+.12×month+1.4z plus independent price noise. Advertising varies across a five-month pattern with additional noise; promotion occurs every fourth month. Sales are generated as 120-3×price+2×advertising+8×promotion+.8×month+4z+u. The error u follows a recursive process with coefficient .45 and innovations whose scale increases with month. Observed price, advertising and sales are rounded to three decimals; z is rounded to six decimals before use.
This is deliberately not an IID homoscedastic textbook sample. It supports comparing estimation, uncertainty and prediction procedures under known but imperfect assumptions. The finite realization will not reproduce population coefficients exactly, and adding the latent variable does not force its estimate to equal four. A seed ensures reproducibility of this record; it does not make the fitted associations causal or make the sample representative of a real business.
Specify the candidate model before inspecting the holdout
The baseline design matrix contains an intercept, price, advertising, promotion and month. The prespecified alternative adds price times promotion. Fit both using months 1–24. Compare one-step rolling-origin errors within the development interval using origins after months 16–23; every fit uses only observations already available at that origin. The fictional prespecified selection rule retains the simpler baseline unless the interaction reduces development rolling RMSE by at least 5 percent. Freeze that choice before evaluating once on the locked eight-month holdout. The oracle model adding z is a teaching contrast, not a deployable candidate.
Keep a specification ledger: model name, columns, estimation window, transformation, uncertainty procedure and reason for revision. A residual-driven change is allowed during development, but it must be recorded. Repeatedly checking months 25–32 and then claiming they remained an untouched test set would invalidate the evaluation design. A final model can later be refitted on more data for deployment, but its honest performance estimate must come from an evaluation that did not train on those outcomes.
Preserve records, units and reproduction details
Before fitting, check that every month occurs once, promotion is zero or one, numeric values are finite and no outcome has been accidentally included as a predictor. The intercept is an explicit column of ones. The supplied Python analysis saves the CSV record and a JSON output record, solves least squares with a rank-revealing routine and computes covariance and influence formulas transparently. The raw table below contains all observations, so the numerical example can be reproduced independently without access to a hidden dataset.
A reproducible report also identifies which variables are known at the prediction origin and which are available only for teaching. Latent demand must not leak into the deployable forecast. A missing future price plan would require a scenario forecast or a separate price model. Data provenance, timing and the target population are part of the statistical specification, not administrative decoration. The later chapters keep this same record so that model revision can be evaluated against an explicit baseline.
Worked records
Record 1
Original fictional data. Development months 1–24; holdout months 25–32. The latent column is unavailable to deployable forecasts.
| Month | Price | Advertising | Promotion | Sales | Latent demand (teaching only) |
|---|---|---|---|---|---|
| 1 | 18.123 | 8.856 | 0 | 78.974 | -1.425622 |
| 2 | 19.093 | 10.457 | 0 | 81.465 | -0.73106 |
| 3 | 18.514 | 11.251 | 0 | 86.553 | -0.642607 |
| 4 | 20.686 | 12.137 | 1 | 93.179 | 0.045735 |
| 5 | 20.639 | 8.448 | 0 | 78.414 | 0.024838 |
| 6 | 23.581 | 8.944 | 0 | 76.987 | 1.348988 |
| 7 | 18.508 | 10.051 | 0 | 81.927 | -1.782163 |
| 8 | 21.309 | 10.834 | 1 | 86.795 | -0.162799 |
| 9 | 23.466 | 12.147 | 0 | 84.489 | 1.965785 |
| 10 | 24.382 | 7.855 | 0 | 74.118 | 1.861637 |
| 11 | 21.108 | 9.539 | 0 | 83.932 | 0.664559 |
| 12 | 21.664 | 10.07 | 1 | 95.912 | 0.68905 |
| 13 | 22.578 | 10.656 | 0 | 90.526 | 0.821221 |
| 14 | 19.93 | 12.382 | 0 | 94.656 | -0.96925 |
| 15 | 20.119 | 8.06 | 0 | 82.959 | -1.855033 |
| 16 | 20.586 | 9.021 | 1 | 97.878 | -0.591352 |
| 17 | 24.594 | 9.471 | 0 | 81.013 | 1.295498 |
| 18 | 22.099 | 10.76 | 0 | 90.745 | -0.081415 |
| 19 | 23.665 | 12.155 | 0 | 94.906 | 0.946011 |
| 20 | 23.322 | 8.437 | 1 | 91.679 | 0.392935 |
| 21 | 22.082 | 8.905 | 0 | 89.146 | -0.122266 |
| 22 | 21.536 | 10.285 | 0 | 100.215 | -0.874577 |
| 23 | 22.83 | 10.483 | 0 | 94.095 | -0.139341 |
| 24 | 21.433 | 12.37 | 1 | 107.48 | -0.711875 |
| 25 | 23.634 | 8.074 | 0 | 84.024 | 0.332694 |
| 26 | 25.615 | 9.238 | 0 | 89.663 | 1.775892 |
| 27 | 23.098 | 10.24 | 0 | 97.393 | -0.292198 |
| 28 | 25.474 | 11.839 | 1 | 106.272 | 1.85641 |
| 29 | 23.4 | 12.024 | 0 | 98.106 | -0.212071 |
| 30 | 25.388 | 8.551 | 0 | 82.757 | 1.41569 |
| 31 | 23.363 | 9.104 | 0 | 81.779 | -0.822503 |
| 32 | 24.523 | 9.533 | 1 | 93.459 | 0.75361 |
Develop the reasoning
The baseline has n=24 rows and k=5 coefficients, leaving 19 residual degrees of freedom. The interaction model has k=6 and 18 degrees of freedom. Both designs have full column rank in this record. The holdout has eight rows and is not used to estimate either candidate. The generator and raw records are saved alongside this course as mba614-analysis.py, mba614-data.csv and mba614-outputs.json.
Progressive practice — optional
1. Foundation
Identify the outcome, units and deployable predictors.
Compare the worked reasoning
Outcome is sales in hundreds; predictors are planned price, advertising, promotion and known calendar month. The latent column is teaching-only.
Change the record
Advertising becomes known only after sales close.
Compare the changed-record reasoning
It is unavailable at the stated origin. Replace it with a genuinely known plan, forecast it separately or redefine the prediction time; do not use the realized value silently.
2. Application
Calculate residual degrees of freedom for the baseline and interaction models.
Compare the worked reasoning
24-5=19 and 24-6=18, assuming full rank.
Change the record
A duplicate intercept column is added.
Compare the changed-record reasoning
The nominal column count rises, but rank does not. The design is rank deficient and individual duplicate-intercept coefficients are not identified; use rank, not a naive column count.
3. Transfer
Can adding the latent variable prove deployment performance?
Compare the worked reasoning
No. It is unavailable when decisions are made and changes the information set.
Change the record
An independently measured demand index becomes available before each month.
Compare the changed-record reasoning
That creates a new deployable predictor, but its measurement quality and availability must be documented and a new out-of-time evaluation conducted; the oracle result is not automatically its performance.
Sources and scope
- NIST/SEMATECH: Linear Least Squares Regression: Official statistical-methods reference verified for least-squares regression. Assigned methodological reading; all data and calculations below are original fictional examples.
- NumPy: numpy.linalg.lstsq: Official API documentation verified for reproducible least-squares computation. The supplied analysis uses this routine and separately calculates diagnostics.