DEVELOPED COURSE TEXT
Write a reproducible decision report and revise the right claim
Build a report around separate claims
Harbor's executive team wants a price recommendation, a staffing forecast and a judgment about promotion. These requests require different claims. The fitted regression describes conditional sales associations. Chronological validation measures forecast performance under the observed planning process. A causal price recommendation requires a credible intervention design. A promotion effect in an interaction model is a price-specific contrast, not the raw promotion coefficient. The report should lead with these distinctions because a single headline coefficient cannot answer all three questions.
The evidence packet contains the full raw record, a reproducible generator, model definitions, coefficient/covariance tables, influence sensitivity, chronological forecast outputs and an explicit specification history. An appendix should make it possible to recompute the reported numbers. The main text should explain what decision each number informs and what assumptions connect it to that decision. Reproducibility is necessary for checking the analysis, but it does not by itself establish that the target is identified or the business action is sound.
Reconcile the model comparisons honestly
The baseline fits development sales well, with R squared near .913, yet its price slope is attenuated relative to the known fictional structural effect because price responds to latent demand. The oracle moves the slope nearer the generator's minus three but forecasts slightly worse on this short holdout. The interaction adds flexibility and has slightly lower development rolling error, yet its holdout advantage is practically negligible. These observations are compatible. They measure different properties of finite-sample models.
A defensible summary is that the baseline supplies a transparent forecasting benchmark, neither candidate demonstrates a meaningful forecast advantage in the locked eight months, and the observational coefficient does not establish the effect of a deliberate price change. This conclusion preserves useful predictive evidence while withholding an unsupported causal claim. It also identifies a next step: design a feasible price experiment or other credible assignment-based study rather than keep adding arbitrary controls until the coefficient becomes persuasive.
Translate forecast uncertainty into an operating comparison
Suppose a fictional staffing decision can support either 90 or 105 hundreds of sales units. Low capacity costs 20; high capacity costs 28. Each unit of unmet sales costs one additional contribution unit, and excess capacity has no further cost beyond the stated fixed amount. Compare expected cost using a calibrated predictive distribution or explicit scenarios. A point forecast alone cannot evaluate the tradeoff because the high plan buys protection against the upper tail.
For a two-scenario illustration with demand 85 or 110 equally likely, low expected cost is 20+.5×0+.5×20=30. High expected cost is 28+.5×0+.5×5=30.5. Low is slightly better under this loss function. If the high-demand probability rises to .8, low cost becomes 36 and high cost 32, so the preferred plan changes. These are decision calculations using stipulated scenarios, not a claim that the regression has estimated those probabilities. Keep the predictive evidence and the decision-loss assumptions separately visible.
Preserve a revision trail and test the revised recommendation
Now suppose a data review finds that future advertising is not actually fixed before the forecast origin. The earlier validation used information unavailable in deployment. The correct revision is to retract the claim that those scores estimate deployable one-month forecasting performance, replace advertising with a genuine plan or forecast and rerun chronological evaluation. The OLS calculations remain numerically reproducible, but their operational interpretation changes. A transparent analyst updates the affected claim rather than declaring the entire dataset useless or leaving the headline unchanged.
The final recommendation should state the chosen action, feasible alternatives, expected consequences, uncertainty, authority and review trigger. It should name which evidence would change the choice and which matters remain outside the model. Independent statistical review and actual learner performance are separate from this internal instructional record. The course's advanced standard is a complete chain from raw data through model construction, diagnosis, identification, validation and decision revision, with enough solved detail for a learner to reproduce and challenge each link.
Reproduce the complete record and outputs
Save the following as mba614-analysis.py in an empty directory with NumPy and SciPy available, then run it with Python. It creates the raw CSV and complete coefficient, covariance, influence and forecast-output JSON. The script checks design rank and the normal-equation residual identity. This is instructional code for the fictional record, not a production forecasting service.
"""Original fictional monthly data and transparent OLS calculations. Requires numpy/scipy."""
import numpy as np,json,csv
from pathlib import Path
from scipy.stats import t as student_t
O=Path(__file__).parent
rng=np.random.default_rng(614)
t=np.arange(1,33,dtype=float);z=np.round(rng.normal(size=32),6);promo=((t.astype(int)%4)==0).astype(float)
price=np.round(20+.12*t+1.4*z+rng.normal(0,.5,32),3)
ad=np.round(8+(t.astype(int)%5)+rng.normal(0,.3,32),3)
u=np.zeros(32)
for i in range(32):u[i]=(.45*u[i-1] if i else 0)+rng.normal(0,1+.12*t[i])
y=np.round(120-3*price+2*ad+8*promo+.8*t+4*z+u,3)
rows=[dict(month=int(t[i]),price=float(price[i]),ad=float(ad[i]),promo=int(promo[i]),latent=float(round(z[i],6)),sales=float(y[i])) for i in range(32)]
with (O/'mba614-data.csv').open('w') as f:
w=csv.DictWriter(f,fieldnames=rows[0]);w.writeheader();w.writerows(rows)
def design(indices,kind='base'):
a=np.asarray(indices);X=np.column_stack([np.ones(len(a)),price[a],ad[a],promo[a],t[a]])
if kind=='interaction':X=np.column_stack([X,price[a]*promo[a]])
if kind=='oracle':X=np.column_stack([X,z[a]])
return X
def fit(indices,kind='base'):
a=np.asarray(indices);X=design(a,kind);v=y[a];b,res,rank,s=np.linalg.lstsq(X,v,rcond=None);e=v-X@b;n,k=X.shape;inv=np.linalg.inv(X.T@X);s2=float(e@e/(n-k));h=np.sum((X@inv)*X,axis=1)
cov=s2*inv;hc3=inv@(X.T@((e/(1-h))[:,None]**2*X))@inv
meat=X.T@(e[:,None]**2*X)
for lag in range(1,3):
w=1-lag/3;g=X[lag:].T@((e[lag:]*e[:-lag])[:,None]*X[:-lag]);meat+=w*(g+g.T)
hac=inv@meat@inv
cook=e**2*h/(k*s2*(1-h)**2)
return dict(covariance=cov.tolist(),hc3Covariance=hc3.tolist(),hac2Covariance=hac.tolist(),beta=b.tolist(),se=np.sqrt(np.diag(cov)).tolist(),hc3=np.sqrt(np.diag(hc3)).tolist(),hac2=np.sqrt(np.diag(hac)).tolist(),sse=float(e@e),rmse=float(np.sqrt(np.mean(e**2))),df=n-k,rank=int(rank),singularValues=s.tolist(),residual=e.tolist(),leverage=h.tolist(),cook=cook.tolist(),residualLag1=float(np.corrcoef(e[1:],e[:-1])[0,1]),r2=float(1-e@e/np.sum((v-v.mean())**2)))
train=np.arange(24);test=np.arange(24,32);out={'rows':rows,'base':fit(train),'interaction':fit(train,'interaction'),'oracle':fit(train,'oracle')}
for kind in ['base','interaction','oracle']:
b=np.array(out[kind]['beta']);err=y[test]-design(test,kind)@b;out[kind]['testRMSE']=float(np.sqrt(np.mean(err**2)));out[kind]['testPredictions']=(design(test,kind)@b).tolist()
# Rolling one-step errors use only prior observations and known-at-origin predictors as stipulated.
for kind in ['base','interaction']:
err=[]
for target in range(16,24):
b=np.array(fit(np.arange(target),kind)['beta']);err.append(float(y[target]-(design([target],kind)@b)[0]))
out[kind]['rollingRMSE']=float(np.sqrt(np.mean(np.array(err)**2)));out[kind]['rollingErrors']=err
imax=int(np.argmax(out['base']['cook']));out['base']['mostInfluentialMonth']=imax+1;out['deleteInfluential']=fit(np.delete(train,imax))
# One fitted-mean and one new-observation interval under the explicit IID Gaussian benchmark only.
x=np.array([1,23,10,0,25.]);X=design(train);inv=np.linalg.inv(X.T@X);s2=out['base']['sse']/out['base']['df'];crit=float(student_t.ppf(.975,out['base']['df']));pred=float(x@np.array(out['base']['beta']));sem=float(np.sqrt(s2*x@inv@x));sep=float(np.sqrt(s2*(1+x@inv@x)))
ci=out['interaction'];a=np.array([0,0,0,1,0,22.]);V=np.array(ci['covariance']);b=np.array(ci['beta']);out['promotion22Contrast']=dict(estimate=float(a@b),conventionalSE=float(np.sqrt(a@V@a)))
out['naiveHoldoutRMSE']=float(np.sqrt(np.mean((y[test]-y[test-1])**2)))
out['intervalBenchmark']=dict(x=x.tolist(),prediction=pred,tCritical=crit,meanSE=sem,newObservationSE=sep,meanInterval=[pred-crit*sem,pred+crit*sem],predictionInterval=[pred-crit*sep,pred+crit*sep],assumption='Illustrative IID homoscedastic Gaussian benchmark, deliberately not validated for these serial/heteroscedastic generated errors.')
assert np.linalg.norm(X.T@np.array(out['base']['residual']))<1e-7
assert all(out[k]['rank']==len(out[k]['beta']) for k in ['base','interaction','oracle'])
(O/'mba614-outputs.json').write_text(json.dumps(out,indent=2))
print(json.dumps({k:{a:v for a,v in out[k].items() if a in ['beta','se','hc3','hac2','testRMSE','rollingRMSE','mostInfluentialMonth','r2','residualLag1']} for k in ['base','interaction','oracle','deleteInfluential']},indent=2));print(out['intervalBenchmark'])
Worked records
Record 1
Use the baseline and interaction results already computed. The final report must separately address forecasting, causal price response and a fictional staffing decision. Staffing alternatives/scenarios are explicitly stipulated rather than inferred from the model.
Develop the reasoning
Report baseline holdout RMSE 7.839871 and interaction 7.837191 hundreds, without claiming a meaningful difference. Reject causal interpretation of the baseline price coefficient because the generator makes price depend on omitted demand. For the separate staffing scenarios, low capacity has expected cost 30 at high-demand probability .5; high capacity 30.5. At probability .8, costs become 36 and 32, reversing the action. A good report explains which conclusion is statistical, which is structural and which follows from a stipulated loss function.
Progressive practice — optional
1. Foundation
List three claims that require separate support.
Compare the worked reasoning
Conditional association, future predictive performance and a causal intervention effect each need distinct evidence.
Change the record
The model has high R squared.
Compare the changed-record reasoning
That strengthens only the in-sample fit description; it does not supply missing causal design or out-of-time evaluation.
2. Application
Find the high-demand probability at which staffing plans tie.
Compare the worked reasoning
Low expected cost=20+20p; high=28+5p. Equality gives p=8/15≈.5333.
Change the record
High-capacity cost rises from 28 to 30.
Compare the changed-record reasoning
Tie becomes 20+20p=30+5p, giving p=2/3. The decision threshold changes even if forecasts do not.
3. Transfer
Advertising used in validation is discovered to be unavailable at forecast time. What should change?
Compare the worked reasoning
The deployable performance claim must be revised; replace or forecast the input and rerun temporal evaluation.
Change the record
Advertising plans are independently archived before every month and match the variables used.
Compare the changed-record reasoning
This new provenance supports the original information-timing assumption. Keep the validation result, while retaining its small-sample, regime and causal limits rather than retracting unrelated valid calculations.
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.
- NIST: Regression Diagnostics: Official reference verified for influence and diagnostic concepts. Compare with the explicitly defined leverage/Cook calculations in this original record.
- Hyndman and Athanasopoulos: Forecasting, Principles and Practice, §5.10: Authors’ published text verified for rolling forecasting-origin evaluation. Assigned reading, not a source of the original data or forecast results.
- NumPy: numpy.linalg.lstsq: Official API documentation verified for reproducible least-squares computation. The supplied analysis uses this routine and separately calculates diagnostics.