The Lawfare Academy

Lawfare Group → Knowledge Institute → Lawfare Academy

← Regression and Business Forecasting

Unit 1

Regression as a conditional model

Learning objectives

  • Explain regression as a conditional model in your own words.
  • Apply the principle to the worked business case.
  • Evaluate the answer and identify an assumption that could change it.

Regression as a conditional model

Regression models the expected outcome given specified predictors. A coefficient describes a conditional association under the model. Identify the outcome, unit of observation, and intended use before fitting an equation.

Worked example

A model predicts job hours from floor area; it does not automatically describe the effect of changing a building's area.

Current on-site learning

Required teaching and complete optional models are supplied on LawfareGroup.com. Publisher and primary links are optional provenance or further reading. Florida is the contemporary state-law default; federal rules and explicitly comparative accounting frameworks are distinguished. Independent subject review and observed human learner testing remain pending.

Work through the reasoning

Define the population, sampling or assignment process, variables, estimator, and intended inference. For this unit, connect the explanation of regression as a conditional model to the worked example before answering the practice question.

Check the limits

Check dependence, selection, uncertainty, and whether the evidence supports description, prediction, or causation. If the source model and the practical example use different assumptions, state the difference rather than applying the formula or rule mechanically.

Apply it independently

What does the coefficient initially establish? Write an answer before opening the model response. Show the calculation or explain the causal or logical steps. Change one material assumption and say whether your conclusion changes. This practice is optional; you can read every part of the course without submitting work.

Original Academy expansion: defining what a regression means

A regression begins with a question about a population and a measurement process. Suppose Cedar Service wants to estimate the labor hours required for a quoted job. The observation is a job, the outcome is recorded labor hours, and a predictor might be floor area in hundreds of square feet. Before fitting a line, decide whether hours include travel, breaks, callbacks, and subcontractor time. A relationship between incompatible measurements is difficult to interpret even when software produces precise coefficients. State when the prediction will be made. Information recorded after a job ends cannot be used in a model intended to price that job before work begins.

Three questions require different arguments. Description asks how recorded jobs differ. Prediction asks how well available information anticipates a new job. Causal inference asks what would change if an intervention changed a predictor. A strong prediction from job urgency to expense does not establish that declaring a job nonurgent would reduce its expense. Urgency may reflect damage severity. Confusing these questions can turn an accurate forecasting tool into a poor management policy.

Write the simple population model as Y = beta0 + beta1 X + error. Here beta0 and beta1 describe a proposed conditional mean, while the error contains variation not represented by that mean. The assumption E(error given X) = 0 says that the modeled mean is correctly specified at the relevant values of X. It is stronger than saying errors average to zero across the whole sample. A model may miss curvature at small and large job sizes while its overall residual average remains zero. The fitted equation uses estimated coefficients, b0 and b1, obtained from finite observations. Distinguish the unobserved population error from a sample residual, which is an observed outcome minus its fitted value.

The slope has units: hours per hundred square feet. If fitted hours = 1.5 + 0.8 X, a one-unit increase in X corresponds to 0.8 more fitted hours. A 250-square-foot increase is 2.5 predictor units, corresponding to 2 hours. The intercept is the model's fitted hours at zero area. That can serve as an algebraic anchor without describing an actual zero-area job. If observed jobs range from 300 to 1,200 square feet, using the equation at zero or 10,000 square feet is extrapolation. The line has no built-in knowledge of minimum call-out charges, multiple crews, or equipment thresholds.

Worked investigation: translating a model into a quote

Use the fictional equation above for a 750-square-foot job. First convert area to X = 7.5. Next compute fitted hours = 1.5 + 0.8(7.5) = 7.5. If the recorded job ultimately takes 9 hours, the residual is 9 - 7.5 = 1.5 hours. This positive residual means the model underpredicted this job. It does not prove the worker was inefficient: omitted access difficulties, incorrect measurements, and random disruption remain possible explanations.

Suppose labor costs $40 per hour. The fitted direct labor cost is $300. That is neither a customer price nor a guarantee. A quote also requires materials, travel, overhead allocation, margin, and an allowance for uncertainty. If underestimating hours is much more costly than overestimating, the conditional mean may not be the appropriate decision target. A selected conditional quantile may better match a service promise. Choosing a decision rule requires explicit costs; regression alone cannot supply the firm's priorities.

Changing units changes numerical coefficients without changing fitted outcomes. In square feet rather than hundreds of square feet, the same equation is hours = 1.5 + 0.008 area. A reported slope of 0.8 without its units is incomplete. Centering X at 7.5 produces hours = 7.5 + 0.8(X - 7.5). The intercept now describes a job within the observed range. Centering is a re-expression of the same line, not new evidence or a cure for confounding.

Progressive practice

  1. Foundation: predict hours for 500 square feet and calculate the residual if actual hours are 6.5.
  2. Application: re-express the equation when area is measured in thousands of square feet. Explain why the new slope is larger.
  3. Transfer: a manager proposes using the urgency coefficient as the savings from refusing emergency work. Identify the missing causal argument and propose a more defensible question.
  4. Critique: a quoting model uses final invoice amount as an input. Explain why its apparent accuracy is unsuitable for a pre-work quote.

Worked reasoning for the practice

At 500 square feet, X = 5 and fitted hours = 5.5. The residual is 1 hour. In thousands of square feet, let Z = area/1,000; X = 10Z, so fitted hours = 1.5 + 8Z. The larger coefficient multiplies a larger unit of area. For urgency, first investigate severity, time of day, staffing, and selection into the emergency category. A descriptive comparison can guide a pricing review, but intervention effects need an identification strategy. Final invoice amount is unavailable at quoting time and may encode the target itself. Exclude it and evaluate only predictors observable at the intended decision time.

Reading alignment for this expansion

The earlier introductory links remain background reading. Use the complete current on-site studios; publisher links are optional provenance. The original Academy worked records above are not quotations from those sources.

Open the runnable laboratory

Extended text lesson

Continue with An adjusted coefficient still needs a causal argument for the full worked case, source readings and optional progressive practice.

Complete current conceptual preparation

From paired measurements to a conditional business model

The measurement contract precedes the coefficient

The outcome and predictor must be paired at the same observation unit. If advertising is recorded by branch-month and sales by individual invoice, copying a branch's advertising total onto every invoice creates repeated exposures rather than independent branch experiments. Define the observation, eligible population, period, currency or physical units, missing-value policy and availability date. Preserve a zero outcome when it is a genuine zero; distinguish an unrecorded sale from no sale. A completed-job sample also omits rejected and canceled work. Its relation need not describe all quoted jobs.

A scatterplot places each paired predictor x and outcome y at a point. Inspect direction, curvature, spread, clusters and support before summarizing. The axes carry substantive meaning. An empty region is missing support, not evidence that the relationship continues smoothly through it. Connecting points in collection order can invent a trajectory when the observations are unrelated businesses; time order instead deserves a separate plot when dependence matters.

For n paired observations, compute xbar and ybar, then Sxx=sum((x-xbar)^2), Syy=sum((y-ybar)^2) and Sxy=sum((x-xbar)(y-ybar)). Pearson's sample correlation is r=Sxy/sqrt(Sxx*Syy) when both sums of squares are positive. Centering removes the arbitrary zero points; dividing by the two scales makes r dimensionless. Positive r indicates an increasing linear association and negative r a decreasing one. Its magnitude summarizes linear alignment, not every possible relation. A symmetric U-shaped relationship can have correlation zero while remaining strongly predictable through a quadratic mean.

The bound -1<=r<=1 follows because the squared length of any centered residual vector cannot be negative: minimize sum((y-ybar)-b(x-xbar))^2 over b to obtain Syy-Sxy^2/Sxx>=0. Thus Sxy^2<=Sxx*Syy. Equality means the centered observations lie exactly on a line in this sample. It supplies no guarantee of future fit. If a variable is constant, correlation is undefined; reporting zero would incorrectly assert a measured absence of association.

Worked record: the same correlation supports different questions

Use four independent synthetic branch records x=(1,2,3,4), y=(2,4,5,7), with x measured in thousands of advertising dollars and y in thousands of sales dollars. The means are 2.5 and 4.5. Centered sums are Sxx=5, Syy=13 and Sxy=8. Hence r=8/sqrt(65), approximately 0.992277877. The least-squares line is yhat=0.5+1.6 x. Correlation has no currency units, whereas the slope means 1.6 thousand fitted sales dollars per thousand advertising dollars under this model.

At x=3 the fitted outcome is 5.3, while the observed value is 5, giving residual -0.3. The fitted values are 2.1,3.7,5.3,6.9 and SSE=0.2. With an intercept, R-squared=1-SSE/Syy=1-0.2/13=0.984615385, equal to r-squared in this simple one-predictor fit. It is a fraction of observed centered outcome variation accounted for by this fitted line. It is not a percentage accuracy score, a causal share of sales or an expected return on spending.

The descriptive question is how these branches differ. A predictive question asks whether a model fitted on an admissible history predicts genuinely later branches or periods. A causal question asks what would happen if spending were changed under a specified intervention. Branch size, expected demand or management quality could affect both recorded spending and sales. Neither high r nor small residuals resolves those pathways. Preserve the existing Academy season-adjustment and training-composition cases: they demonstrate precisely why a pooled slope and a justified intervention effect are different objects.

Transformations and contrasts that preserve meaning

Adding 100 to every sales value leaves Syy, Sxy, r, slope, residuals and R-squared unchanged; the intercept rises to 100.5. Multiplying sales by 1,000 changes the outcome unit, multiplying slope, intercept and residuals by 1,000 and both SSE and Syy by 1,000,000. Correlation and R-squared remain unchanged. Reversing the sign of exactly one measurement reverses correlation; it is not a new business mechanism. Swapping x and y leaves correlation unchanged but changes the prediction task: regressing advertising on sales is generally not the algebraic inverse of the sales-on-advertising regression.

Here the reverse slope is Sxy/Syy=8/13 and reverse intercept=2.5-(8/13)*4.5=-7/26. Solving the original fitted equation for x instead gives slope 1/1.6=0.625 and intercept -0.3125. The reverse fitted slope is approximately 0.615384615, so these are distinct lines. Each least-squares problem minimizes vertical errors in a different outcome. Choose the outcome according to the decision and measurement process; do not reverse a fitted equation merely because today's missing quantity is different.

A significance calculation has a model boundary

For independent observations from the conventional bivariate-normal zero-correlation null model, t=r*sqrt((n-2)/(1-r^2)) has n-2 degrees of freedom under the null. In this four-record example, t=sqrt(128), approximately 11.3137085, with two degrees of freedom. This is also the simple-regression zero-slope test under its corresponding classical assumptions. The exact small-sample reference is a model-based claim. Clustered branch records, selective outcome reporting, dependence or model search invalidate treating the printed reference as automatic.

A p-value measures a tail probability under the specified null and procedure. It does not give the probability that advertising causes sales, the probability that a null hypothesis is true or the chance that a commercial decision will succeed. Report the observed effect, units, sample size, support and design alongside any inferential calculation. Repeatedly testing many outcomes and retaining the smallest p-value changes the selection procedure. Four artificial observations illustrate arithmetic; they are not an empirical campaign evaluation.

Optional practice with complete model reasoning

Guided: changed outcome units

Convert sales from thousands of dollars to dollars. Give the line and correlation. Model: yhat_dollars=500+1600 x; r stays 8/sqrt(65). Residual at x=3 becomes -300 dollars. Changed fact: advertising is also converted to dollars. Revised model: yhat_dollars=500+1.6*x_dollars. Changing both units preserves the numerical slope here, while changing only the outcome does not. Always state the units rather than inferring them from coefficient size.

Independent: prediction versus reverse fitting

A colleague estimates missing advertising by solving the original line at sales y=5. Model: the solved original line gives x=(5-0.5)/1.6=2.8125. The separately fitted advertising-on-sales line gives x=-7/26+(8/13)*5=73/26, approximately 2.807692308. Neither estimate is a validated missing-data procedure. Changed fact: all observations lie exactly on an increasing straight line with nonzero predictor variation. Then r=1 and the reverse least-squares line coincides with the algebraic inverse, but out-of-sample and causal limitations still remain.

Transfer: apparently perfect evidence

A report gives r=0 for x=(-2,-1,0,1,2) and y=(4,1,0,1,4) and concludes size has no relationship with cost. Model: xbar=0 and Sxy=0 by symmetry, so the correlation is zero; nevertheless y=x^2 exactly in these five constructed records. Plot and assess a substantively justified curved model instead of declaring independence. Changed fact: every x equals 2. Correlation and the simple-regression slope are undefined because Sxx=0. Obtain predictor variation or restrict the question to estimating an outcome level at that fixed x; software cannot recover an unsupported slope.

Integrated decision and rubric: 20 points

Write a one-page recommendation for using the four-branch record to set next quarter's advertising budget. Award four points each for (1) observation/measurement/availability contract; (2) reproducible centered sums, r and line; (3) correct dimensional and R-squared interpretation; (4) explicit separation of description, prospective prediction and causal intervention; (5) changed-fact response and an admissible next evidence collection.

Complete model: state the branch unit and fictional scale; show 5,13,8 and r approximately .992278 with fitted line .5+1.6 x. Treat the 98.46 percent R-squared as in-sample explained variation only. Decline to call 1.6 a return on an extra advertising dollar. Preserve possible size/season/selection explanations, avoid extrapolation beyond x=1 through 4 and specify a later prediction evaluation using only then-available inputs. For a budget intervention, define the eligible branches, assignment mechanism, outcome horizon, spillovers and business cost before seeking causal evidence. A new randomized budget study may improve identification; it does not automatically establish transportability or remove outcome-measurement and compliance problems. No learner must submit this exercise to read the course.

Optional source summary: NIST linear least squares was read for linearity in parameters and model limitations. The paired data, correlation derivation and complete practice here are original Academy teaching. Required learning is entirely on site.

Apply the idea

A model predicts job hours from floor area; it does not automatically describe the effect of changing a building's area.

What does the coefficient initially establish? Explain your reasoning, then identify one changed fact that could alter the conclusion.

Expanded transfer investigation: A pre-work quoting model uses final invoice amount as a predictor. What is the main evaluation problem?

Show the calculation or argument, identify the information available at the decision time, and state which assumption supports your conclusion. The four progressive tasks in the Learn stage provide additional practice.

Read the worked reasoning

A model-based conditional association. Causal interpretation requires assumptions beyond fitting a regression. In an independent response, state the given facts, identify the governing relationship, work through the calculation or comparison, and distinguish the conclusion from assumptions that still need evidence.

Expanded transfer reasoning: Evaluate with the information actually available when a quote is made.

Progressive practice reasoning: At 500 square feet, X = 5 and fitted hours = 5.5. The residual is 1 hour. In thousands of square feet, let Z = area/1,000; X = 10Z, so fitted hours = 1.5 + 8Z. The larger coefficient multiplies a larger unit of area. For urgency, first investigate severity, time of day, staffing, and selection into the emergency category. A descriptive comparison can guide a pricing review, but intervention effects need an identification strategy. Final invoice amount is unavailable at quoting time and may encode the target itself. Exclude it and evaluate only predictors observable at the intended decision time.

Check understanding

A model is hours = 1.5 + 0.8X, with X in hundreds of square feet. What is predicted for 750 square feet?

  1. 7.5 hours
    Feedback

    Correct. Convert 750 square feet to X=7.5, then calculate 1.5+0.8(7.5)=7.5.

  2. 601.5 hours
    Feedback

    Incorrect. This inserts raw square feet into a predictor defined in hundreds of square feet.

  3. 6 hours
    Feedback

    Incorrect. This is only the slope contribution 0.8(7.5); include the intercept.

Further reading

Required teaching and complete optional models are supplied on LawfareGroup.com. Publisher and primary links are optional provenance or further reading. Florida is the contemporary state-law default; federal rules and explicitly comparative accounting frameworks are distinguished. Independent subject review and observed human learner testing remain pending.

My learning →