Advanced Statistics for Business

IIM Bangalore BBA in Digital Business and Entrepreneurship · Term 2 · 4 modules, 250 topics.

Advanced Regression Methods

Review of Simple Linear Regression

Simple linear regression models the relationship between one dependent variable (outcome) and one independent variable (predictor). The goal is to find a straight line that best describes how changes in the predictor affect the outcome – a best‑fit line.

y^=β0+β1x\hat{y} = \beta_0 + \beta_1 x

where y^\hat{y} is the predicted dependent variable, xx the independent variable, β0\beta_0 the intercept, and β1\beta_1 the slope (the estimated change in yy per unit change in xx).

Intuition: Quantify and predict a one‑factor influence.
Business examples:

  • Predict sales based on advertising spend.
  • Forecast monthly revenue from foot traffic.
  • Estimate fuel consumption from distance driven.

Multiple Linear Regression

Multiple linear regression extends the idea to multiple independent variables simultaneously:

y^=β0+β1x1+β2x2++βkxk\hat{y} = \beta_0 + \beta_1 x_1 + \beta_2 x_2 + \cdots + \beta_k x_k

Why it matters: Real‑world outcomes are rarely driven by a single factor. Multiple regression disentangles the joint effect of several predictors.

Business examples:

  • Real estate: House price depends on location, bedrooms, amenities.
  • Finance: Credit score assessment using income, employment status, debt level.
  • Sales prediction: Price, economic conditions, number of competitors all matter.

Exam tip: Simple regression is a special case of multiple regression (k=1k=1). All assumptions and diagnostic checks apply to both.

Comparison of Simple vs. Multiple Linear Regression

AspectSimple Linear RegressionMultiple Linear Regression
Number of predictorsOneTwo or more
Model equationy^=β0+β1x\hat{y} = \beta_0 + \beta_1 xy^=β0+βixi\hat{y} = \beta_0 + \sum \beta_i x_i
Use caseSingle‑factor influenceMulti‑factor influence
Business complexityLow (e.g., ad spend → sales)High (e.g., house pricing)

Key takeaways – Simple & Multiple Regression

  • Both provide a structured way to quantify relationships and predict outcomes.
  • Simple regression handles one predictor; multiple regression handles many.
  • Effective for forecasting, resource allocation, and identifying key drivers.
  • Reliability depends on assumptions (next section).

Key Assumptions of Linear Regression

Validity of linear regression rests on several assumptions. When any is violated, predictions and inferences become biased.

1. Linearity

The relationship between predictors and the dependent variable must be linear – a constant change in xx produces a constant change in yy.

  • Violation example: Advertising spend often shows diminishing returns; initial dollars yield steep sales increases, later dollars yield little. The true relationship is curved, not a straight line.

2. Independence of Residuals

Residuals (errors = observed – predicted) must be independent of each other.

  • Violation example: Time‑series data – today’s stock price depends on yesterday’s, leading to correlated errors.

3. Homoscedasticity

The variance of residuals should be constant across all levels of the predictors.

  • Violation (heteroscedasticity): As income increases, spending variability tends to rise – wealthier individuals have more diverse habits.

4. Normality of Error Terms

Residuals should follow a normal distribution (critical for confidence intervals and hypothesis tests).

  • Violation: Many real‑world datasets are skewed or have outliers. For continuous non‑normal data, consider transformation; for binary outcomes, switch to logistic regression.

5. No Multicollinearity

Independent variables should not be highly correlated with each other.

  • Violation example: Advertising spend and marketing spend are often strongly correlated, making it impossible to isolate each variable’s unique effect on sales.
AssumptionDescriptionBusiness violation example
LinearityPredictor–outcome relationship is a straight lineAdvertising with diminishing returns
IndependenceResiduals not correlated over timeStock prices; time‑series data
HomoscedasticityConstant residual varianceIncome vs. spending; richer people show more variability
NormalityResiduals are normally distributedSkewed data or binary outcomes
No multicollinearityPredictors not highly correlatedAdvertising spend & marketing spend

Key takeaways – Assumptions

  • Violations lead to biased estimates, invalid hypothesis tests, and poor predictions.
  • Each assumption points to a specific advanced technique (e.g., logistic regression for binary outcomes; nonlinear regression for curvature).
  • Always test assumptions before relying on linear regression results.

When Assumptions Fail: Introduction to Advanced Methods

When linear regression’s assumptions are not met, two common alternatives are introduced:

flowchart TD
    A[Regression Problem] --> B{Assumptions hold?}
    B -->|Yes| C[Use Linear Regression]
    B -->|No| D{Type of failure?}
    D -->|Binary outcome OR non‑normal errors| E[Logistic Regression]
    D -->|Non‑linear relationship| F[Non‑linear Regression]

Logistic Regression

Used when the dependent variable is categorical – often binary (yes/no, success/failure).

  • Linear regression is inappropriate because it assumes a continuous outcome and can predict probabilities outside [0,1].
  • Logistic regression models the probability of an event using a logistic (S‑shaped) function, ensuring predictions fall between 0 and 1.
  • Business applications: predict customer purchase (yes/no), loan default, employee retention.

Non‑linear Regression

Used when the relationship between variables is inherently non‑linear.

  • Examples: price–demand curves (small price changes cause large demand shifts at certain points), drug dosage–response (diminishing effects at high doses).
  • Common forms: polynomial, exponential, logarithmic models.

Exam tip: If the dependent variable is binary, always choose logistic regression over linear regression – even if other assumptions hold. The linear model will produce nonsense probabilities.

Key takeaways – Advanced Methods

  • Logistic regression handles binary outcomes; models probability via a logistic curve.
  • Non‑linear regression captures curvilinear relationships that linear models cannot fit.
  • These methods preserve the interpretability and predictive power that linear regression offers, but under more realistic conditions.

Linear Regression for Two-Sample Comparison of Means

Intuition: Comparing the means of two independent groups (e.g., before/after a campaign, with/without an accident) is typically done with a two-sample t-test. The same test can be performed using linear regression with a binary dummy variable that encodes group membership. This may seem roundabout, but it pays off: once the comparison is embedded in a regression framework, we can easily add control variables, extend to multiple groups, and link to more advanced models like fixed effects and interaction effects.

Setup

  • Dependent variable YY: continuous outcome (e.g., satisfaction level).
  • Independent variable XX: binary (0 or 1) indicating group membership.
    • X=0X=0: reference group (e.g., no accident at work).
    • X=1X=1: comparison group (e.g., had an accident).

Model:

Y=β0+β1X+εY = \beta_0 + \beta_1 X + \varepsilon

Interpretation of Coefficients

XX valueExpected YYInterpretation
00β0\beta_0Mean of reference group
11β0+β1\beta_0 + \beta_1Mean of comparison group
Differenceβ1\beta_1Mean difference (comparison group minus reference group)

Thus:

  • Testing whether β1\beta_1 is significantly different from zero is equivalent to testing whether the two group means differ.
  • The sign of β1\beta_1 indicates which group has the higher mean.

Worked Example: Accidents and Job Satisfaction

Question: Do employees who experienced an accident at work have a different average satisfaction level than those who did not?

Data: HR dataset containing satisfaction_level (continuous) and any_accident (1 = yes, 0 = no).

Simple linear regression output (from Excel):

CoefficientEstimateStd. Errorp-value
Intercept (β0\beta_0)0.607...<0.05
any_accident (β1\beta_1)0.0410.006<0.05
  • β0=0.607\beta_0 = 0.607: mean satisfaction of employees without an accident.
  • β1=0.041\beta_1 = 0.041: employees with an accident have a mean satisfaction that is 0.041 (≈4%) higher.
  • The coefficient is statistically significant → the mean difference is real.

Exam tip: A regression with a single binary predictor produces exactly the same p‑value as an independent-samples t-test for the mean difference. The regression approach becomes superior when you need to control for additional variables.

Why This Result Might Be Surprising

The positive sign (accident → higher satisfaction) is counter‑intuitive. A possible explanation is confounding: employees who have accidents may also work in different departments, have different workloads, or be treated differently by the company. The simple regression cannot separate the effect of the accident from these other factors.

Controlling for Confounders: Multiple Regression

Add covariates that capture workload and experience:

  • number_projects and average_monthly_hours (workload)
  • years_at_company and promotion_last_5years (experience)

Model:

satisfaction=β0+β1accident+β2projects+β3hours+β4years+β5promotion+ε\text{satisfaction} = \beta_0 + \beta_1 \text{accident} + \beta_2 \text{projects} + \beta_3 \text{hours} + \beta_4 \text{years} + \beta_5 \text{promotion} + \varepsilon

Result: The coefficient for any_accident remains about 0.041 and statistically significant. Even after controlling for workload and experience, the positive relationship persists. This strengthens the evidence that the accident effect is genuine (perhaps due to company support policies), though further investigation is warranted.

Key advantage over a t-test: The regression framework naturally controls for multiple covariates, reducing omitted‑variable bias and yielding a more reliable estimate of the causal effect (under appropriate assumptions).

Connections to Advanced Topics

  • Fixed effects: Using dummy variables for each individual (or group) to control for all time‑invariant unobservable characteristics. The regression shown is a simple fixed‑effects model at the group level (accident vs. no accident). In panel data, each subject gets its own dummy, isolating within‑subject variation.
  • Interaction effects: The effect of the binary variable may differ across levels of another variable (e.g., salary). For example, an accident might lower satisfaction for low‑paid employees but not for high‑paid ones. This is modelled by adding an interaction term (e.g., accident × salary) to the regression.

Key Takeaways

  • A simple linear regression with a binary dummy variable performs a two‑sample comparison of means.
  • β0\beta_0 = mean of reference group; β1\beta_1 = mean difference (comparison minus reference).
  • A significant β1\beta_1 indicates a statistically significant difference between groups.
  • The sign of β1\beta_1 reveals which group has the higher mean.
  • Multiple regression allows controlling for confounders, a major advantage over a standard t-test.
  • Dummy variable regression is the foundation for fixed effects models and interaction effects.

From Two Samples to Multiple Groups

A linear regression model can compare means across more than two independent groups, just as it does for two samples. Intuitively: instead of running a one-way ANOVA, we regress the outcome on a set of binary (dummy) variables that encode group membership, and test whether the group differences are statistically significant.

This approach treats the outcome as a continuous variable (unlike a chi‑square test of independence, which would require binning the continuous outcome into categories). The regression model directly estimates group means and their differences.

Dummy Variable Setup for kk Groups

  • Create kk binary columns, one per group (e.g., Low, Medium, High).
  • Choose one group as the baseline (reference) category – omit its dummy from the model.
  • The intercept β0\beta_0 estimates the mean of the baseline group.
  • Each other coefficient βj\beta_j estimates the difference between the mean of group jj and the baseline mean.

Example: Salary Level and Satisfaction

A dataset of 14,999 employees has salary categorised as Low, Medium, or High. The satisfaction level (0–1) is the dependent variable. To test whether mean satisfaction differs by salary group:

  1. Create dummy variables: Low (=1 if salary=Low), Medium, High.
  2. Set baseline: e.g., Low is the reference group – omit it from the model.
  3. Run regression: satisfaction ~ Medium + High (plus intercept).
VariableCoefficientInterpretation
Intercept β0\beta_00.600\approx 0.600Mean satisfaction of low‑salary employees ≈ 0.600 (i.e., 60% satisfied).
Medium β1\beta_1+0.021+0.021 (significant)Medium‑salary employees are on average 2.1% more satisfied than low‑salary.
High β2\beta_2+0.037+0.037 (significant)High‑salary employees are on average 3.7% more satisfied than low‑salary.

Thus:

  • Low salary mean = 60.0%
  • Medium salary mean = 60.0% + 2.1% = 62.1%
  • High salary mean = 60.0% + 3.7% = 63.7%

A coefficient that is significantly different from zero (via its tt‑statistic / pp‑value) indicates that the group mean differs from the baseline. The sign tells the direction.

Exam tip: Always set the baseline to a meaningful group (e.g., the most common or a control). The interpretation of the intercept and all other coefficients depends on that choice.

Key Takeaways

  • Dummy variables convert categorical membership into numeric predictors.
  • One category is always omitted – it becomes the baseline (intercept).
  • Coefficients on the included dummies represent mean differences relative to baseline.
  • A significant coefficient implies the group’s mean is statistically different from baseline.
  • The same logic extends the two‑sample tt‑test to multiple groups (equivalent to one‑way ANOVA).

Interaction Effects: Does Salary’s Impact Vary by Department?

The transcript asks: Do employees from different departments place equal emphasis on salary when reporting satisfaction? To answer this, we include an interaction term – a variable that captures the joint effect of two categorical predictors.

Intuition

A simple additive model assumes the salary effect is the same across departments. An interaction model allows the slope (difference between salary groups) to differ by department. For example, sales employees might value salary more than R&D employees, for whom job security matters more.

How to Build an Interaction Model (in Excel)

  1. Create dummy variables for every combination of the two categorical variables.
    • Example: 10 departments × 3 salary levels = 30 dummy columns (e.g., Sales_Low, Sales_Medium, Sales_High, HR_Low, …).
  2. Choose a baseline combination – e.g., HR_Low – and omit it from the regression.
  3. Run the regression with all remaining 29 dummy variables as predictors.

Practical Concern – Sparse Cells

If a combination has very few observations (e.g., only 2 management employees with low salary), its coefficient will be unreliable. A recommended workaround: drop dummy columns for those sparse interactions. You will still capture the overall effect for that department but sacrifice the ability to estimate the interaction precisely.

Interpreting the Output

  • Each interaction coefficient measures the difference in mean satisfaction for that specific (department, salary) combination relative to the baseline combination.
  • Joint significance test (e.g., FF‑test on all interaction dummies) tells whether including them significantly improves the model.
  • If the interaction effects are significant: salary’s influence on satisfaction depends on department.
  • If not: salary has a similar impact across all departments – the additive model suffices.

Exam tip: Interaction terms answer the question “Does the effect of X on Y depend on Z?” When Z is categorical, you need dummies for every X‑by‑Z cell. Always check for sparse cells; drop them to maintain reliable estimates.

Key Takeaways

  • Interaction effects capture how the relationship between the dependent variable and one categorical predictor changes across levels of another categorical predictor.
  • Implementation: create dummy variables for every combination of the two categories, then regress on those dummies (minus one baseline).
  • Sparse cells (few observations) produce unreliable coefficients – consider dropping those dummy columns.
  • Significant interactions imply the effect of salary differs by department; non‑significant interactions imply uniform effect.

Logistic Regression Model - I

Logistic regression is a technique for modeling the probability of a binary outcome (e.g., yes/no, success/failure, leave/stay) as a function of one or more independent variables.
It is the natural choice when the dependent variable is categorical – unlike linear regression, which assumes a continuous response.

Why linear regression fails for binary outcomes

  • A binary outcome (coded 00 or 11) follows a Bernoulli distribution.
  • Linear regression would model P(Y=1)=β0+β1xP(Y=1) = \beta_0 + \beta_1 x. Because a line is unbounded, predicted probabilities can fall outside [0,1][0,1] – nonsensical for a probability.
  • Logistic regression fixes this by applying the logistic (sigmoid) function, which maps any real-valued input to (0,1)(0,1).
flowchart LR
  A[Binary outcome Y ∈ {0,1}] --> B[Linear regression<br>predicts continuous values]
  B --> C[Predictions outside 0-1]
  A --> D[Logistic regression<br>models P(Y=1) via sigmoid]
  D --> E[Predictions always in 0-1]

The logistic (sigmoid) function

P(Y=1)=11+e(β0+β1x)P(Y=1) = \frac{1}{1 + e^{-(\beta_0 + \beta_1 x)}}

  • The curve is S‑shaped: for very low or very high xx, the probability flattens near 00 or 11.
  • The sign of β1\beta_1 determines the direction: positive → increasing probability as xx rises; negative → decreasing.

Foundation: Bernoulli distribution

  • A binary variable YY follows a Bernoulli distribution: P(Y=1)=pP(Y=1) = p, P(Y=0)=1pP(Y=0) = 1-p.
  • Logistic regression estimates pp as a function of the independent variables, ensuring 0p10 \le p \le 1.

Odds and log odds

Odds of success:

Odds=p1p\text{Odds} = \frac{p}{1-p}

  • If p=0.5p=0.5, odds =1=1 (equal chance).
  • If p>0.5p>0.5, odds >1>1; if p<0.5p<0.5, odds <1<1.

Log odds (logit):

log ⁣(p1p)\log\!\left(\frac{p}{1-p}\right)

  • Spans the entire real line: -\infty when p0p\to 0, ++\infty when p1p\to 1.
  • Logistic regression models log odds as a linear function of the independent variables:

log ⁣(p1p)=β0+β1x\log\!\left(\frac{p}{1-p}\right) = \beta_0 + \beta_1 x

Exam tip: Linear regression models the mean directly; logistic regression models the log odds linearly. This linearity in log odds is what makes coefficients interpretable as changes in log odds per unit predictor increase.


Worked example: Instagram users by gender

Data: 1069 survey respondents (537 men, 532 women).
328 women and 234 men have Instagram accounts.

GenderUsersTotalProportion ppOdds p1p\frac{p}{1-p}Log odds ln(odds)\ln(\text{odds})
Women328532328/5320.6165328/532 \approx 0.61650.6165/0.38351.6080.6165/0.3835 \approx 1.608ln(1.608)0.475\ln(1.608) \approx 0.475
Men234537234/5370.4358234/537 \approx 0.43580.4358/0.56420.7720.4358/0.5642 \approx 0.772ln(0.772)0.258\ln(0.772) \approx -0.258

Define x=1x = 1 for women, x=0x = 0 for men.
Logistic regression assumes:

log ⁣(p1p)=β0+β1x\log\!\left(\frac{p}{1-p}\right) = \beta_0 + \beta_1 x

Plugging in the log odds:

  • For men (x=0x=0): β0=0.258\beta_0 = -0.258
  • For women (x=1x=1): β0+β1=0.475    β1=0.475(0.258)=0.733\beta_0 + \beta_1 = 0.475 \;\Rightarrow\; \beta_1 = 0.475 - (-0.258) = 0.733

Estimated model:

log ⁣(p1p)=0.258+0.733x\log\!\left(\frac{p}{1-p}\right) = -0.258 + 0.733\,x

Convert back to probability:

p=11+e(0.258+0.733x)p = \frac{1}{1 + e^{-(-0.258 + 0.733\,x)}}

  • For women (x=1x=1): p=11+e0.2580.733=11+e0.4750.6165p = \frac{1}{1+e^{0.258-0.733}} = \frac{1}{1+e^{-0.475}} \approx 0.6165 (matches data).
  • For men (x=0x=0): p=11+e0.2580.4358p = \frac{1}{1+e^{0.258}} \approx 0.4358.

Exam tip: The coefficient β1\beta_1 is the difference in log odds between women and men. A positive β1\beta_1 means higher log odds (and thus higher probability) for the group coded 11.


Business applications

  • Marketing: Predict whether a customer buys a product (based on demographics, browsing data).
  • Credit scoring: Classify loan applicants as likely to default or repay.
  • HR: Model employee attrition (e.g., probability of leaving given satisfaction level).

In all cases, logistic regression outputs a probability between 0 and 1, which can be used for classification with a chosen threshold (e.g., >0.5 → “will leave”).


Key takeaways

  • Logistic regression models binary outcomes using the logistic (sigmoid) function to keep predicted probabilities in (0,1)(0,1).
  • It is built on the Bernoulli distribution.
  • Instead of predicting YY directly, it models the log odds linearly: log(p/(1p))=β0+β1x\log(p/(1-p)) = \beta_0 + \beta_1 x.
  • The odds are p/(1p)p/(1-p); log odds are the natural log of that ratio.
  • Coefficients β1\beta_1 represent the change in log odds for a one‑unit increase in xx.
  • Linear regression fails because it can produce probabilities outside [0,1][0,1].
  • The sigmoid curve ensures valid probabilities: S‑shaped, flat near 0 and 1.

Logistic Regression Model - II

Logistic regression predicts the probability of a binary outcome (success/failure, quit/stay, buy/not buy). Unlike linear regression, it models the log odds of the event as a linear function of predictors, ensuring predictions stay between 0 and 1.

From linear combination to log odds

For multiple predictors x1,x2,,xkx_1, x_2, \dots, x_k, the logistic regression equation expresses the log odds:

ln(P1P)=β0+β1x1+β2x2++βkxk\ln\left(\frac{P}{1-P}\right) = \beta_0 + \beta_1 x_1 + \beta_2 x_2 + \dots + \beta_k x_k

  • PP = probability the event occurs (e.g., employee leaves)
  • β0\beta_0 = intercept (log odds when all xx = 0)
  • β1,β2,\beta_1, \beta_2, \dots = coefficients measuring the effect of each predictor on log odds

Using log odds solves the range problem: probability PP is bounded [0,1][0,1], but log odds can take any real value (,+)(-\infty, +\infty), so the linear model can fit without constraints.

The logistic (sigmoid) function

Rearranging the equation gives probability directly:

P=eβ0+β1x1++βkxk1+eβ0+β1x1++βkxkP = \frac{e^{\beta_0 + \beta_1 x_1 + \dots + \beta_k x_k}}{1 + e^{\beta_0 + \beta_1 x_1 + \dots + \beta_k x_k}}

This is the logistic function (or sigmoid). It produces an S‑shaped curve that smoothly increases from 0 to 1 as the linear combination changes.

Definition: The logistic function maps any real input to a probability between 0 and 1 — essential for binary classification.

Interpreting coefficients

  • A positive coefficient βj\beta_j means an increase in xjx_j increases the log odds (and thus the probability) of the outcome.
  • A negative coefficient means an increase in xjx_j decreases the log odds.
  • Because the relationship between xjx_j and PP is non‑linear, the change in probability per unit change in xjx_j is not constant — it depends on the current value of xjx_j. However, the direction (positive/negative) is fixed.

Exam tip: Logistic regression coefficients refer to log odds, not probability. To get the effect on odds, exponentiate the coefficient: eβje^{\beta_j} gives the odds ratio.

Estimating coefficients: Maximum Likelihood Estimation (MLE)

Linear regression uses least squares; logistic regression uses maximum likelihood estimation (MLE).

Intuition: The model tries many possible coefficient values. For each set, it computes the predicted probability PiP_i for every observation. Then it compares these probabilities to the actual binary outcomes (0 or 1). The goal is to find the coefficient values that make the observed data most likely — i.e., that maximize the likelihood of seeing the actual outcomes.

Procedure:

  1. Start with initial guesses for β\betas.
  2. Compute predicted probabilities via the logistic function.
  3. Calculate the likelihood (a measure of how well predictions match real outcomes).
  4. Adjust coefficients iteratively to increase the likelihood.
  5. Stop when improvement becomes negligible — the maximum likelihood estimates.
flowchart LR
  A[Choose initial β] --> B[Compute predicted probabilities]
  B --> C[Calculate likelihood]
  C --> D{Maximum reached?}
  D -- No --> E[Update β]
  E --> B
  D -- Yes --> F[Final β estimates]

This iterative search can be performed in Excel using the Solver add‑in, by setting up the likelihood function and maximizing it.

Implementation in Excel

For a dataset with one binary outcome and predictors:

  • Use the logistic function to compute predicted probabilities for each row.
  • Construct the log‑likelihood formula (sum of log probabilities for observed outcomes).
  • Run Solver to maximize the log‑likelihood by changing the coefficient cells.

Exam tip: Solver finds the same coefficients that statistical software (R, Python, SPSS) produces — it's a good way to see MLE in action without coding.

Key takeaways

  • Logistic regression models the log odds of a binary outcome.
  • The sigmoid function turns the linear combination into a probability [0,1][0,1].
  • Coefficients indicate direction (positive/negative) on log odds; the effect on probability is non‑linear.
  • Maximum likelihood estimation iteratively finds the best coefficients by maximizing the probability of observing the data.
  • In Excel, Solver can be used to perform MLE for small problems.

Intuition and Problem Setup

Logistic regression models a binary outcome (e.g., leave / stay) as a function of one or more predictors. Here the goal is to predict employee attrition (1 = left, 0 = stayed) from satisfaction level (0 to 1). The relationship is non‑linear: probability of leaving PP is linked to the predictors via the logistic function:

P=11+e(β0+β1x)P = \frac{1}{1 + e^{-(\beta_0 + \beta_1 x)}}

Equivalently, the log‑odds (logit) of the event is linear:

log ⁣(P1P)=β0+β1x\log\!\left(\frac{P}{1-P}\right) = \beta_0 + \beta_1 x

The coefficients β0,β1\beta_0, \beta_1 are estimated by maximum likelihood – an iterative search that finds the values making the observed data most probable.

Step‑by‑Step Estimation in Excel

The data (columns A, B) contain the binary outcome (A) and satisfaction (B). The Excel implementation proceeds as follows.

1. Compute Log‑Odds

Place initial guesses for β0\beta_0 and β1\beta_1 in cells (e.g., H2, I2). For each row ii:

log‑oddsi=β0+β1xi\text{log‑odds}_i = \beta_0 + \beta_1 \cdot x_i

In Excel: = $H$2 + $I$2 * B2 (copied down).

2. Convert Log‑Odds → Odds → Probability

oddsi=elog‑oddsi\text{odds}_i = e^{\text{log‑odds}_i}

Then the predicted probability depends on the actual outcome:

  • If yi=1y_i = 1: Pi=oddsi1+oddsiP_i = \frac{\text{odds}_i}{1 + \text{odds}_i}
  • If yi=0y_i = 0: Pi=11+oddsiP_i = \frac{1}{1 + \text{odds}_i}

Excel: = IF(A2=1, D2/(1+D2), 1/(1+D2)).

3. Log‑Likelihood

Because probabilities multiply across independent observations (product → very small), we work with logs:

i=ln(Pi)\ell_i = \ln(P_i)

Sum all i\ell_i to get the total log‑likelihood (cell, e.g., J2).

4. Optimization with Solver

Goal: maximize the total log‑likelihood by changing β0\beta_0 and β1\beta_1.

  • Open Solver (Data → Solver).
  • Set Objective: cell containing sum of log‑likelihood.
  • To: Max.
  • By Changing Variable Cells: the β0\beta_0, β1\beta_1 cells.
  • Select Solving Method: GRG Nonlinear.
  • Click Solve.

Excel iterates through coefficient combinations and returns the maximum‑likelihood estimates.

flowchart LR
    A[Data: y, x] --> B[Log-odds = β₀ + β₁x]
    B --> C[Odds = exp(log-odds)]
    C --> D{Outcome y?}
    D -->|y=1| E[P = odds/(1+odds)]
    D -->|y=0| F[P = 1/(1+odds)]
    E --> G[Log-likelihood = ln(P)]
    F --> G
    G --> H[Sum log-likelihood]
    H --> I[Maximize with Solver]
    I --> J[MLE coefficients β₀, β₁]

Results and Interpretation

Single Variable Model

The solver yields:

CoefficientEstimate
β0\beta_0 (intercept)0.974
β1\beta_1 (satisfaction)–3.832

Thus the estimated model:

log ⁣(P^1P^)=0.9743.832satisfaction\log\!\left(\frac{\hat{P}}{1-\hat{P}}\right) = 0.974 - 3.832 \cdot \text{satisfaction}

Interpretation:

  • Sign of β1\beta_1 is negative → higher satisfaction lowers the odds of quitting.

  • Magnitude cannot be directly read as a change in probability (non‑linear). Instead compute predicted probability at key satisfaction values:

    SatisfactionPredicted probability of leaving
    0 (not at all satisfied)0.72\approx 0.72 (72 %)
    1 (fully satisfied)0.040.05\approx 0.04–0.05 (4–5 %)
  • The decrease is non‑linear: probability drops steeply at low satisfaction and flattens at high satisfaction.

Multiple Variable Model (Extension)

The same Solver approach extends to several predictors. For a model including:

  • satisfaction level
  • last performance evaluation rating
  • average monthly hours
  • years at company
  • promotion in last 5 years (coded 1/0)
VariableCoefficient (approx.)SignInterpretation
Satisfaction–3.7More satisfied → less likely to leave
Promotion in last 5 yearslarge negativePromoted employees much less likely to leave
Years at companypositive (largest magnitude)+Longer tenure → higher chance of leaving (retirement / better offers)
Average monthly hourspositive+Higher workload → higher chance of leaving
Last evaluation ratingpositive+Higher rating → more likely to leave (counterintuitive – possible reasons: felt under‑rewarded, better external opportunities)

Exam tip: The sign of a logistic coefficient tells the direction of effect on the log‑odds of the outcome. To express effect on probability, compute predicted PP at different xx values. Never interpret a coefficient as a linear change in probability.

Key takeaways

  • Logistic regression models binary outcomes via the logit link: log(P1P)=β0+β1x\log(\frac{P}{1-P}) = \beta_0 + \beta_1 x.
  • Estimation uses maximum likelihood – iterative maximization of the sum of log‑likelihoods.
  • In Excel: compute log‑odds → odds → probability (conditional on outcome) → log‑likelihood → maximize with Solver (GRG Nonlinear).
  • Coefficient sign indicates direction: negative → predictor reduces odds of event.
  • For multiple predictors, each coefficient is interpreted holding others constant; magnitude comparison gives relative importance.
  • Counterintuitive signs (e.g., positive coefficient for performance rating) can reveal hidden dynamics – use domain knowledge to hypothesise.

Logistic Regression – Using Excel with Dummy Variables

When a categorical predictor (e.g., salary level) has ( k ) categories, it enters a logistic regression as ( k-1 ) dummy variables. One category is chosen as the baseline; the coefficients on the dummies measure the change in log‑odds relative to that baseline.

Setting Up Dummy Variables

  • Salary has three categories: low, medium, high.
  • Set low as baseline → create two dummies:
    • ( x_{\text{medium}} = 1 ) if medium salary, else 0
    • ( x_{\text{high}} = 1 ) if high salary, else 0

The logistic regression then includes these dummies alongside continuous predictors.

Model Specification

Eight independent variables are used:

VariableTypeDescription
satisfaction_levelcontinuous (0–1)Employee satisfaction
last_evaluationcontinuous (0–1)Last performance rating
average_monthly_hourscontinuousWorkload (hours/month)
years_at_companyintegerTenure
promotionbinary (0/1)Received promotion in last year?
salary_mediumdummy1 if medium salary
salary_highdummy1 if high salary
(plus intercept)( \beta_0 )

Parameters: ( \beta_0, \beta_1, \dots, \beta_7 ).
Log‑odds for employee ( i ):

[ \text{logit}(p_i) = \ln\left(\frac{p_i}{1-p_i}\right) = \beta_0 + \beta_1 x_{i1} + \cdots + \beta_7 x_{i7} ]

The model is fitted by maximizing the sum of log‑likelihoods (using Excel Solver).

Interpretation of Coefficients (Transcript‑Based)

The exact values are not given, but the sign and relative magnitude are discussed.

VariableSignInterpretation
satisfaction_levelnegative, large magnitudeHigher satisfaction → much less likely to leave
promotionnegative, large magnitudePromotion → much less likely to leave
salary_mediumnegativevs low‑salary baseline: medium‑salary employees are less likely to leave
salary_highnegative, larger magnitude than mediumHigh‑salary employees are even less likely to leave than medium
years_at_companypositive, substantial magnitudeLonger tenure → more likely to leave (perhaps for better prospects)
last_evaluationdiminished after including salary/promotionBecomes secondary once satisfaction and salary are controlled
average_monthly_hoursdiminishedSimilarly secondary

Key insight: Satisfaction, salary, and promotion dominate the prediction; evaluation and hours matter less once these are accounted for.

Worked Example: What‑If Analysis

Employee profile:

VariableValue
satisfaction_level0.5 (50%)
last_evaluation0.7
average_monthly_hours250
years_at_company1
promotion0
salarylow → ( x_{\text{medium}}=0,; x_{\text{high}}=0 )

Prediction (using previously estimated coefficients):

Compute log‑odds:

[ \begin{aligned} \text{log‑odds} &= \beta_0 + \beta_1(0.5) + \beta_2(0.7) + \beta_3(250) + \beta_4(1) \ &\quad + \beta_5(0) + \beta_6(0) + \beta_7(0) \ &= -1.075 \end{aligned} ]

Convert to probability:

[ p = \frac{e^{-1.075}}{1+e^{-1.075}} \approx 0.254 \quad (25.4%) ]

Scenario Testing

Change one variable at a time and recompute ( p ) (hypothetical outcomes from transcript):

ScenarioChangeNew ( p )Interpretation
Raise salary to medium( x_{\text{medium}}=1 )16.8%Quit risk drops ◄
Raise salary to high( x_{\text{high}}=1 )4.7%Quit risk very low ◄◄
Give promotion( x_{\text{promotion}}=1 )(substantial reduction)Promotion also strongly reduces leaving

Business use: the HR department can estimate the impact of each intervention and choose the most cost‑effective strategy.

flowchart LR
  A[Employee profile] --> B[Logistic model]
  B --> C[Baseline probability 25.4%]
  C --> D{Intervention?}
  D --> E[Increase salary to medium]
  D --> F[Increase salary to high]
  D --> G[Give promotion]
  E --> H[16.8%]
  F --> I[4.7%]
  G --> J[<25.4%]

Extensions: Interaction Effects & Scenario Forecasting

  • Interaction between salary level and department can reveal differential effects (e.g., a salary hike may retain HR staff more than management).
  • This method is called scenario forecasting — the organisation tests multiple hypothetical changes and picks the one that best reduces turnover risk.

Exam tip: When building logistic models with categorical predictors, always create ( k-1 ) dummies. The baseline category (e.g., “low salary”) is absorbed into the intercept. Changing a dummy to 1 shifts the log‑odds relative to that baseline.

Key takeaways

  • Categorical variables enter logistic regression as dummy variables (baseline omitted).
  • Coefficients on dummies represent change in log‑odds compared to the baseline category.
  • In the worked HR example: low → medium salary cut quit probability from 25.4% to 16.8%; low → high cut it to 4.7%.
  • Satisfaction and promotion have large negative effects; years at company increases leaving propensity.
  • Once key factors (salary, satisfaction, promotion) are controlled, variables like work hours and evaluation ratings lose predictive power.
  • Use the fitted model for scenario forecasting: change one predictor at a time and compute the new probability to guide decisions.

The Curse of Dummy Variables

Fixed effects and interaction effects quickly explode the number of features. In the employee‑retention example:

  • Salary – 3 categories → 2 dummy variables
  • Department – 10 categories → 9 dummy variables
  • Salary × Department interaction – 30 unique combinations → 29 dummy variables

Total: over 30 dummy columns. Estimation becomes unstable, convergence may fail, and interpretation suffers.

SourceCategoriesDummy variables needed
Salary (fixed)32
Department (fixed)109
Salary × Department (interaction)3029
Total≥ 30

One partial remedy: drop interaction terms for categories with very few observations (e.g., if a department has only low‑salary employees, ignore the other salary‑department combos). But even then the model may stay too complex.

Exam tip: Whenever a categorical feature has many levels, or you include interactions, always check the total dummy count. A model with >20–30 dummy variables on a modest dataset is a red flag for overfitting and non‑convergence.

Why Variable Selection Matters

Variable selection is the process of identifying the subset of features that are most important for predicting the outcome, keeping the model simple without sacrificing predictive or explanatory power.

Three core reasons:

  1. Avoid overfitting – Adding more features always inflates R2R^2 (or pseudo‑R2R^2), eventually approaching 1 on training data. But an R2R^2 close to 1 signals that the model fits noise, not signal – it will generalise poorly to new data.
  2. Interpretability – A model with 5–10 coefficients is far easier to understand than one with 50.
  3. Computational efficiency – Fewer variables means faster training and lower memory use.

Forward Selection

Start with an empty model (only the intercept). At each step:

  1. Test every candidate variable not yet in the model.
  2. Add the one that most improves model fit (e.g., highest R2R^2 increase).
  3. Use an F‑test (or deviance test in logistic regression) to check whether the improvement is significant.
  4. Repeat until no remaining variable yields a significant improvement.
flowchart LR
    A[Empty model: intercept only] --> B{Test each candidate}
    B --> C[Add variable with best improvement]
    C --> D{Significant?}
    D -->|Yes| B
    D -->|No| E[Stop, keep current model]

Backward Elimination

Start with the full model (all variables). At each step:

  1. Identify the least important variable (e.g., highest pp‑value, smallest R2R^2 drop if removed).
  2. Remove it.
  3. Repeat until removing any remaining variable significantly hurts model fit.
flowchart LR
    A[Full model: all variables] --> B{Find least important}
    B --> C[Remove it]
    C --> D{Removal harms model?}
    D -->|No| B
    D -->|Yes| E[Stop, keep current model]

Stepwise Selection

A hybrid that combines forward and backward:

  • Begin like forward selection: add the best variable.
  • At every step, re‑evaluate all previously included variables. If any has become non‑significant (because the new variable took over its role), remove it.
  • Continue until no variable can be added and none needs removal.

This handles the problem that some variables matter only in the presence of others – a variable that was significant at step 2 may become redundant after a later addition.

Ad‑hoc P‑Value Approach

A simpler, more manual method:

  1. Fit the full model once.
  2. Examine the pp‑values of each coefficient.
  3. Remove all variables with non‑significant pp‑values.
  4. (Optional) Refit and re‑check – significance can shift when variables are removed.

Caution: Because coefficients interact, a variable may appear non‑significant in the full model but become significant after dropping a correlated predictor. Always re‑evaluate after pruning.

Exam tip: The ad‑hoc p‑value method is fast but risky. It is acceptable only when you verify stability by fitting a few reduced models. The stepwise approach is more robust because it continuously checks for both additions and removals.

Key Takeaways

  • Fixed/interaction effects with many categories generate dozens of dummy variables, causing overfitting, convergence issues, and poor interpretability.
  • Variable selection finds a balance between model simplicity and accuracy.
  • Common approaches: forward selection (add one by one), backward elimination (remove one by one), stepwise selection (add then re‑check removals), and ad‑hoc p‑value (prune non‑significant predictors).
  • Always watch for overfitting: more features inflate R2R^2, but hurt generalisation.
  • In practice, use software‑built routines; but understand the logic to set sensible stopping criteria (e.g., significance level for entry/removal).

Non-Linear Regression Model

Non-linear regression models relationships where the change in the dependent variable is not proportional to the change in the independent variable. Unlike linear regression, it can capture curved, S‑shaped, or saturating patterns. This flexibility is essential for many real-world business problems where the underlying dynamics are inherently complex.

Why non‑linear? Common business applications

  • Advertising & sales – Early ad spend may boost sales sharply, but additional spend eventually yields diminishing returns. Non‑linear models capture this plateau.
  • Pricing & demand – Lowering price may initially spike demand, but further cuts produce only marginal gains. Complex price–response curves are better fitted with non‑linear terms.
  • Growth models – Revenue or product adoption often follows an S‑shaped (sigmoid) pattern: rapid early growth, then slowdown as market saturates.
  • Manufacturing & cost – Output costs may fall due to economies of scale, then rise again from inefficiencies. A non‑linear model can identify the optimal production level.

Key non‑linear regression methods

Polynomial regression

Generalizes linear regression by adding higher‑degree terms of the predictor(s). A quadratic (2nd‑degree) model with one predictor xx is:

y=β0+β1x+β2x2y = \beta_0 + \beta_1 x + \beta_2 x^2

Adding a cubic term (β3x3\beta_3 x^3) yields a cubic polynomial.

When to use – When the dependent variable rises/falls sharply at certain points and flattens elsewhere (e.g., product demand vs. price).
Caution – Higher degrees increase complexity and risk overfitting; quadratic or cubic usually suffice.

Exponential regression

Models rapid acceleration (or deceleration) where the dependent variable changes at a rate proportional to its current value:

y=β0eβ1xy = \beta_0 e^{\beta_1 x}

When to use – Viral campaign spread, rumor propagation, or any scenario where growth accelerates quickly.

Logarithmic regression

Models quick initial growth that then levels off – the mirror of exponential:

y=β0+β1ln(x)y = \beta_0 + \beta_1 \ln(x)

When to use – Situations with diminishing returns, e.g., advertising spend vs. brand awareness.

Power regression

Models a relationship where the rate of change in yy is a constant proportion of the change in xx:

y=β0xβ1y = \beta_0 x^{\beta_1}

When to use – Production efficiency vs. units produced (efficiency improves at a decreasing rate as scale increases).

Logistic regression (non‑linear form)

Uses the sigmoid (logistic) function to produce an S‑shaped curve:

y=11+e(β0+β1x)y = \frac{1}{1 + e^{-(\beta_0 + \beta_1 x)}}

(Here yy can be a continuous proportion or a binary probability.)
When to use – New product adoption, market penetration, or any process that saturates.

Choosing the right method

flowchart TD
    A[Observe pattern of relationship] --> B{Is it linear?}
    B -->|Yes| C[Use linear regression]
    B -->|No| D[Identify shape]
    D -->|Diminishing returns, levels off| E[Logarithmic]
    D -->|Rapid acceleration / deceleration| F[Exponential]
    D -->|S‑shaped / saturation| G[Logistic]
    D -->|Parabolic / curved peak or trough| H[Polynomial (quadratic/cubic)]
    D -->|Constant proportional rate| I[Power]

Comparison of methods

MethodPattern capturedTypical equationExample use
Polynomial (quadratic)Curved, single bendy=β0+β1x+β2x2y = \beta_0 + \beta_1 x + \beta_2 x^2Price vs. demand
ExponentialRapid growth/decayy=β0eβ1xy = \beta_0 e^{\beta_1 x}Viral campaign spread
LogarithmicFast initial growth, then flatteningy=β0+β1lnxy = \beta_0 + \beta_1 \ln xAd spend vs. sales
PowerConstant proportion rate changey=β0xβ1y = \beta_0 x^{\beta_1}Production efficiency scaling
LogisticS‑shaped saturationy=11+e(β0+β1x)y = \frac{1}{1 + e^{-(\beta_0+\beta_1 x)}}Product adoption

Exam tip – Overfitting is a real danger with polynomial regression. Stick to quadratic or cubic unless domain knowledge strongly suggests a higher degree. Cross‑validate to check generalisability.

Key takeaways

  • Non‑linear regression models curved, non‑proportional relationships between variables.
  • Common methods: polynomial (parabolic), exponential (rapid change), logarithmic (diminishing returns), power (constant proportion), logistic (S‑shaped).
  • Choice depends on the observed pattern in the data – mis‑specification leads to poor predictions.
  • Applications include advertising response, pricing optimisation, growth modelling, and manufacturing cost analysis.
  • Higher‑degree polynomials increase flexibility but also the risk of overfitting; keep models as simple as the data allow.

Case Study: Bangalore House Prices

A case study integrating nonlinear regression and categorical-variable techniques to model house prices in Bangalore. The dataset contains 4340 rows and 10 variables.

Data Overview

VariableTypeDescription
posted_byCategoricalOwner, dealer, or builder
RERA_approvalBinary1 if approved, 0 otherwise
bedroomsNumericNumber of bedrooms
total_sqftNumericTotal area in square feet
ready_to_moveBinary1 if ready to occupy, 0 otherwise
resaleBinary1 if resale property, 0 otherwise
addressCategorical (high-level)General location
longitudeNumericLongitude coordinate
latitudeNumericLatitude coordinate
priceNumeric (lakhs of ₹)House price

The response variable of interest is price, but due to its relationship with area and skewness, a transformation is needed.

Five Key Questions

The case study builds toward one main question through four preparatory ones:

  1. How is price distributed across the city? (exploratory mapping)
  2. Does price depend on specific streets/areas? (pattern identification)
  3. Is the price distribution normal? (normality check for regression)
  4. Does price differ by who posted (builder, owner, dealer)?
  5. What factors impact price, and how? (main modelling question)

These questions are cumulative: Q1–Q4 inform the model specification for Q5.

Exploratory Data Analysis (EDA)

Price Distribution and Normality

A histogram of price shows positive skew: high frequency at low prices, a sharp drop, then a long right tail with few observations. The distribution is clearly not normal.

Plotting price per square foot (price/total_sqft\text{price} / \text{total\_sqft}) reduces the effect of area but still shows positive skew – not symmetric.

Exam tip: In real data, variables like price, income, and rent almost always exhibit positive skew. The standard remedy is a log transformation.

Applying log(price per sq ft)\log(\text{price per sq ft}) yields a near-symmetric histogram (some outliers on the left remain). Visually, the normality assumption becomes plausible. Formal confirmation would require a chi-square goodness-of-fit test.

Why Price per Sq Ft and Log Transformation

  • Price per sq ft is the relevant metric for buyers because total price is proportional to area. A buyer compares cost per unit area.
  • Log transformation is the appropriate fix for positive skew. It stabilises variance and makes the distribution more symmetric – both important for regression assumptions.

Nonlinear Regression Model

Model Specification

The regression is nonlinear because the response variable is transformed:

Dependent variable=log(price per sq ft)\text{Dependent variable} = \log(\text{price per sq ft})

Independent variables (predictors):

  • RERA_approval (binary)
  • bedrooms (numeric – initially treated as continuous)
  • ready_to_move (binary)
  • resale (binary)
  • total_sqft (numeric)
  • posted_by (categorical: owner, dealer, builder) – converted to dummy variables with builder as the baseline

This is a log-linear model: response is log-transformed, predictors remain untransformed.

Results and Interpretation

PredictorSignSignificance (5% level)Interpretation
RERA_approvalPositiveSignificantApproval increases price per sq ft
bedroomsPositiveSignificantMore bedrooms → higher price per sq ft (holding area fixed)
total_sqftNegativeSignificantLarger area → lower price per sq ft (economies of scale)
ready_to_moveNot significantNo price premium for readiness
resaleNot significantResale properties do not sell at a discount or premium
posted_by = ownerPositiveSignificantHigher price per sq ft than builder
posted_by = dealerPositive (larger)SignificantEven higher premium over builder

Exam tip: In a log-linear model, coefficients on binary predictors represent the expected change in log(Y)\log(Y); exponentiate to get the multiplicative effect on YY (e.g., eβe^{\beta} gives the factor change in price per sq ft).

Because the dependent variable is logged, each coefficient indicates the change in log(price per sq ft)\log(\text{price per sq ft}) for a one-unit increase in the predictor. For posted_by, both owner and dealer command a premium relative to builder, with dealer being the costliest.

Model Improvements and Further Analysis

The lecture identifies several ways to upgrade the model:

  1. Log-log model: Transform both response and total_sqft – i.e., model log(price per sq ft)\log(\text{price per sq ft}) as a function of log(total_sqft)\log(\text{total\_sqft}). This captures proportional relationships better.
  2. Bedrooms as categorical: The price increment per additional bedroom is likely nonlinear. Treating bedrooms as a categorical variable (1BR, 2BR, 3BR+) or applying a transformation (log, square root) may improve fit.
  3. Interaction effects: resale and posted_by may interact – an owner selling a resale property might have different pricing than a builder selling a new one.
  4. Location effect: Address/lat–lon data introduces many categories. Smart encoding (e.g., clustering neighbourhoods, using spatial coordinates, or creating a distance-from-center variable) is needed to avoid an explosion of dummy variables.
  5. Cross-validation for prediction: To compare models on predictive performance (not just R2R^2), split the data (e.g., 4000 training, 340 test). Train on one part, predict the other, and evaluate accuracy. This concept is explored further in the next module on time series and predictive modelling.

Key takeaways

  • The case study demonstrates a complete workflow: EDA → transformation → nonlinear regression → interpretation → refinement.
  • Log transformation is essential for right-skewed price data; log-linear models are a standard nonlinear regression tool.
  • Categorical predictors require dummy variables; interpretation of coefficients changes when the response is logged.
  • Model improvement avenues include log-log form, categorical treatment of numeric variables, interactions, and spatial effects.
  • Cross-validation separates model fitting from evaluation – critical for predictive modelling.

Linear Regression Recap

Linear regression models the relationship between a continuous dependent variable and one or more independent variables. The goal is to quantify the strength and direction of these relationships: how changes in a predictor translate into increases or decreases in the outcome.

Because of its simplicity and interpretability, linear regression is widely used when the relationship between variables can be assumed linear. For example, a company can model the relationship between various factors (salary, workload, work environment) and employee satisfaction to identify what keeps employees happy.

Exam tip: Linear regression predicts a continuous outcome. The coefficients are directly interpretable: a one-unit increase in XX is associated with a β\beta change in YY, holding other predictors constant.

Key takeaways

  • Linear regression models continuous dependent variables.
  • Assumes a straight-line relationship.
  • Provides clear, actionable insights in business contexts.
  • Example: employee satisfaction analysis.

Logistic Regression Recap

Logistic regression is used when the dependent variable is binary (two possible outcomes). It models the probability of an event occurring, ensuring predicted values fall between 0 and 1.

Unlike linear regression, logistic regression uses the logit link function:

logit(p)=ln(p1p)=β0+β1X1++βkXk\text{logit}(p) = \ln\left(\frac{p}{1-p}\right) = \beta_0 + \beta_1 X_1 + \dots + \beta_k X_k

where pp is the probability of the event.

Business applications

  • Employee attrition: Predict likelihood of an employee leaving based on job satisfaction, salary, workload, tenure. Enables proactive retention (promotions, salary increases, development).
  • Customer segmentation & marketing: Predict whether a customer will purchase based on browsing behavior, purchase history, demographics. Helps target campaigns.
  • Credit scoring & risk management: Predict probability of loan default using credit history, income, employment status. Informs approval/denial decisions.

Key takeaways

  • Logistic regression for binary outcomes (0/1).
  • Predicted values are probabilities bounded by 0 and 1.
  • Used in HR analytics, marketing, financial risk.

Non‑Linear Regression Recap

Non‑linear regression is needed when the relationship between variables cannot be adequately captured by a straight line. Many real‑world business situations show curved patterns.

Example: House price analysis – the dependent variable (price) may not be normally distributed. Applying a logarithmic transformation (e.g., ln(price)\ln(\text{price})) creates a non‑linear model that often improves performance.

Common scenarios

  • Diminishing returns in marketing: Sales increase with ad spend, but after a point each additional dollar yields smaller sales increments. Non‑linear models capture this saturation effect, helping allocate budgets efficiently.
  • Demand forecasting: The relationship between price and demand often follows a curve – small price changes may have large effects on demand in some ranges, little effect in others.

Exam tip: Non‑linear does not necessarily mean “complicated.” A log transformation of either the dependent or independent variable is a simple form of non‑linear regression that can linearise a curved relationship.

Key takeaways

  • Non‑linear regression for curved relationships.
  • Logarithmic transformations are a common tool.
  • Business examples: marketing diminishing returns, price–demand curves.

Categorical predictors

Many business variables are categorical – gender, region, product type. These are incorporated into linear, logistic, or non‑linear regression using dummy variables (0/1 coding). This allows comparison of the impact of different categories on the outcome.

Interaction effects

Interaction effects occur when the relationship between one independent variable and the dependent variable changes depending on the value of another independent variable. For example:

  • The effect of advertising on sales may depend on the pricing strategy.
  • The impact of employee training on performance may vary by department.

Interaction terms are added to the regression model, often as the product of the involved variables (e.g., X1×X2X_1 \times X_2). Including them leads to a more precise model that captures how combinations of factors influence outcomes.

flowchart LR
  A[Factor 1] --> C[Outcome]
  B[Factor 2] --> C
  A -.->|moderates| B
  B -.->|moderates| A
  A & B --> D[Interaction Term]
  D --> C

Key takeaways

  • Dummy variables enable categorical predictors in regression.
  • Interaction effects capture dependency between predictors.
  • Including interactions improves model accuracy for business decisions (e.g., attrition, house prices).

Non - Parametric Methods

Parametric and Nonparametric Methods

Statistical methods answer questions about populations using sample data: summarizing, testing relationships, making predictions. The choice between parametric and nonparametric methods depends entirely on what we assume about the underlying data distribution.

What is a parametric method?

The term comes from parameters — numbers that summarize a population (e.g., population mean μ\mu, population proportion pp, population variance σ2\sigma^2). Parametric methods assume the data follow a specific probability distribution completely defined by these parameters.

  • Example: Binary data → Bernoulli distribution, defined by pp.
  • Example: Continuous data → Normal distribution, defined by μ\mu and σ2\sigma^2.

Key idea: Parametric methods require a “blueprint” — the data must come from a known distribution (e.g., normality for a tt-test). When the assumption holds, these methods are efficient and powerful.

What is a nonparametric method?

Nonparametric methods make no assumption about the underlying distribution. They are also called distribution-free methods. They work with ranks, relative positions, or counts rather than raw values and parameters.

  • Data can be skewed, multimodal, have outliers — nonparametric methods remain valid.
  • They are more flexible and robust when assumptions fail.

Core problems addressed by nonparametric methods in this module

  1. Independence between two variables (e.g., product type vs. satisfaction).
  2. Goodness of fit — does the data follow a specified distribution?
  3. Two-sample distribution comparison — do two samples come from the same distribution?

Worked example: Customer satisfaction scores (Product A vs. Product B)

A company collects satisfaction scores (1–10) for two products. The goal: determine whether a significant difference exists.

Parametric approach (two-sample tt-test)

  • Null hypothesis: μA=μB\mu_A = \mu_B (population means equal).
  • Alternative: μAμB\mu_A \neq \mu_B.
  • Assumptions: scores are normally distributed in both groups; often equal variances assumed.
  • Output: estimate of mean difference, pp-value, confidence interval.

Nonparametric approach (Mann‑Whitney U test / Wilcoxon rank sum test)

  • Null hypothesis: No difference in the distribution of scores between groups.
  • Alternative: distributions differ.
  • Method: Ranks all observations together; uses relative ranks to compute test statistic.
  • No normality assumption; robust to skewness, outliers, bimodality.
  • Output: a pp-value indicating whether one group tends to have higher/lower scores, but no direct estimate of effect size (e.g., mean difference).

Comparison: parametric vs. nonparametric

AspectParametricNonparametric
AssumptionsData follows a specific distribution (e.g., normal)None (distribution‑free)
Parameters estimatedμ,σ2,p\mu, \sigma^2, p, etc.Not directly; uses ranks
Efficiency (given assumptions hold)High – fewer data needed, more powerfulLower – larger samples needed for same precision
Robustness to violationsLow – results can be misleadingHigh – valid even with skewness, outliers
InterpretationDirect: mean difference, regression coefficientsIndirect: only direction or existence of difference
Example testTwo‑sample tt-testMann‑Whitney U test
flowchart TD
    A[Data collected] --> B{Can we assume normality?}
    B -->|Yes| C[Use parametric method - e.g., t-test]
    B -->|No / Unsure| D[Use nonparametric - e.g., Wilcoxon rank sum test]
    C --> E{Check assumptions?}
    E -->|Violated| D

Exam tip: Parametric tests are more powerful only when their assumptions are met. If data is skewed or has outliers, a nonparametric test is the safer choice — it may require a larger sample but avoids invalid conclusions.

Advantages and disadvantages

Parametric

  • ✅ Simpler, fewer parameters to estimate.
  • ✅ Powerful and precise when assumptions hold.
  • ❌ Results can be completely wrong if assumptions violated.

Nonparametric

  • ✅ Flexible, works with any distribution.
  • ✅ Robust to outliers and skewed data.
  • ❌ Requires larger sample sizes for equivalent power.
  • ❌ Provides less detailed inference (e.g., no mean difference).

Practical workflow

  1. Start with parametric methods if assumptions seem reasonable.
  2. Always check assumptions (e.g., using goodness‑of‑fit tests, Q‑Q plots).
  3. If assumptions are violated, switch to a nonparametric alternative.

Key takeaways

  • Parametric methods assume a known distribution (e.g., normal) and estimate population parameters.
  • Nonparametric methods (distribution‑free) use ranks or counts and require no distributional assumption.
  • Same goal — hypothesis testing or inference — but different trade‑offs: efficiency vs. robustness.
  • The Mann‑Whitney U test is the nonparametric counterpart to the two‑sample tt-test.
  • Nonparametric tests often cannot quantify effect size beyond “different or not”.

Intuition and Definition

Independence between two events means the occurrence or non‑occurrence of one does not influence the occurrence of the other. Intuitively: knowing whether one event happened gives zero information about whether the other happened.
Example: Tossing two coins — the outcome of the first toss tells you nothing about the outcome of the second.

Formal definition – events AA and BB are independent iff
P(AB)=P(A)P(B)P(A \cap B) = P(A) \cdot P(B)
This is the multiplication rule for independent events. If the equality holds, the chance that both events occur is simply the product of their individual probabilities; no “adjustment” for influence.

Business Example: Shoe and Phone Case

Retail manager analyzing shopping behaviour:

  • Event A: customer buys a particular brand of shoes
  • Event B: customer buys a mobile phone case

Suppose P(A)=0.3P(A) = 0.3 and P(B)=0.2P(B) = 0.2.
If the two purchases are independent, then
P(AB)=0.3×0.2=0.06P(A \cap B) = 0.3 \times 0.2 = 0.06
i.e., about 6% of customers would buy both.

Dependence can be positive or negative:

  • Positive: customers who buy shoes are more likely to buy socks → P(AB)>P(A)P(B)P(A \cap B) > P(A)P(B)
  • Negative: customers who buy shoes are less likely to buy slippers → P(AB)<P(A)P(B)P(A \cap B) < P(A)P(B)

For any two dependent events, the multiplication rule does not hold.

Dependent Events: Age and Gaming Console

  • Event A: customer aged 18‑25
  • Event B: customer purchases a gaming console

Intuition says younger people are more likely to buy a console → the events are dependent.
In this case:
P(AB)>P(A)P(B)P(A \cap B) > P(A)P(B)
A larger joint probability than the independence assumption would predict.

Independent Random Variables

Independence extends naturally to random variables XX and YY:
XX and YY are independent iff for every pair of values (x,y)(x, y),
P(X=x,  Y=y)=P(X=x)P(Y=y)P(X = x,\; Y = y) = P(X = x) \cdot P(Y = y)
Knowing the value of XX gives no information about YY (and vice versa).

Business context – an online platform tracks two variables per customer per month:

  • XX = number of digital products purchased
  • YY = number of physical goods purchased

If XX and YY are independent, marketing strategies for digital and physical products can be developed separately.

Testing Independence with Data: Toy Example

The company samples 100 customers and observes:

Marginal distribution of XX (digital products):

xxFrequencyP(X=x)P(X=x)
0100.10
1500.50
2300.30
3100.10
Sum1001.00

Marginal distribution of YY (physical goods):

yyFrequencyP(Y=y)P(Y=y)
050.05
1400.40
2400.40
3150.15
Sum1001.00

If XX and YY are independent, the expected joint probability for any combination is the product of the marginals:

  • P(X=0,Y=0)=0.10×0.05=0.005P(X=0, Y=0) = 0.10 \times 0.05 = 0.005 → expected 0.5 customers
  • P(X=1,Y=1)=0.50×0.40=0.20P(X=1, Y=1) = 0.50 \times 0.40 = 0.20 → expected 20 customers

Similarly, the full independence‑implied joint distribution would be computed for all (x,y)(x,y) pairs.

Key insight: In real data, even when independence holds, the observed counts will never exactly match the products due to sampling variability. A non‑parametric test (e.g., chi‑square test of independence) determines whether the deviation is statistically significant or just random noise.

In the toy example, we expect 0.5 customers with X=0,Y=0X=0,Y=0, but we could observe 1 or 0. If observed = 1, the difference is small relative to sampling error; if observed = 10, it would strongly suggest dependence.

The goal: detect whether, for all (x,y)(x,y),
P(X=x,Y=y)P(X=x)P(Y=y)P(X=x,Y=y) \approx P(X=x)\,P(Y=y)
“Approximately” because sampling variation is accounted for.

Key takeaways

  • Independence means P(AB)=P(A)P(B)P(A \cap B) = P(A)P(B); knowing one event gives no info about the other.
  • For random variables: equality of joint and product of marginals must hold for all values.
  • Dependence can be positive (increases joint probability) or negative (decreases it).
  • In practice, we compare observed joint frequencies to the product of marginal frequencies; sampling variability prevents exact match.
  • A non‑parametric method (covered next) tests whether the gap is statistically significant.

Chi-square Test of Independence

A chi-square test of independence determines whether two categorical variables are associated. Intuitively, if the variables are independent, the observed pattern in a contingency table should match what we expect by chance; large mismatches signal dependence.

Hypotheses

  • Null H0H_0: The two variables are independent.
  • Alternative H1H_1: The two variables are not independent (dependent).

Contingency Table (Observed Frequencies)

Data are arranged in an r×cr \times c table, where rr = number of rows (categories of variable 1) and cc = number of columns (categories of variable 2). Each cell contains the observed frequency OijO_{ij}.

Expected Frequencies

Under H0H_0, the expected frequency for cell (i,j)(i,j) is derived from the multiplication rule of probability:

Eij=(Row i total)×(Column j total)Grand total nE_{ij} = \frac{(\text{Row } i \text{ total}) \times (\text{Column } j \text{ total})}{\text{Grand total } n}

Test Statistic

The chi-square test statistic measures total squared deviation between observed and expected, standardized by expected:

χ2=i=1rj=1c(OijEij)2Eij\chi^2 = \sum_{i=1}^{r} \sum_{j=1}^{c} \frac{(O_{ij} - E_{ij})^2}{E_{ij}}

Degrees of Freedom

Under H0H_0, χ2\chi^2 follows a chi-square distribution with:

df=(r1)(c1)df = (r-1)(c-1)

Decision via p-value

Compute the p-value = P(χdf2calculated χ2)P(\chi^2_{df} \geq \text{calculated } \chi^2). If p-value <α< \alpha (commonly 0.05), reject H0H_0 and conclude the variables are dependent.


Worked Example: Bloomberg Businessweek

A survey asked business travelers about the type of ticket (first class, business class, economy) and trip type (domestic, international).

Observed frequencies (partial):

Ticket typeDomesticInternationalRow total
First class292251
Others (business, economy)not specifiednot specified(remainder)
Column total642?n = 920

(Only the first‑class row was explicitly given; the domestic column total is 642.)

Expected frequency for first class / domestic under independence:

E11=51×64292035.59E_{11} = \frac{51 \times 642}{920} \approx 35.59

Contribution of this cell to χ2\chi^2:

(2935.59)235.591.22\frac{(29 - 35.59)^2}{35.59} \approx 1.22

Summing over all six cells gives:

χ2=100.43\chi^2 = 100.43

Degrees of freedom: df=(31)(21)=2df = (3-1)(2-1) = 2.

p-value: Using Excel’s CHISQ.DIST.RT(100.43, 2), the p-value is approximately 102210^{-22} (essentially 0).

Conclusion: Since p-value <0.05< 0.05, reject H0H_0. The type of ticket purchased is not independent of the type of trip; a significant association exists.


flowchart LR
  A[Observed & Expected frequencies] --> B[Compute χ² = Σ (O-E)²/E]
  B --> C[Compare to χ² distribution with df = (r-1)(c-1)]
  C --> D{p-value < α?}
  D -->|Yes| E[Reject H₀: variables are dependent]
  D -->|No| F[Fail to reject H₀: no evidence of dependence]

Exam tip: The test requires that expected frequencies are at least 5 for most cells (commonly 80% of cells). If violated, combine categories or use Fisher’s exact test. The test only detects existence of association, not strength or direction.

Key takeaways

  • Chi-square test of independence assesses association between two categorical variables.
  • H0H_0: independence; H1H_1: dependence.
  • Expected frequency per cell = (row total × column total) / grand total.
  • Test statistic: χ2=(OE)2/E\chi^2 = \sum (O-E)^2/E.
  • Degrees of freedom = (r1)(c1)(r-1)(c-1).
  • A small p-value (e.g., < 0.05) leads to rejection of independence.

Chi-Square Test of Independence (Categorical Variables)

The chi-square test of independence determines whether two categorical variables are related or independent. Intuitively, if the variables are independent, the distribution of one variable should look roughly the same across all levels of the other variable. If they are dependent, some categories will have systematically different proportions.

Example: Department vs. Salary in an HR Dataset

  • Dataset: 14,999 employees, 10 variables. Focus on two categorical variables:
    • Department (10 categories): Sales, Accounting, HR, Technical, Support, Management, IT, Product Management, Marketing, R&D.
    • Salary (3 categories): Low, Medium, High.
  • Research question: Is salary independent of department? (Equivalently: Does salary distribution vary across departments?)

Hypotheses

  • H0H_0: Department and salary are independent.
  • H1H_1: Department and salary are not independent (i.e., there is an association).

Steps of the Test

Step 1 – Contingency Table of Observed Frequencies

Create a two-way table using COUNTIFS in Excel. Rows = departments, columns = salary levels.

DepartmentLowMediumHighRow total
Sales2099......7316
Accounting358.........
HR............
Technical............
Support............
Management............
IT............
Product Mgmt............
Marketing............
R&D............
Column total4140......14999

(Exact counts not fully listed in the lecture; the computed χ² uses full 30-cell table.)

Step 2 – Expected Frequencies under H0H_0

Under independence, the expected count for cell (i,j)(i,j) is:

Eij=(Row totali)×(Column totalj)NE_{ij} = \frac{(\text{Row total}_i) \times (\text{Column total}_j)}{N}

Example for Sales × Low:

ESales,Low=7316×4140149992019.35E_{\text{Sales,Low}} = \frac{7316 \times 4140}{14999} \approx 2019.35

Compute all expected frequencies; verify that row and column totals match the observed marginals.

Step 3 – Chi-Square Test Statistic

χ2=i=1rj=1c(OijEij)2Eij\chi^2 = \sum_{i=1}^{r} \sum_{j=1}^{c} \frac{(O_{ij} - E_{ij})^2}{E_{ij}}

For Sales × Low:

(20992019.35)22019.353.14\frac{(2099 - 2019.35)^2}{2019.35} \approx 3.14

Summing over all 30 cells yields:

χ2=700.92\chi^2 = 700.92

Step 4 – Degrees of Freedom

df=(r1)(c1)=(101)(31)=18df = (r-1)(c-1) = (10-1)(3-1) = 18

Step 5 – p-value

The p-value is the right-tail probability of obtaining a χ2\chi^2 value at least as extreme as 700.92 under a χ182\chi^2_{18} distribution.

In Excel: =CHISQ.DIST.RT(700.92, 18)p1×10137p \approx 1 \times 10^{-137} (essentially zero).

Step 6 – Conclusion

Since the p-value is far below any common significance level (e.g., 0.05), we reject H0H_0. There is strong evidence that salary and department are not independent – salary distributions differ across departments.

Understanding which categories drive the association

The largest contributions to χ2\chi^2 come from the Management department:

  • Deviations: (3 values) sum to ≈ 636.77 out of 700.92.
  • This suggests that Management’s salary pattern is markedly different from the average.

Further analysis could test independence after removing Management (or Management, Sales, HR, Support) to see if the remaining departments show independence.

flowchart TD
    A[State H₀: Independence] --> B[Build contingency table of observed counts]
    B --> C[Compute expected counts under H₀]
    C --> D[Calculate χ² statistic]
    D --> E[Find degrees of freedom (r-1)(c-1)]
    E --> F[Obtain p-value (right-tail)]
    F --> G{ p < α? }
    G -->|Yes| H[Reject H₀ → Variables are dependent]
    G -->|No| I[Fail to reject H₀ → No evidence of association]

Exam tip: The chi-square test only tells you whether there is an association, not how strong it is. Large cell contributions (like Management’s) can hint at which categories differ, but follow-up tests are needed to confirm.

Key Takeaways

  • The chi-square test of independence compares observed frequencies to expected frequencies under independence.
  • Expected frequencies are calculated using the product of marginal totals divided by the total sample size.
  • Test statistic: χ2=(OE)2E\chi^2 = \sum \frac{(O - E)^2}{E}.
  • Degrees of freedom = (#rows1)×(#cols1)(\#\text{rows} - 1) \times (\#\text{cols} - 1).
  • A very small p-value leads to rejection of independence.
  • The test is non-parametric – it makes no distributional assumptions about the underlying population, only that the data are counts.

Chi-Square Test of Independence for Continuous Variables

Pearson’s correlation coefficient measures linear association between two numerical variables, but it has two critical limitations:

  1. Normality assumption – conventional inference requires the data to be normally distributed, a condition often violated in practice.
  2. Linear focus only – it cannot capture non‑linear relationships. Two variables may be strongly dependent yet have near‑zero correlation.

The chi‑square test of independence overcomes both problems when applied to continuous data. It requires no distributional assumptions, detects any form of association (linear or non‑linear), and is robust to data quality issues (e.g., outliers, entry errors).

How it works: discretize then test

The core idea is to convert continuous variables into categorical bins (discretize), then apply the standard chi‑square test of independence on the resulting contingency table.

Example: Satisfaction vs. Average Monthly Hours (HR dataset)

  • Satisfaction level (continuous, 0–1) → discretised into 5 bins: [0,0.2), [0.2,0.4), [0.4,0.6), [0.6,0.8), [0.8,1].
  • Average monthly hours (continuous, 96–310) → discretised into 4 bins: ≤150, (150,200], (200,250], >250.

These choices are a judgment call – guided by descriptive statistics (range, mean, median).
Rules of thumb:

  • Not too few or too many bins.
  • Each cell of the table should have sufficient (≥5) observations; avoid highly disproportionate counts.

The discretised data produce a joint frequency table (rows = satisfaction bins, columns = hours bins):

Satisfaction \ Hours≤150150–200200–250>250Row total
[0.0 – 0.2)...............
[0.2 – 0.4)...............
[0.4 – 0.6)...............
[0.6 – 0.8)...............
[0.8 – 1.0]...............
Column total............N

Exam tip: The chi‑square test is performed exactly as for categorical data – compute expected frequencies under independence, calculate χ2=(OijEij)2Eij\chi^2 = \sum \frac{(O_{ij} - E_{ij})^2}{E_{ij}} and compare to the critical value with (r1)(c1)(r-1)(c-1) degrees of freedom.

Hypotheses

  • H0H_0: Satisfaction level is independent of levels of average monthly hours (i.e., the row and column categories are independent).
  • HaH_a: Satisfaction level is not independent of levels of average monthly hours (dependence exists).

Connection to Pearson correlation

In an ideal setting, the conclusions from the chi‑square test should align with the sign and strength of the Pearson correlation coefficient. For this dataset, the (linear) correlation between satisfaction and average monthly hours is mildly negative – employees who work more tend to be less satisfied. If the chi‑square test also rejects independence, it reinforces that conclusion. A discrepancy would suggest a non‑linear relationship that correlation missed.

AspectPearson correlationChi‑square test (discretised)
AssumptionsBivariate normalityNo distributional assumptions
Relationship detectedLinear onlyAny form (linear or non‑linear)
Sensitivity to outliersHighLow (after binning)
Outputrr (‑1 to +1)χ2\chi^2 + p‑value

Key takeaways

  • Discretise continuous variables into bins (judgment call based on range and sample size) and then apply the standard chi‑square test of independence.
  • The test works without normality, captures non‑linear associations, and is robust to data quality issues.
  • Interpret results in the context of the bins – dependence means that the distribution of one variable differs across categories of the other.
  • Compare findings with the Pearson correlation to check for consistency and to identify possible non‑linearity.

Why Goodness of Fit?

Many standard parametric methods — the t‑test, ANOVA, linear regression — assume the data follow a particular distribution (most often the normal). Other common assumptions include the exponential distribution for product lifetimes or the Poisson distribution for count data (e.g., number of defects). Because the validity of these methods hinges on the assumption being true, an objective way to check it is essential. The goodness of fit test provides that check: it determines whether a sample of observed data matches a specified theoretical distribution.

Core Idea: Observed vs. Expected Frequencies

The test compares the observed frequencies (how often each outcome actually occurred in the sample) with the expected frequencies derived from the hypothesised distribution. The key question: are the deviations between observed and expected large enough to conclude the data does not follow the assumed distribution, or can they be attributed to random chance?

This logic is the same as that of the χ² test of independence (covered earlier in the module). Both tests use a chi‑square statistic to evaluate the gap between observed and expected counts.

Assumed distribution (e.g., normal, Poisson)
       ↓
Compute expected frequencies for each category
       ↓
Collect observed frequencies from the sample
       ↓
Test: Are deviations (observed – expected) significantly large?
       ↓
If yes → reject assumption | If no → data consistent with the distribution

Exam tip: The goodness of fit test is a nonparametric method — it makes no assumption about the distribution of the test statistic itself, only about the data being tested.

Common Distributions Tested in Business Contexts

Variable typeExample distributionsTypical application
DiscreteBinomial, PoissonNumber of defects in a batch (Poisson); number of successes in trials (binomial)
ContinuousNormal, ExponentialCustomer purchase amounts (normal); product lifetime (exponential)

Selecting the correct distribution for a given business problem is a critical first step; the goodness of fit test then validates that choice.

Business Applications

The transcript details numerous real‑world uses. They all share the same pattern: an assumed distribution is embedded in a decision model, and the test confirms or rejects that assumption.

DomainSpecific useDistribution typically assumed
Marketing & consumer behaviourCheck if customers choose brands equally (uniform) or if preferences follow a normal distribution.Uniform, normal
Retail & salesValidate that product demand follows a seasonal or normal pattern; check if sales across store locations follow a similar distribution (identify outlier stores).Normal, seasonal patterns
Product demand forecastingAssess whether past sales conform to the distribution used for future forecasts.Varies (e.g., normal, exponential)
Quality controlTest if number of defects follows a Poisson distribution (stable process); verify that product weights/dimensions match the expected distribution.Poisson, normal
Risk managementCheck whether actual default rates match the binomial or normal model used for credit pricing.Binomial, normal
HR analyticsEvaluate if employee attrition matches historical turnover distribution to guide workforce planning.Historical distribution (any)
Supply chain & inventoryValidate demand patterns for inventory policy decisions.Various

Why It Matters

Goodness of fit tests act as a gatekeeper for downstream analytics. If the distributional assumption is wrong, any conclusions drawn from parametric methods (confidence intervals, hypothesis tests, forecasts) may be unreliable. By confirming or rejecting the assumption, the test ensures that business decisions are based on accurate and trustworthy models.

Key takeaways

  • Goodness of fit test checks whether observed data follows a specific theoretical distribution (normal, Poisson, exponential, etc.).
  • It compares observed frequencies to expected frequencies from the hypothesised distribution.
  • The test is nonparametric and conceptually similar to the χ² test of independence.
  • Widely used across marketing, retail, quality control, risk management, HR analytics, and supply chain to validate assumptions.
  • A significant result (large deviations) indicates the data does not match the assumed distribution; a non‑significant result means the data is consistent with it.
  • Always first identify the appropriate distribution for the business context, then use the test to verify.

General Principles of Goodness of Fit Test

A goodness of fit test checks whether a sample of data follows a specified probability distribution. Intuitively: does the observed data "look like" it came from the assumed distribution (uniform, normal, Poisson, etc.), or is the difference too large to be chance? The test quantifies the discrepancy between what we expect under the hypothesis and what we observe in the sample, using the chi‑square distribution.

Procedure: step‑by‑step

flowchart TD
  A[Define H₀ and H₁] --> B[Construct intervals / categories]
  B --> C[Compute observed frequencies O_i]
  C --> D[Compute expected frequencies E_i under H₀ using CDF]
  D --> E[Calculate chi-square statistic: χ² = Σ (Oᵢ – Eᵢ)² / Eᵢ]
  E --> F[Determine degrees of freedom df = k – 1 – m]
  F --> G[Find p‑value from χ² distribution with df]
  G --> H{Reject H₀?}
  H -->|p‑value small| I[Conclude data does NOT follow assumed distribution]
  H -->|p‑value large| J[Fail to reject H₀ – data consistent with distribution]

1. Formulate hypotheses

  • Null hypothesis (H0H_0): The data follow a specific distribution (e.g., uniform, normal, Poisson).
  • Alternative hypothesis (H1H_1): The data do not follow that distribution. (No claim about what other distribution holds.)

2. Build intervals (for continuous variables)

  • Divide the range into kk bins or categories.
  • Bins need not be equal in width, but expected frequencies should be balanced (neither too large nor too small). For uniform distributions, equal‑width bins are natural.
  • Example: For satisfaction level (range 0–1), use 10 bins of width 0.1.

3. Obtain observed frequencies (OiO_i)

Count how many sample observations fall into each bin.

4. Compute expected frequencies (EiE_i) under H0H_0

  • Use the cumulative distribution function (CDF) of the assumed distribution.
  • For any bin, Ei=N×P(observation in bin)E_i = N \times P(\text{observation in bin}), where NN is the total sample size.
  • For a uniform distribution: P(bin)=bin lengthtotal rangeP(\text{bin}) = \frac{\text{bin length}}{\text{total range}}.
  • For other distributions (normal, binomial, Poisson), you must first estimate the parameters from the data (e.g., μ,σ2\mu,\sigma^2 for normal, λ\lambda for Poisson). Then use the CDF (e.g., NORM.DIST in Excel).

5. Calculate the chi‑square test statistic

χ2=i=1k(OiEi)2Ei\chi^2 = \sum_{i=1}^{k} \frac{(O_i - E_i)^2}{E_i}

A larger value indicates greater deviation from H0H_0.

6. Degrees of freedom (df)

df=k1m\text{df} = k - 1 - m

  • kk = number of intervals
  • mm = number of parameters estimated from the data (e.g., 2 for normal, 0 for uniform, 1 for Poisson)

7. Decision

  • Compute the p‑value using the chi‑square distribution with the appropriate df (e.g., CHISQ.DIST.RT in Excel).
  • If p‑value < significance level (typically 0.05), reject H0H_0 – the data do not fit the distribution.

Exam tip: The goodness of fit test only detects departure from H0H_0; it does not tell you what the true distribution is. Also, each estimated parameter reduces df by 1 – forgetting this is a common error.


Worked example: Testing uniform distribution of employee satisfaction

Data: Satisfaction level (0–1) of N=14, ⁣999N = 14,\!999 employees.

Hypotheses:

  • H0H_0: Satisfaction is uniformly distributed over [0,1].
  • H1H_1: Satisfaction is not uniformly distributed.

Step 2 – intervals: 10 equal‑width bins: [0,0.1], [0.1,0.2], …, [0.9,1.0].

Step 3 – observed frequencies (OiO_i):

IntervalObserved (OiO_i)
[0, 0.1)553
[0.1, 0.2)
[0.9, 1.0]
Total14,999

(Only the first interval’s count is given in the lecture; the others sum to 14,999.)

Step 4 – expected frequencies: Under uniform distribution, each bin has probability 0.1, so

Ei=14, ⁣999×0.1=1, ⁣499.9for all i=1,,10.E_i = 14,\!999 \times 0.1 = 1,\!499.9 \quad \text{for all } i=1,\dots,10.

Step 5 – chi‑square statistic: The contribution for the first bin:

(5531, ⁣499.9)21, ⁣499.9597.79\frac{(553 - 1,\!499.9)^2}{1,\!499.9} \approx 597.79

Summing over all 10 bins gives:

χ2=2, ⁣710.25\chi^2 = 2,\!710.25

Step 6 – degrees of freedom: k=10k = 10, m=0m = 0 (uniform requires no estimated parameters), so

df=1010=9.\text{df} = 10 - 1 - 0 = 9.

Step 7 – p‑value: Using a chi‑square distribution with 9 df, the p‑value is effectively 0 (extremely small). Therefore, reject H0H_0 – satisfaction level is not uniformly distributed. The company should investigate factors (department, workload, etc.) driving this non‑uniform pattern.


Degrees of freedom – general rule (examples)

DistributionParameters estimated (mm)Example with k=8k=8 intervals
Uniform0df=810=7\text{df} = 8 - 1 - 0 = 7
Normal2 (μ,σ2\mu,\sigma^2)df=812=5\text{df} = 8 - 1 - 2 = 5
Poisson1 (λ\lambda)df=811=6\text{df} = 8 - 1 - 1 = 6
Binomial1 (pp)df=811=6\text{df} = 8 - 1 - 1 = 6

Exam tip: Always count how many parameters were estimated from the sample to compute the expected frequencies. This directly affects df and the critical value.


Key takeaways

  • Goodness of fit tests whether sample data come from a specified distribution.
  • Use the chi‑square statistic: χ2=(OiEi)2/Ei\chi^2 = \sum (O_i - E_i)^2 / E_i, comparing observed vs. expected counts.
  • For continuous distributions, bin the data and compute expected frequencies via the CDF.
  • Degrees of freedom: df=k1m\text{df} = k - 1 - m (intervals minus parameters estimated).
  • A very small p‑value rejects H0H_0; the data do not fit the assumed distribution.
  • The test is widely applicable – uniform, normal, Poisson, binomial – but requires careful interval construction and parameter estimation.

Goodness of Fit Test for Poisson Distribution

Intuition: The Poisson distribution models the count of rare, independent events over a fixed interval (e.g., customer arrivals, equipment failures). A goodness of fit test checks whether observed frequency counts (e.g., number of projects per employee) plausibly come from a Poisson process. If the data fit, the events appear random and independent at a constant average rate. If not, systematic factors (e.g., uneven workload) may be present.

Application context: In the HR dataset (14,999 employees), the only integer-valued variable suitable for Poisson modelling is number of projects (satisfaction level is continuous; years/hours are continuous even if reported as integers). A goodness of fit test here informs whether project distribution is random — or whether some employees are overburdened.

Step-by-step procedure

1. Hypotheses

H0:Number of projects follows a Poisson distributionH_0: \text{Number of projects follows a Poisson distribution} H1:Number of projects does NOT follow a Poisson distributionH_1: \text{Number of projects does NOT follow a Poisson distribution}

2. Observed frequencies

  • Raw counts show zero employees with 0 or 1 projects, and none with >7.
  • Cell merging (required to avoid zero expected frequencies): aggregate into six intervals.
  • Final observed frequencies (after merging):
Interval (projects)Observed frequency OiO_i
2\leq 22,388
33(computed in Excel)
44(computed in Excel)
55(computed in Excel)
66(computed in Excel)
7\geq 7(computed in Excel)
Total14,999

Exam tip: Always merge cells so that no expected count is < 1 and at most 20% of cells have expected counts < 5. For Poisson, low-probability tails (0,1,7+) are typical candidates for merging.

3. Expected frequencies under H0H_0

The Poisson probability mass function:

P(X=k)=eλλkk!,k=0,1,2,P(X = k) = \frac{e^{-\lambda} \lambda^k}{k!}, \quad k = 0,1,2,\dots
  • Estimate λ\lambda using the sample mean: λ^=xˉ=3.8\hat{\lambda} = \bar{x} = 3.8 (from 14,999 observations).
  • Compute probabilities for each merged interval using the Poisson distribution with λ=3.8\lambda = 3.8.
  • Multiply each probability by n=14,999n = 14,999 to get expected frequencies EiE_i.

Example – first cell (2\leq 2 projects):

P(X2)=POISSON.DIST(2,3.8,TRUE)0.27P(X \leq 2) = \text{POISSON.DIST}(2, 3.8, \text{TRUE}) \approx 0.27 E1=0.27×14,9994,025.79E_1 = 0.27 \times 14,999 \approx 4,025.79

In Excel use:

  • POISSON.DIST(x, mean, cumulative)
    • For exact probability: FALSE
    • For cumulative probability: TRUE
  • Last cell (7\geq 7): P(X7)=1POISSON.DIST(6,3.8,TRUE)P(X \geq 7) = 1 - \text{POISSON.DIST}(6, 3.8, \text{TRUE})

Resulting table (partial):

IntervalOiO_iEiE_i
2\leq 22,3884,025.79
33......
44......
55......
66......
7\geq 7......
Total14,99914,999.00

4. Chi-square test statistic

χ2=i=16(OiEi)2Ei\chi^2 = \sum_{i=1}^{6} \frac{(O_i - E_i)^2}{E_i}

For this dataset, the sum of all six contributions yields:

χ2=2780.09\chi^2 = 2780.09

5. Degrees of freedom and p-value

df=(number of cells)1(number of estimated parameters)=611=4\text{df} = (\text{number of cells}) - 1 - (\text{number of estimated parameters}) = 6 - 1 - 1 = 4

Using CHISQ.DIST.RT(2780.09, 4) in Excel gives a p-value ≈ 0 (extremely small).

6. Inference

Because the p-value is virtually zero, we reject H0H_0. There is overwhelming evidence that the number of projects does not follow a Poisson distribution. The company should investigate why some employees are overburdened while others have too few projects.

Brief extension: Testing normality

The same logic applies to continuous variables. For a goodness of fit test for normality:

  • H0H_0: Data follow a normal distribution.
  • Estimate both parameters: μ\mu and σ\sigma from the sample.
  • Create intervals (bins) over the continuous range.
  • Compute expected frequencies using NORM.DIST(x, mean, stdev, cumulative).
  • Calculate χ2\chi^2 and compare to χdf2\chi^2_{\text{df}} with df=(#bins)12\text{df} = (\#\text{bins}) - 1 - 2.

Example variables from the HR dataset to test: satisfaction level, last evaluation, average monthly hours.

Key takeaways

  • Goodness of fit tests whether observed frequencies match a specified theoretical distribution (Poisson, normal, etc.).
  • For Poisson: estimate λ\lambda from the sample mean; merge low-frequency cells to satisfy expected count conditions.
  • Degrees of freedom = (#cells) – 1 – (#estimated parameters).
  • A very large χ2\chi^2 (e.g., 2780 on 4 df) leads to rejection of the Poisson assumption.
  • The same framework extends to any distribution (normal, binomial, etc.) by using the appropriate probability function.
  • Real business use: validating randomness of events (arrivals, defects) or detecting systematic imbalances (workload, resource allocation).

Wilcoxon Signed Rank Test

The Wilcoxon signed rank test is a non‑parametric procedure that relies solely on the relative ordering (ranks) of observations rather than their raw values. Unlike a parametric t-test, it makes no assumption about the underlying distribution — making it ideal for small samples, skewed data, or when normality fails.

Core idea

  • One‑sample: Are the data systematically higher or lower than a specified median?
  • Two‑sample (paired): Is the median of the paired differences significantly different from zero?

The test ranks the absolute deviations (or differences) and then examines the signs of those deviations. If the positive deviations are consistently larger than the negative ones (or vice versa), the test infers a significant shift away from the hypothesised median.

When to use it

ScenarioParametric alternativeWhy Wilcoxon wins
Small sample size, normality unclearOne‑sample t-test / paired t-testNo normality required; robust to outliers
Data heavily skewed (e.g., financial returns, delivery times)SameRanks neutralise extreme values
Before‑after intervention (same subjects)Paired t-testWorks even if effect magnitude is irregular
Matched pairs (treatment vs control)Paired t-testHandles unknown distribution of differences

One‑sample signed rank test

Intuition: A company sets a target delivery time of 5 days. Observed times deviate above or below that target. The test checks whether the deviations are balanced around zero (i.e., typical delivery = target) or are systematically positive/negative (i.e., median delivery ≠ 5 days).

Procedure (conceptual – details follow in later lectures):

  1. Compute di=xihypothesised mediand_i = x_i - \text{hypothesised median} for each observation.
  2. Rank the absolute differences di|d_i| (ignore signs).
  3. Assign the original signs (+ or –) to the ranks.
  4. Sum the ranks of the positive differences (W+W^+) and negative differences (WW^-).
  5. Compare the smaller sum to a critical value.

Because ranks are used, a few extreme values do not dominate the result — the test focuses on the ordering of deviations.

Exam tip: The one‑sample signed rank test does not test the mean; it tests the median. This is a common source of confusion in exams.

Two‑sample (paired) signed rank test

When observations come in pairs — either from the same subject before/after, or from matched subjects (treatment vs control) — the test examines whether the median of the within‑pair differences is zero.

Example: A pharmaceutical company gives a drug to one group and a placebo to a matched control group. The paired difference (drug outcome – placebo outcome) is computed for each pair. If the drug has no effect, the differences should centre around zero. A signed rank test can detect if the median difference is significantly positive (drug better) or negative.

Business applications:

  • Marketing: Compare sales before and after a campaign.
  • Quality control: Product weight vs. a standard weight.
  • Finance: Stock returns before vs. after a market event, or returns of two portfolios over the same period.
  • Operations: Production efficiency before and after a process change.

Why it is attractive

  • No distributional assumptions — works when a goodness‑of‑fit test rejects normality.
  • Robust to outliers — ranks cap the influence of extreme values.
  • Handles small samples — where parametric tests lose power or cannot be validated.
  • Applicable to paired data — common in business experiments and A/B testing.
flowchart TD
    A[Sample data available] --> B{Normality plausible?}
    B -->|Yes, large sample| C[Use parametric t‑test]
    B -->|No / small / skewed| D[Use Wilcoxon signed rank test]
    D --> E{One sample?}
    E -->|Compare to benchmark median| F[One‑sample signed rank]
    E -->|Paired/matched observations| G[Two‑sample signed rank<br/>(paired differences)]

Key takeaways

  • Wilcoxon signed rank test is a non‑parametric alternative to the one‑sample and paired t-tests.
  • It tests the median (not mean) of differences from a hypothesised value or of paired differences.
  • Ranks are based on absolute deviations; signs determine the direction of deviation.
  • No normality assumption — safe for skewed data, small samples, and outlier‑prone data.
  • Common in business for before/after comparisons, quality control, and financial analysis.

Wilcoxon Signed Rank Test – II

The Wilcoxon signed rank test (also called the one-sample Wilcoxon rank sum test) is a non-parametric procedure for determining whether the median of a single sample differs significantly from a hypothesized value M0M_0. It is an alternative to the one-sample t-test when the normality assumption is violated or when the sample size is too small for parametric methods. Because the test works on ranks rather than raw values, it is robust to skewness and outliers.

Intuition: Instead of asking whether the mean differs from a target, we ask whether the typical observation (the median) is systematically higher or lower than a claimed value. By ranking the deviations and summing the ranks for positive deviations, we can detect a consistent directional shift.

When to use

  • Data are not normally distributed (e.g., skewed, heavy tails).
  • Sample size is very small (making normality check unreliable).
  • Interest lies in the population median, not the mean.
  • Presence of outliers would distort a t-test.

Test procedure

  1. Compute differences: For each observation xix_i, calculate di=xiM0d_i = x_i - M_0, where M0M_0 is the hypothesized median.

  2. Rank absolute differences: Rank di|d_i| from smallest to largest (ignore sign). If ties occur, assign the average rank to tied values.

  3. Assign signs: Attach the sign (+ or –) of did_i to each rank. Ranks of zero differences (di=0d_i = 0) are discarded.

  4. Sum positive signed ranks: W+=(ranks with positive di)W^+ = \sum \text{(ranks with positive } d_i\text{)} Similarly, define WW^- as the sum of negative signed ranks. Always: W++W=n(n+1)2W^+ + W^- = \frac{n(n+1)}{2} where nn is the number of non‑zero differences.

  5. Test statistic: For large samples (n30n \ge 30), use the z‑approximation: z=W+μW+σW+z = \frac{W^+ - \mu_{W^+}}{\sigma_{W^+}} with μW+=n(n+1)4,σW+=n(n+1)(2n+1)24\mu_{W^+} = \frac{n(n+1)}{4}, \quad \sigma_{W^+} = \sqrt{ \frac{n(n+1)(2n+1)}{24} } Under the null hypothesis (population median =M0= M_0), W+W^+ has this known mean and standard error.

    Exam tip: The approximation works because W+W^+ is the sum of nn independent (under H0H_0 equally likely +/–) signed ranks; by the Central Limit Theorem it becomes normal as nn grows.

    For small samples (n<30n < 30), exact critical values from the Wilcoxon signed rank distribution are used (not covered in this lecture).

  6. Decision rule: Compare z|z| to a critical value from the standard normal distribution.

    • At α=0.05\alpha = 0.05: reject H0H_0 if z>1.96|z| > 1.96.
    • At α=0.01\alpha = 0.01: reject H0H_0 if z>2.58|z| > 2.58. Alternatively, compute the p‑value: p-value=2×P(Z>z)\text{p-value} = 2 \times P(Z > |z|) using Excel NORM.DIST or similar.
flowchart TD
  A["Compute W⁺"] --> B["Calculate z = (W⁺ – μ) / σ"]
  B --> C["|z| > critical value?"]
  C -->|Yes| D["Reject H₀: median ≠ M₀"]
  C -->|No| E["Fail to reject H₀"]

Worked example: Average monthly hours

Data: HR analytics dataset with n=14,999n = 14,999 employees.
Hypothesis: H0:median=200H_0: \text{median} = 200 hours (a believed norm) vs. H1:median200H_1: \text{median} \neq 200.

Steps:

  1. Differences: For employee 1, x1=157x_1 = 157, so d1=157200=43d_1 = 157-200 = -43.
  2. Rank absolute differences: d1=43|d_1| = 43. Using RANK.AVG, ties produce average ranks (e.g., 7134.5).
  3. Signs: Negative differences get sign –1; positive get +1; exact 200 get 0 (discarded).
  4. Positive signed ranks: Extract ranks for all positive signs.
  5. W+W^+: Sum of positive signed ranks = 57,539,873.
  6. Z‑score: μW+=14999×150004=56,246,250\mu_{W^+} = \frac{14999 \times 15000}{4} = 56,246,250 σW+=14999×15000×29999241,180,625\sigma_{W^+} = \sqrt{ \frac{14999 \times 15000 \times 29999}{24} } \approx 1,180,625 z=57,539,87356,246,2501,180,6252.44z = \frac{57,539,873 - 56,246,250}{1,180,625} \approx 2.44

Decision:

  • At α=0.05\alpha = 0.05, critical value = 1.96 → 2.44>1.96|2.44| > 1.96, reject H0H_0. The median is significantly different from 200 hours.
  • At α=0.01\alpha = 0.01, critical value = 2.58 → 2.44<2.58|2.44| < 2.58, fail to reject H0H_0. The evidence is not strong enough at the 1% level.

Further exploration: Testing medians 199 and 201 yields:

  • 199: significant evidence of deviation.
  • 201: no evidence of deviation.

Thus the organization’s median lies between 200 and 201 hours.

Comparison with one‑sample t-test

The lecture suggests running a one‑sample t-test on the same data (testing mean = 200) and comparing results. Because the data likely violate normality, the t-test may give a different conclusion. Always accompany such tests with exploratory plots (e.g., histogram of monthly hours) to build a complete picture.

Exam tip: The Wilcoxon signed rank test is not a test of the mean; it is a test of the median. When the population is symmetric and normally distributed, the t-test is more powerful. When normality fails, the Wilcoxon test is more reliable.

Key takeaways

  • The Wilcoxon signed rank test assesses whether the population median differs from a hypothesized value.
  • It is a non‑parametric alternative to the one‑sample t-test, robust to non‑normality and outliers.
  • Procedure: compute differences, rank absolute differences, assign signs, sum positive ranks (W+W^+).
  • For n30n \ge 30, use the z‑approximation: z=(W+n(n+1)/4)/n(n+1)(2n+1)/24z = (W^+ - n(n+1)/4) / \sqrt{n(n+1)(2n+1)/24}.
  • Reject H0H_0 if z|z| exceeds the normal critical value (1.96 at 5%).
  • Always report exploratory analysis (histograms, boxplots) alongside the test.

Paired Wilcoxon Signed‑Rank Test

The paired Wilcoxon signed‑rank test is a non‑parametric alternative to the paired t‑test. It answers: Is the median difference between two related samples significantly different from zero?
Use it when data come in pairs (same subject before/after, matched pairs) and the normality assumption fails.

Intuition

We don’t care about the absolute values of the two groups; we care only about the direction and magnitude of the difference within each pair. By ranking the absolute differences and then restoring the sign, we test whether positive and negative differences are balanced – if they are, the median difference is zero.

Hypothesis

For a two‑tailed test (is there any difference?):

  • H0H_0: median difference between paired observations = 0
  • H1H_1: median difference 0\neq 0

For a one‑tailed test (e.g., did the campaign increase visits?), change H1H_1 to “median difference >0>0” or “<0<0”.

Procedure

  1. Compute differences for each pair: di=afteribeforeid_i = \text{after}_i - \text{before}_i.
  2. Ignore signs and rank the absolute values di|d_i|. Assign rank 1 to the smallest absolute difference; average ranks for ties.
  3. Restore signs to the ranks → signed ranks.
  4. Sum the positive ranks – denote this as W+W_+.
    • Under H0H_0, W+W_+ should be close to half of total rank sum.
  5. Decision rule depends on sample size:
Sample sizeMethodTest statisticCritical value source
n30n \geq 30Large‑sample normal approximationz=W+n(n+1)4n(n+1)(2n+1)24z = \dfrac{W_+ - \frac{n(n+1)}{4}}{\sqrt{\frac{n(n+1)(2n+1)}{24}}}Standard normal zα/2z_{\alpha/2}
n<30n < 30Small‑sample exact tableW+W_+Wilcoxon signed‑rank table (e.g., for n=10n=10, α=0.05\alpha=0.05, critical = 8)

Exam tip: The large‑sample formula uses the mean μ=n(n+1)/4\mu = n(n+1)/4 and variance σ2=n(n+1)(2n+1)/24\sigma^2 = n(n+1)(2n+1)/24. These come from the null distribution of signed ranks.

Worked Example (Marketing Campaign)

A company tracks website visits of 10 customers before and after a campaign.
Only the first four pairs are shown below (full data not given).

| Customer | Before | After | Difference dd | d|d| | Rank of d|d| | Signed rank | |----------|--------|-------|----------------|-------|----------------|-------------| | 1 | 50 | 55 | +5 | 5 | 4 | +4 | | 2 | 60 | 65 | +5 | 5 | 4 | +4 | | 3 | 45 | 48 | +3 | 3 | 2 | +2 | | 4 | 80 | 75 | –5 | 5 | 4 | –4 | | … | … | … | … | … | … | … |

Note: ties in absolute difference (e.g., three values of 5) receive average rank (4+5+6)/3=5(4+5+6)/3 = 5 in a full ranking; this partial table uses a simplified rank for illustration.

Complete the ranking for all 10 customers, then compute W+W_+ = sum of positive signed ranks.

Result (per lecturer): For n=10n=10 at α=0.05\alpha=0.05 (two‑tailed), the critical value from the Wilcoxon table is 8. The computed W+W_+ exceeds 8, so we reject H0H_0 – there is a statistically significant difference in website visits before vs. after the campaign.

Interpretation: The marketing campaign changed website traffic. To determine whether it increased visits, conduct a one‑tailed test (right‑tail: H1H_1: median difference >0>0).

When to Choose This Test

flowchart LR
A[Two related samples?] -->|Yes| B{Normality plausible?}
B -->|No| C[Paired t‑test]
B -->|Yes, but n is small <30| D[Paired Wilcoxon signed‑rank test]
B -->|Yes, n large| E[Paired t‑test acceptable]
C --> F[Safe]
D --> F

Key Takeaways

  • Paired Wilcoxon signed‑rank test compares median difference in matched/paired data.
  • Difference did_i is computed; absolute values are ranked; signs restored; positive ranks summed → W+W_+.
  • For n<30n<30, use exact Wilcoxon table; for n30n\geq30, use normal approximation zz.
  • No normality assumption required – robust for small or skewed samples.
  • The test tells you whether a difference exists; direction requires a one‑tailed version.
  • Do not confuse with Wilcoxon rank‑sum test (for independent samples).

Summary of Module 1: Non-Parametric Methods

Non-parametric methods provide robust alternatives to parametric tests when underlying assumptions (e.g., normality, homoscedasticity) are violated. This module covered three core techniques: chi-square test of independence, goodness-of-fit test, and Wilcoxon signed-rank test. Each is widely applied in business for categorical data, distribution checks, and paired comparisons.

1. Chi-Square Test of Independence

Determines whether two categorical variables are associated. Intuition: If the variables are independent, the observed frequency of each combination should be close to what we’d expect by chance.

Test statistic:

χ2=(OijEij)2Eij\chi^2 = \sum \frac{(O_{ij} - E_{ij})^2}{E_{ij}}

where OijO_{ij} = observed count in cell (i,j)(i,j), EijE_{ij} = expected count under independence =row total×column totalgrand total= \frac{\text{row total} \times \text{column total}}{\text{grand total}}.

Process:

  1. Build a contingency table of observed frequencies.
  2. Compute expected frequencies assuming no relationship.
  3. Calculate χ2\chi^2 and compare to a critical value (degrees of freedom = (r1)(c1)(r-1)(c-1)).

Example: A business wants to know if product type purchased is related to customer geographic region. A chi-square test on the contingency table of product × region can reveal regional preferences without any distributional assumptions.

Applications:

  • Customer demographics, product categories, payment methods, satisfaction ratings.
  • Can also be used as a non-parametric alternative to the correlation coefficient for continuous data (by discretizing into categories).

Key takeaways

  • Only requires categorical data; no normality assumption.
  • Tests independence between two variables.
  • Calculated from observed vs. expected frequencies in a contingency table.
  • Widely used in retail, marketing, healthcare, manufacturing.

2. Chi-Square Goodness-of-Fit Test

Assesses whether observed data follow a specific theoretical distribution (e.g., normal, Poisson). Intuition: Does the actual frequency distribution match the expected pattern?

Test statistic:

χ2=(OiEi)2Ei\chi^2 = \sum \frac{(O_i - E_i)^2}{E_i}

where OiO_i = observed count in category ii, EiE_i = expected count from the theoretical distribution.

Example:

  • Retail sales forecasting: A company assumes customer spending follows a normal distribution. The test compares observed sales bins against normal expectations. If significant deviation is found, the forecasting model must be adjusted (better inventory, less waste/stockout).
  • Quality control: Defects in manufacturing are expected to follow a Poisson distribution (constant average rate). The test verifies alignment; a significant result indicates a process shift.

Other applications:

  • Finance: Check if stock returns follow a normal distribution (common in risk modeling).
  • Marketing: Verify whether customer purchase patterns match expected distributions to fine-tune promotions.

Key takeaways

  • Tests whether data match a specific distribution (normal, Poisson, etc.).
  • Critical for validating assumptions behind forecasting, quality control, and risk models.
  • Significant deviation prompts model adjustment or process investigation.
  • Uses same χ2\chi^2 formula as test of independence, but with one-way categories.

3. Wilcoxon Signed-Rank Test

A non-parametric alternative to the paired t-test (or one-sample t-test) when normality is not satisfied. It operates on ranks of the differences, making it robust to outliers and skewed data.

When to use:

  • One sample vs. a hypothetical median.
  • Two related (paired) samples: before/after, matched pairs.

Idea: Rank the absolute differences, then sum the ranks for positive and negative differences. The test statistic compares the smaller sum against a critical value.

Example: A company launches a new product feature and measures customer satisfaction for the same group before and after. Even if the satisfaction ratings are not normally distributed, the Wilcoxon test can reliably tell if the median difference is significant.

Business scenarios:

  • Marketing campaign effectiveness – small sample, volatile sales figures.
  • Employee productivity after a training program.
  • Financial returns before/after an interest rate change – returns are often skewed with extreme outliers.

Advantages over paired t-test:

  • No normality assumption required.
  • Focuses on median difference rather than mean.
  • Less influenced by extreme values.

Key takeaways

  • Ranks differences between paired observations; does not require normality.
  • Ideal for small samples, skewed data, or outliers.
  • Use for one-sample or paired comparisons (before/after).
  • Commonly applied in HR, marketing, and finance.

Why Non-Parametric Methods Matter

When assumptions like normality or homoscedasticity fail, these three tools offer reliable, assumption-light alternatives:

MethodData TypeQuestion AnsweredParametric Alternative
Chi-square independenceCategorical (two variables)Are they related?– (no direct param.)
Chi-square goodness-of-fitCategorical (one variable vs. distribution)Does the data fit a distribution?
Wilcoxon signed-rankPaired continuous/ordinalIs the median different?Paired t-test

Key takeaway for business analytics: Non-parametric methods handle real-world data (non‑normal, categorical, small samples) without sacrificing rigor. They enable confident decision‑making when parametric assumptions are untenable.

Predictive Analysis

Concept of Forecasting - Introduction

Forecasting is the process of making predictions about future events based on historical data and various statistical techniques. In business analytics, forecasting enables organizations to be proactive rather than reactive: by identifying patterns in past data, companies can anticipate demand, costs, revenue, customer behavior, and other critical variables subject to fluctuation.

Forecasting supports decision-making and strategic planning across all horizons. Common methods include regression models, time series analysis, machine learning algorithms, and econometric models. This module focuses specifically on regression models and time series analysis for forecasting.

Short‑Term vs. Long‑Term Forecasting

  • Short‑term forecasting – e.g., predicting sales for the next week or month.
  • Long‑term forecasting – e.g., projecting growth over several years or a decade.

Exam tip: The same method rarely performs well for both horizons. Short‑term forecasts often emphasize recent patterns; long‑term forecasts use broader trends and structural factors.

Applications of Forecasting in Business

Application AreaPurposeExample
Demand forecastingPredict future product/service demand to align inventory with expected sales.A retail store uses prior‑year sales, current trends, and customer purchasing behavior to avoid stockouts and overstocking.
Financial forecastingPredict revenue, expenses, cash flow, and profit for budgeting and strategic planning.A tech startup forecasts cash inflows/outflows to determine when it will achieve profitability and when additional capital may be needed.
Sales forecastingEstimate future sales volumes to set revenue targets, allocate resources, and manage production.A car dealership predicts seasonal demand for specific models (e.g., higher sales in summer) to stock appropriate quantities.
Workforce forecastingAnticipate future staffing needs, especially for seasonal or growth‑driven fluctuations.A hotel chain uses past booking data to hire adequate staff for the high‑tourist season.
Risk management forecastingIdentify potential risks and take preventive measures.Banks use historical loan‑repayment data and credit scores to forecast the likelihood of loan defaults, improving lending decisions.
Fraud detection forecastingDetect abnormal transaction patterns that may indicate fraud.Credit‑card companies build models that flag transactions deviating from forecasted customer behavior.
Marketing / Customer churn forecastingPredict customer behavior (e.g., likelihood of churn or purchase) to tailor retention and promotional efforts.A streaming service (e.g., Hotstar) forecasts churn risk based on viewing habits and subscription tenure, then targets at‑risk customers with retention offers.

Why Forecasting Is Critical

  • Demand forecasting prevents both stockouts (lost sales, dissatisfied customers) and overstocking (tied‑up capital, storage costs).
  • Financial forecasting helps allocate resources, manage cash flow, and communicate growth potential to investors.
  • Sales forecasting guides production schedules, inventory levels, and sales force deployment.
  • Workforce forecasting ensures adequate staffing during peak periods without over‑hiring.
  • Risk forecasting minimizes losses (e.g., loan defaults) and maintains financial stability.
  • Fraud detection protects both the institution and its customers from unauthorized activity.
  • Customer behavior forecasting (e.g., churn, purchase likelihood) enables personalized marketing, improving conversion rates and customer experience.

Key takeaways

  • Forecasting = making data‑driven predictions about future events using historical data and statistical techniques.
  • Methods differ by horizon (short‑term vs. long‑term); one method rarely fits both.
  • Major applications include demand, financial, sales, workforce, risk, fraud, and marketing forecasting.
  • Accurate forecasts reduce uncertainty, optimize operations, and support proactive strategic planning.
  • This module will cover regression‑based and time‑series forecasting techniques in depth.

Predictive Analysis of Continuous Data

Linear regression is the most common approach for identifying relationships between variables and is widely used for forecasting continuous data. It models the relationship between one or more independent variables (predictors) and a continuous response variable (dependent variable) by fitting a linear equation to the data. Once the model is trained, new values of the independent variables can be plugged in to predict future outcomes.

Example: A company forecasts monthly sales using advertising spend, product prices, and seasonal factors. Historical data on these inputs and actual sales are used to train the regression model, then expected future inputs generate sales forecasts.

The effectiveness of linear regression for forecasting depends on how well the model generalises to unseen data—which is evaluated using cross-validation.


Cross-Validation for Evaluating Forecasting Models

Cross-validation assesses predictive performance by splitting data into multiple subsets. A typical approach:

  1. Partition the data into a training set and a testing set.
  2. Train the regression model on the training set (it never sees the testing set).
  3. Evaluate performance on the testing set (unseen data) to measure generalisation.

During training, the model learns relationships by minimising the least‑squared error; variable selection can be guided by (R^2). Performance on the testing set checks for overfitting—good training performance but poor testing indicates the model has captured noise rather than genuine patterns.

K‑Fold Cross-Validation

Instead of one fixed split, the data is divided into (k) equal subsets (folds). The model is trained (k) times, each time using (k-1) folds as training and the remaining fold as testing. Accuracy is averaged across all (k) iterations, yielding a more robust estimate—especially useful when data is limited.

flowchart TD
    A[Full dataset] --> B[Split into k folds]
    B --> C[For i = 1 to k]
    C --> D[Use fold i as test, rest as train]
    D --> E[Train model]
    E --> F[Evaluate on test fold i]
    F --> G[Combine all k evaluations]
    G --> H[Average performance metric]

Exam tip: K‑fold cross-validation ensures every observation is used for both training and testing, reducing the variance of the performance estimate. It is critical when selecting the best set of independent variables for forecasting.


Evaluating Predictive Accuracy for Continuous Data

Several metrics measure the difference between predicted ((\hat{y}_i)) and actual ((y_i)) values. Each provides different insight.

Common Metrics

MetricFormulaUnitInterpretation
R‑squared ((R^2))Proportion of variance explained by modelUnitless (0–1)Higher → more variance captured, but may overfit
Mean Absolute Error (MAE)(\displaystyle \frac{1}{n}\sum_{i=1}^{n}y_i - \hat{y}_i)
Mean Squared Error (MSE)(\displaystyle \frac{1}{n}\sum_{i=1}^{n} (y_i - \hat{y}_i)^2)Squared units of dependent variablePenalises large errors more heavily
Root Mean Squared Error (RMSE)(\displaystyle \sqrt{\frac{1}{n}\sum_{i=1}^{n} (y_i - \hat{y}_i)^2})Same as dependent variableInterpretable scale; sensitive to large errors
Mean Absolute Percentage Error (MAPE)(\displaystyle \frac{100%}{n}\sum_{i=1}^{n} \frac{y_i - \hat{y}_i}{y_i})

Detailed Notes on Each Metric

  • (R^2) (Coefficient of Determination): Represents the proportion of variance in the dependent variable explained by the model. Values range 0 to 1; 1 indicates perfect fit. High (R^2) can be misleading due to overfitting—it does not indicate absolute predictive accuracy and should be complemented by other metrics.

  • MAE: Average absolute error. For the house‑price dataset (price in lakhs of ₹), MAE is also in lakhs of ₹, giving a direct, intuitive measure of typical prediction error.

  • MSE: Squared error penalises outliers more than MAE. Because it is in squared units, it is harder to interpret directly. Useful when large errors are considered particularly harmful.

  • RMSE: The square root of MSE brings the unit back to the original scale (e.g., lakhs of ₹). It is the most interpretable error metric that still penalises large deviations.

  • MAPE: Expresses error as a percentage of actual value. For example, a 10% MAPE means predictions deviate on average by 10%. Especially valuable in finance and retail where relative accuracy drives decisions.

Exam tip: No single metric is sufficient. Use RMSE to detect large errors, MAE for average error, MAPE for relative error, and (R^2) for model comparison. Always evaluate on a held‑out test set via cross‑validation.

Key takeaways

  • Linear regression forecasts continuous outcomes by fitting a linear equation; the model must generalise to unseen data.
  • Cross‑validation (especially k‑fold) robustly evaluates generalisation by training/testing on multiple data splits.
  • Predictive accuracy is measured with (R^2), MAE, MSE, RMSE, and MAPE—each highlights different aspects of error.
  • Overfitting is detected when training performance is strong but test performance is weak.
  • Errors on the house‑price example: MAE and RMSE in lakhs of ₹, MAPE as a percentage of the actual price.

The Problem Setup

We apply linear regression to a continuous target—house prices (in lakhs of rupees). The dataset contains 4,340 apartments. For validation, the first 3,000 observations form the training set and the remaining 1,340 form the test set. The goal: use apartment features to predict the price of an unseen house.

Features considered:

  • RERA approval (binary)
  • Number of bedrooms
  • Area in sq. ft.
  • Ready to move (binary)
  • Resale (binary)
  • Posted by (categorical: builder, owner, dealer)

Because posted by is categorical, it is encoded using a baseline category. Builder is set as the baseline; two binary dummy variables are created:

  • posted_by_owner (1 = owner, 0 otherwise)
  • posted_by_dealer (1 = dealer, 0 otherwise)

The Regression Model

A linear regression is fitted on the training data:

\text{Price} = \beta_0 + \beta_1(\text{RERA}) + \beta_2(\text{bedrooms}) + \beta_3(\text{area}) + \beta_4(\text{ready_to_move}) + \beta_5(\text{resale}) + \beta_6(\text{posted\_owner}) + \beta_7(\text{posted\_dealer}) + \varepsilon

Estimated coefficients from the output:

FeatureCoefficientInterpretation
Intercept571Baseline average price (lakhs) when all features = 0
RERA approval21Add if approved (not statistically significant)
Number of bedrooms87Increase per extra bedroom
Area (sq. ft.)Positive and significant (value not given, but used)
Ready to moveSignificant (coefficient not stated)
ResaleSignificant
Posted by ownerSignificant (relative to builder)
Posted by dealerSignificant

Exam tip: The intercept (571) is the predicted price when all continuous variables are zero and all dummies are zero (builder baseline, no RERA, not ready, not resale). This is often not practically meaningful but mathematically necessary.

Making Predictions

For a new apartment, the predicted price is the sum of the intercept plus each applicable coefficient. Example procedure:

  1. Start with 571 (intercept)
  2. Add 21 if RERA-approved
  3. Add 87 × number of bedrooms
  4. Add coefficient × area (sq. ft.)
  5. Add coefficient if ready-to-move
  6. Add coefficient if resale
  7. Add coefficient if posted by owner or dealer
flowchart LR
  A[Intercept 571] --> B{Add feature terms}
  B --> C[+21 if RERA]
  B --> D[+87 × bedrooms]
  B --> E[+coef × area]
  B --> F[+coef if ready]
  B --> G[+coef if resale]
  B --> H[+coef if owner or dealer]
  C & D & E & F & G & H --> I[Predicted price]

Evaluating Forecast Accuracy

For each test observation, compute the error = actual − predicted. Four aggregated metrics:

MAE=1ni=1nyiy^iMSE=1ni=1n(yiy^i)2\text{MAE} = \frac{1}{n}\sum_{i=1}^{n}|y_i - \hat{y}_i| \qquad \text{MSE} = \frac{1}{n}\sum_{i=1}^{n}(y_i - \hat{y}_i)^2 RMSE=MSEMAPE=100%ni=1nyiy^iyi\text{RMSE} = \sqrt{\text{MSE}} \qquad \text{MAPE} = \frac{100\%}{n}\sum_{i=1}^{n}\frac{|y_i - \hat{y}_i|}{y_i}

Initial results on test set:

  • MAE > 100 lakhs
  • RMSE high
  • MAPE > 130%

These seem poor. However, a closer look reveals the problem.

The Outlier Problem

A plot of actual vs. predicted values shows the model’s predictions max out around 1,600 lakhs, while some actual prices reach 9,000 lakhs. These extreme values (likely data entry errors or genuine outliers) inflate the error metrics.

After removing the 3–4 most extreme outliers (actual > 9,000), the actual and predicted price ranges become comparable. A scatter of actual vs. predicted clusters around the y=xy=x line, indicating reasonable performance for most observations.

Exam tip: Outliers can completely distort MAE, RMSE, and especially MAPE (since percentage error is sensitive to small denominators). Always examine the distribution before trusting global error metrics.

Improving the Model

Logarithmic transformation on the target variable can reduce skew and mitigate outlier impact:

log(Price)=β0+β1(RERA)++ε\log(\text{Price}) = \beta_0 + \beta_1(\text{RERA}) + \dots + \varepsilon

After transformation, re-check for outliers and remove them only after careful analysis. This often yields a more normal-like distribution and better predictive performance.

Key takeaways

  • Linear regression is a valuable tool for forecasting continuous data, but its effectiveness must be validated with a train/test split.
  • Categorical features with >2 levels require dummy encoding with one baseline category.
  • Outliers disproportionately affect regression coefficients and error metrics; visualization (actual vs. predicted) is essential.
  • Removing outliers or applying log transformations can greatly improve model reliability.
  • Even with good overall fit, some predictions may still be biased—further feature engineering or alternative models may be needed.

Predictive Analysis of Categorical Data

Logistic regression is a method for modeling binary outcomes – events that take only two values (yes/no, success/failure, purchase/no purchase). Unlike linear regression (which works for continuous response), logistic regression outputs a probability that an event occurs, bounded between 0 and 1. It does this by passing a linear combination of predictors through the logistic function:

p=11+e(β0+β1x1++βkxk)p = \frac{1}{1 + e^{-(\beta_0 + \beta_1 x_1 + \dots + \beta_k x_k)}}

Why it matters: businesses can use the predicted probability to classify customers as “likely to purchase” or not, then target marketing efforts accordingly.

Confusion Matrix

The confusion matrix is a 2×2 table that compares predicted classes (based on a probability threshold, typically 0.5) against actual classes.

Predicted Positive (1)Predicted Negative (0)
Actual Positive (1)True Positive (TP)False Negative (FN)
Actual Negative (0)False Positive (FP)True Negative (TN)
  • TP: correctly predicted positive cases.
  • TN: correctly predicted negative cases.
  • FP: predicted positive but actually negative (Type I error).
  • FN: predicted negative but actually positive (Type II error).

Key Metrics Derived from the Confusion Matrix

Accuracy

The fraction of all correct predictions:

Accuracy=TP+TNTP+FP+TN+FN\text{Accuracy} = \frac{TP + TN}{TP + FP + TN + FN}

Exam tip: Accuracy can be misleading when classes are imbalanced (e.g., 95% negative, 5% positive). A model that always predicts “negative” would achieve 95% accuracy but is useless for identifying positives.

Precision (Positive Predictive Value)

Out of all cases predicted as positive, how many were actually positive?

Precision=TPTP+FP\text{Precision} = \frac{TP}{TP + FP}

A high precision means few false positives.

Recall (Sensitivity, True Positive Rate)

Out of all actual positive cases, how many were correctly predicted?

Recall=TPTP+FN\text{Recall} = \frac{TP}{TP + FN}

A high recall means few false negatives.

F1 Score

The harmonic mean of precision and recall, balancing both:

F1=2PrecisionRecallPrecision+RecallF1 = 2 \cdot \frac{\text{Precision} \cdot \text{Recall}}{\text{Precision} + \text{Recall}}

  • Always between 0 and 1; >0.5 is better than random.
  • High only when both precision and recall are high.

Metrics trade-off: increasing precision often reduces recall and vice versa. The choice depends on business cost – e.g., in medical screening, missing a disease (low recall) may be worse than a false alarm (low precision).

AUC‑ROC Curve

The ROC curve plots Recall (TPR) against False Positive Rate (FPR) for all possible classification thresholds (from 0% to 100%).

  • Threshold: the cutoff probability above which we predict “positive” (e.g., 0.5, 0.7). Changing threshold shifts TP/FP counts.
  • Area Under the Curve (AUC) summarizes overall performance: AUC = 1 means perfect discrimination; AUC = 0.5 means random. AUC closer to 1 indicates better ability to separate the two classes.
  • Particularly useful when the cost of misclassification varies (e.g., credit scoring, churn prediction).

Probabilistic Accuracy: Quadratic Score

Metrics above only evaluate classification correctness (which side of a threshold the predicted probability falls), not how well the probability itself matches reality.

Quadratic score (also called Brier score) measures the accuracy of the predicted probabilities:

QS=1ni=1n(yip^i)2\text{QS} = \frac{1}{n} \sum_{i=1}^{n} (y_i - \hat{p}_i)^2

  • yiy_i = actual outcome (1 or 0)
  • p^i\hat{p}_i = predicted probability of class 1

Lower values mean better probabilistic predictions (like MSE for continuous data). A model predicting 93% for a positive case is penalised less than one predicting 52%, even if both classify correctly.

Key Takeaways

  • Logistic regression models binary outcomes via the logistic function, producing probabilities between 0 and 1.
  • The confusion matrix is the foundation for computing accuracy, precision, recall, and F1 score.
  • Precision answers “how reliable are positive predictions?”; recall answers “how many positives are caught?”; F1 balances both.
  • AUC‑ROC evaluates discrimination ability across all thresholds – high AUC → good class separation.
  • Quadratic score evaluates the accuracy of the probability estimates themselves, not just the binary classification.
  • Selecting the right evaluation metric depends on business goals and the costs of false positives vs. false negatives.

Logistic Regression for Binary Classification (EdTech Company Case)

Logistic regression extends the linear model to predict a binary outcome — e.g., whether a customer converts (1) or not (0). Instead of modeling the outcome directly, it models the log-odds (logit) of the probability of conversion:

logit(p)=ln(p1p)=β0+β1x1++βkxk\text{logit}(p) = \ln\left(\frac{p}{1-p}\right) = \beta_0 + \beta_1 x_1 + \dots + \beta_k x_k

The probability is recovered via the inverse logit (sigmoid) function:

p=elogit(p)1+elogit(p)p = \frac{e^{\text{logit}(p)}}{1 + e^{\text{logit}(p)}}

This keeps predictions in the (0,1) range, making them interpretable as probabilities.

Data and Variables

The EdTech company collected data on 9,240 potential customers. The target is Converted (1 = took a course, 0 = did not). The predictors used in the model:

VariableTypeDescription
Open to EmailBinary (0/1)Agreed to receive emails
Open to CallBinary (0/1)Agreed to receive calls
Total VisitsContinuousNumber of visits to the website
Total Time SpentContinuousMinutes spent on the site
Page Views per VisitContinuousAverage pages viewed per visit
IndianBinary (0/1)Customer from India
UnemployedBinary (0/1)Currently unemployed
StudentBinary (0/1)Currently a student
Better Career ProspectsBinary (0/1)Selected “better career” as primary reason

Training set: first 9,000 observations; test set: remaining ~240 observations.

Estimated Coefficients

The logistic regression coefficients (log-odds effects) are:

PredictorCoefficientInterpretation (on log-odds)
Intercept0.954Baseline log-odds when all predictors = 0
Open to Email1.178Positive: increased chance of conversion
Open to Call–3.981Negative: decreased chance of conversion
Total Visits0.025Small positive effect per additional visit
Total Time Spent(not given)Positive (direction stated)
Page Views per Visit–0.060Negative: more views → lower conversion (possible distraction)
Indian(large negative)Negative coefficient
Unemployed(negative)Negative (unexpected; possibly inability to pay)
Student~0 (near zero)Negligible effect
Better Career Prospects(large positive)Strong positive effect

Exam tip: A negative coefficient does not always mean the variable is “bad” — it means the log-odds of conversion decrease. Domain knowledge is needed to explain counterintuitive signs (e.g., unemployed → negative may reflect price sensitivity).

Worked Example: Predicting Probability for a New Customer

Given a customer with the following data:

  • Open to Email = 1
  • Open to Call = 1
  • Total Visits = 2
  • Total Time Spent = 60 minutes
  • Page Views per Visit = ? (coefficient –0.060 used)
  • Indian = 1
  • Unemployed = 1
  • Student = 0
  • Better Career Prospects = 1

The logit is computed by summing the intercept and each coefficient multiplied by the variable value. Using the coefficients provided (and noting that the time‑spent coefficient was used but its value not disclosed), the cumulative logit is –1.458.

Convert to probability:

p=e1.4581+e1.458=0.19p = \frac{e^{-1.458}}{1 + e^{-1.458}} = 0.19

The model predicts only a 19% chance of conversion for this customer.

Model Evaluation on the Test Set

The predicted probabilities are thresholded at 50% to classify. The resulting confusion matrix:

Predicted Converted (1)Predicted Not Converted (0)
Actual Converted (1)TP = 51FN = 45
Actual Not Converted (0)FP = ?TN = 118

Key metrics (as computed from the test set):

MetricFormulaValue
AccuracyTP+TNTP+FP+FN+TN\frac{TP + TN}{TP + FP + FN + TN}69.29%
PrecisionTPTP+FP\frac{TP}{TP + FP}0.638
Recall (Sensitivity)TPTP+FN\frac{TP}{TP + FN}0.531
F1 Score2×Precision×RecallPrecision+Recall2 \times \frac{\text{Precision} \times \text{Recall}}{\text{Precision} + \text{Recall}}0.580
Quadratic (Brier) Score1n(p^iyi)2\frac{1}{n}\sum (\hat{p}_i - y_i)^20.213

The model has decent precision but low recall — it misses many actual converters. The Brier score (0.213, where 0 is perfect and 1 is worst) suggests predictions are reasonably confident when correct.

Feature Engineering

  • Create new features: e.g., interaction terms (Indian × Unemployed × Student), lead origin / source dummies.
  • Transform skewed continuous variables: apply log(x+1)\log(x+1) or x\sqrt{x} to variables like Total Time Spent (likely right‑skewed).
  • Domain‑specific features: incorporate business knowledge (e.g., previous engagement, discount eligibility).

Robust Cross-Validation

  • The current split uses one‑fold (9,000 train / 240 test). Switch to 10‑fold cross‑validation to get more reliable performance estimates and reduce variance due to a single split.

Exam tip: When improving a logistic regression model, always start with feature engineering and transformation before tuning thresholds or trying more complex models. Cross‑validation helps confirm improvements are not coincidental.

Key takeaways

  • Logistic regression models log-odds of a binary outcome; coefficients are additive on the log‑odds scale.
  • The sigmoid transformation converts log-odds to probabilities between 0 and 1.
  • Model evaluation uses confusion‑matrix derived metrics: accuracy, precision, recall, F1, and the Brier (quadratic) score.
  • Counterintuitive coefficient signs (e.g., negative for unemployed) can arise — investigate with domain knowledge.
  • Improvement strategies: feature engineering (interactions, transformations) and robust cross‑validation (e.g., 10‑fold).

Time Series Data

Time series data is data collected at successive points in time (daily, monthly, yearly) where the chronological order carries essential information. Unlike cross‑sectional data, the sequence itself is critical for understanding how values evolve.

Why specialized methods?

Conventional regression (e.g., OLS) treats observations as independent and ignores order, so it cannot detect patterns linked to time:

  • Trend – a steady increase or decrease over time.
  • Seasonality – regular cycles (e.g., higher sales in holiday seasons).

Time‑series methods capture these patterns, yielding better forecasts and informed decisions (e.g., stocking inventory before a seasonal peak).

Worked example: mean vs. trend

Given 7 observations:

Observation12345678 (??)
Set A2.62.12.42.02.52.22.3?
Set B1.51.82.12.42.73.03.3?
  • Set A: No clear pattern → the mean (~2.3) is a reasonable prediction.
  • Set B: Clear upward trend – mean also ≈2.3, but a value around 3.0–3.3 is far more plausible. Using the mean here would be a poor forecast.

Exam tip: Always plot your time series first. A mean forecast works only when no trend or seasonality exists.

Three real‑world cases (from Forecasting: Principles and Practice)

CaseProblemFlawed methodLesson
Disposable tableware manufacturerNeed monthly forecasts for hundreds of items with trend & seasonalityAverage of last 6 or 12 months; linear regression on recent data only; linear trend from last year to this yearUsing only recent data misses long‑term patterns – models must capture trend & seasonality
Australian pharmaceutical benefit schemeUnderestimated expenditure by ~$1 billion/yearIgnored sudden jumps due to policy changes and cheaper competitor drugsExogenous regressors (external info) are essential; not all patterns are in the historical series alone
Car fleet companyForecast vehicle resale values; specialists resisted statistical modelsRelied solely on expert judgmentCombine data, exogenous variables, and expert judgment for robust forecasts

Core patterns in time series

graph LR
  A[Time Series] --> B[Trend]
  A --> C[Seasonality]
  A --> D[Irregular / Noise]
  B --> E[Upward / Downward / Flat]
  C --> F[Weekly, Monthly, Yearly cycles]

Key takeaways

  • Time series data is ordered chronologically – the order matters.
  • Special methods are needed because conventional regression ignores time‑dependent patterns (trend, seasonality).
  • A simple average (mean) fails when a trend is present.
  • Good forecasting captures trend, seasonality, recent patterns, and exogenous regressors.
  • Expert judgment can complement, but not replace, statistical models.

The French Bakery Sales Dataset

The dataset contains 600 days of sales (quantity sold) from a French bakery, spanning 2 Jan 2021 to 30 Sep 2022. Columns:

  • Date (daily)
  • Quantity (discrete count of products sold – note: the lecture distinguishes discrete quantity from continuous sales revenue)
  • Day of week (for seasonality analysis)

Time‑series cross‑validation requires temporal order. When evaluating forecasting models, use the earlier part as the training set and the most recent part as the test set (never random splits). Here: train on all data up to 31 Aug 2022, test on September 2022 (last month).

Core Concepts: Trend and Seasonality

ComponentWhat it isReal‑world exampleWhy it matters
TrendLong‑term overall direction (upward, downward, flat, or piecewise changing)A growing company’s annual revenue → upward trend; a product becoming obsolete → eventual declineStrategic decisions: forecast growth, identify decline periods
SeasonalityRegular, predictable pattern repeating at fixed intervals (days, weeks, months, quarters)Bakery sales peak on weekends, drop on weekdaysAnticipate short‑term fluctuations; prepare resources

Trend can also be sinusoidal (e.g., winter wear – rises Sep–Jan, falls after, repeats yearly). Both components together let businesses separate a temporary seasonal dip from a long‑term declining trend.

Detecting Trend

1. Visual Inspection

Plot the time series as a line chart. For the bakery data:

  • Early 2021: slight increase → then decline → again increase in 2022.
  • Values fluctuate regularly (hint of weekly seasonality).

2. Moving Average

Smooths short‑term fluctuations to reveal the underlying trend.

Moving Averaget=1ki=tk+1tyi\text{Moving Average}_t = \frac{1}{k} \sum_{i=t-k+1}^{t} y_i

  • Period kk = window size. In Excel: add trendline → moving average → set period.
  • k=7k=7 (weekly): reveals short‑term trend.
  • k=30k=30 (monthly): shows month‑to‑month direction.

3. Linear Trend Line

Fits a straight line through all data points – assumes constant increase/decrease. The bakery data shows a very slight upward linear trend from start to end. Displays equation on chart.

4. Piecewise Linear Trend (mentioned but not detailed)

Better for non‑constant trends: fit separate straight lines to different time segments. Will be used later when specifying trend functions.

Detecting Seasonality

Step 1 – Compute averages per seasonal period

For weekly seasonality: group data by day of week and compute average quantity sold.

DayAverage Quantity
Monday to Friday700–850
Saturday>1000
Sunday>1000

Weekends clearly above weekdays – strong weekly seasonal pattern.

Step 2 – Calculate Seasonal Index

Seasonal Index for day d=Actual value on that dayAverage for that day of week\text{Seasonal Index for day } d = \frac{\text{Actual value on that day}}{\text{Average for that day of week}} Example: a Monday with sales 900 → index =900/843.491.067= 900 / 843.49 \approx 1.067 (above average).

Step 3 – Deseasonalize the Data

Remove seasonality to isolate trend: Deseasonalized value=Actual valueSeasonal Index\text{Deseasonalized value} = \frac{\text{Actual value}}{\text{Seasonal Index}} After deseasonalization, only trend and residual noise remain, enabling clearer trend analysis and better forecasting.

Exam tip: When performing time‑series cross‑validation, always use a time‑ordered train‑test split (e.g., first 80% as train, last 20% as test). Random splitting would leak future information into the training set.

Key takeaways

  • Trend captures long‑term direction; seasonality captures fixed‑interval cycles.
  • Detect trend via visual inspection, moving average, or linear/piecewise trend lines.
  • Detect seasonality by averaging values per period (e.g., day‑of‑week) and computing seasonal indices.
  • Deseasonalization separates the two components for more accurate forecasting.
  • These concepts underpin advanced models (autoregressive, etc.) discussed later in the module.

Simple Forecasting Methods

Time series forecasting starts with methods that are intuitive and easy to apply. These simple methods (naive, seasonal naive, average, weighted average, drift) are often the first step before moving to more sophisticated techniques. Each captures a different assumption about how the past relates to the future.

Naive Method

The naive method assumes the most recent observation is the best forecast for all future periods. Formally, for a time series y1,y2,,yty_1, y_2, \dots, y_t:

y^t+h=ytfor all h1\hat{y}_{t+h} = y_t \quad \text{for all } h \ge 1

Intuition: If nothing is changing rapidly, the last value is a reasonable guess. Works well when data is stable or unpredictable (e.g., daily stock prices with no trend).

Worked example – Retail store daily sales (units):

DayMonTueWedThuFriSatSun
Sales100120115110130120125

Forecast for next Monday (and all future days): 125 units (Sunday’s value). Graphically, a horizontal line at the last observation.

Limitations:

  • Fails when data has strong trends or seasonality.
  • Sensitive to random fluctuations – one outlier can distort all forecasts.

Seasonal Naive Method

The seasonal naive method extends the naive idea by repeating the observation from the same period in the previous season. For a season length mm:

y^t+h=yt+hm\hat{y}_{t+h} = y_{t + h - m}

Intuition: If a pattern repeats every week (or month, hour, etc.), the future should look like the most recent complete season.

Worked example – Same store, now with two weeks of data:

WeekMonTueWedThuFriSatSun
Week 1100120115110130120125
Week 2210240230220260300340

Forecast for Week 3: copy Week 2 values → Monday = 210, Tuesday = 240, …, Sunday = 340. Graphically, the second week’s pattern repeats indefinitely.

Limitations:

  • Assumes seasonal pattern is constant (no trend, no change in shape).
  • Ignores any overall upward or downward movement across seasons.

Exam tip: Use seasonal naive when you see clear repeating cycles (weekly, monthly) and no trend. For stock market daily data (no strong seasonality), naive often beats seasonal naive.

Average Method

The average method uses the mean of all past observations as the forecast:

y^t+1=1ti=1tyi\hat{y}_{t+1} = \frac{1}{t}\sum_{i=1}^{t} y_i

Intuition: When data is stable with no trend or season, the historical average is a reasonable guess.

Worked example – Coffee consumption (cups/day) over one week:

DayMonTueWedThuFriSatSun
Cups4325311

Forecast for next Monday:

y^=4+3+2+5+3+1+17=1972.71 cups\hat{y} = \frac{4+3+2+5+3+1+1}{7} = \frac{19}{7} \approx 2.71 \text{ cups}

Compare: naive would give 1 cup (Sunday’s value), seasonal naive would give 4 cups (last Monday’s value). The average balances extremes.

Weighted Average Method

The weighted average method generalises the average by assigning different weights to observations, typically giving more to recent ones:

y^t+1=i=1twiyii=1twi\hat{y}_{t+1} = \frac{\sum_{i=1}^{t} w_i y_i}{\sum_{i=1}^{t} w_i}

Weights are chosen by the analyst (e.g., linear increasing, exponential decay).

Intuition: Recent data may be more relevant, especially if trends or patterns shift. Weighted average lets you emphasise the end of the series.

Worked example – Coffee data with weights 1 (Monday) to 7 (Sunday):

DayWeightSalesWeight × Sales
Mon144
Tue236
Wed326
Thu4520
Fri5315
Sat616
Sun717

Sum weights = 1+2+3+4+5+6+7 = 28. Sum weighted sales = 4+6+6+20+15+6+7 = 64.

y^=64282.29 cups\hat{y} = \frac{64}{28} \approx 2.29 \text{ cups}

Because recent days (Sat, Sun) had low values, the forecast is lower than the simple average (2.71). Weighted average is useful when recent trends dominate (e.g., sales during a promotion).

Drift Method

The drift method assumes a constant average change between consecutive observations. The forecast is the last observation plus the average per‑period change:

y^t+h=yt+hyty1t1\hat{y}_{t+h} = y_t + h \cdot \frac{y_t - y_1}{t-1}

Intuition: When data shows a clear upward or downward trend (sales growth, population increase), drift captures that directional movement.

Worked example – Product sales over 7 days:

DayMonTueWedThuFriSatSun
Sales10121517202225

First observation y1=10y_1=10, last yt=25y_t=25, t=7t=7 days of data → t1=6t-1=6 time steps.

Average change: 25106=2.5\frac{25-10}{6} = 2.5 units per day.

Forecast for next Monday (h=1h=1): 25+1×2.5=27.525 + 1 \times 2.5 = 27.5 units. Forecast for Tuesday: 25+2×2.5=3025 + 2 \times 2.5 = 30 units.

The forecast line continues the slope observed from the entire history.

Limitations:

  • Assumes linear trend extends forever – unrealistic for long horizons.
  • Sensitive to the first and last observations; outliers can distort the slope.

Choosing Among Simple Methods

MethodBest when…Ignores
NaiveData is stable or random, no trend/seasonalityTrends, seasonality
Seasonal naiveStrong, repeating seasonal pattern (e.g., weekly, monthly)Long-term trends
AverageData is stationary with no trend/seasonRecent changes, trends
Weighted averageRecent observations are more important than older onesSeasonality (unless weighted accordingly)
DriftClear upward or downward linear trendSeasonality, irregular fluctuations
flowchart TD
    A[Start: inspect time series] --> B{Strong seasonality?}
    B -- Yes --> C[Use seasonal naïve]
    B -- No --> D{Clear trend?}
    D -- Yes --> E[Use drift method]
    D -- No --> F{Recent changes important?}
    F -- Yes --> G[Use weighted average]
    F -- No --> H{Data stable?}
    H -- Yes --> I[Use average or naïve]
    H -- No --> J[Try naïve as baseline]

Exam tip: Simple methods are often used as benchmarks. Any advanced model should outperform the naive or seasonal naive forecasts. Many exam questions ask you to compute forecasts by hand using these methods – practice with small datasets.

Key Takeaways

  • Naive: forecast = last observed value. Works for flat, noisy series.
  • Seasonal naive: forecast = value from same period in previous season. Works for repeating patterns.
  • Average: forecast = historical mean. Works for stationary data.
  • Weighted average: forecast = weighted mean with higher weights on recent data. Captures recent shifts.
  • Drift: forecast = last value + linear trend from first to last point. Works for trending data.
  • All five are intuitive, easy to implement, and provide a foundation for advanced methods like exponential smoothing.

Exponential Smoothing Method

Exponential smoothing is a forecasting technique that computes a weighted average of past observations, assigning exponentially decreasing weights so that more recent data influences the forecast more heavily. It smooths out random fluctuations to reveal the underlying trend while still incorporating all historical data.

Intuition

Instead of equal weights (simple average) or arbitrary weights (weighted average), exponential smoothing uses a single parameter – the smoothing factor α\alpha – to control how quickly the forecast adapts to new information.

  • α\alpha close to 1 → forecast reacts strongly to the most recent observation (rapid adaptation).
  • α\alpha close to 0 → forecast is influenced almost equally by all past data (heavy smoothing).

The method gets its name because the weights applied to past observations decay at an exponential rate.

The Core Formula

Let yty_t be the actual observation at time tt, and FtF_t be the forecast for time tt (made at t1t-1). The forecast for the next period t+1t+1 is:

Ft+1=αyt+(1α)FtF_{t+1} = \alpha \, y_t + (1 - \alpha) \, F_t

Where:

  • 0α10 \leq \alpha \leq 1 – smoothing factor.
  • The initial forecast F1F_1 is usually set to the first observation y1y_1 (equivalent to the naive method for the first step).

Why “Exponential”? — Expanding the Formula

Repeatedly substituting Ft,Ft1,F_t, F_{t-1}, \dots reveals the weight structure:

Ft+1=αyt+(1α)Ft=αyt+α(1α)yt1+(1α)2Ft1=αyt+α(1α)yt1+α(1α)2yt2++(1α)tF1\begin{aligned} F_{t+1} &= \alpha y_t + (1-\alpha)F_t \\ &= \alpha y_t + \alpha(1-\alpha) y_{t-1} + (1-\alpha)^2 F_{t-1} \\ &= \alpha y_t + \alpha(1-\alpha) y_{t-1} + \alpha(1-\alpha)^2 y_{t-2} + \cdots + (1-\alpha)^t F_1 \end{aligned}

The weight on observation ytky_{t-k} is:

α(1α)k\alpha (1-\alpha)^k

Because (1α)<1(1-\alpha) < 1, the weight decreases geometrically (exponentially) as kk increases — older data matters less and less.

Worked Example: Ice Cream Shop Daily Sales

DayActual Sales yty_tForecast FtF_t (made previous day)Calculation for next forecast
Mon100Set FTue=100F_{\text{Tue}} = 100 (initial naive)
Tue120100FWed=0.5×120+0.5×100=110F_{\text{Wed}} = 0.5 \times 120 + 0.5 \times 100 = 110
Wed115110FThu=0.5×115+0.5×110=112.5F_{\text{Thu}} = 0.5 \times 115 + 0.5 \times 110 = 112.5
Thu130112.5FFri=0.5×130+0.5×112.5=121.25F_{\text{Fri}} = 0.5 \times 130 + 0.5 \times 112.5 = 121.25
Fri(unknown)121.25FSat=0.5×(Fri actual)+0.5×121.25F_{\text{Sat}} = 0.5 \times \text{(Fri actual)} + 0.5 \times 121.25
Sat
Sun125(computed)FMon0.5×125+0.5×(Sun forecast)127F_{\text{Mon}} \approx 0.5 \times 125 + 0.5 \times \text{(Sun forecast)} \approx 127

Result: Forecast for next Monday ≈ 127 units (with α=0.5\alpha = 0.5).

The Damping Factor

In many software implementations (e.g., Excel), the parameter requested is the damping factor 1α1 - \alpha rather than α\alpha itself.

Exam tip: Always check which parameter a tool asks for. If it asks for “damping factor”, enter 1α1-\alpha. A damping factor of 0.8 means α=0.2\alpha = 0.2 (very heavy smoothing).

Why Use Exponential Smoothing?

ReasonExplanation
AdaptabilityHigher α\alpha makes the forecast respond quickly to changes (e.g., a hot day spikes sales).
SimplicityOnly requires α\alpha and the last actual + forecast; can be calculated by hand or in a spreadsheet.
SmoothnessWeights down extreme fluctuations, giving a clear view of the underlying trend and seasonality.

Implementation in Excel

  1. Open Data Analysis Toolpak → select Exponential Smoothing.
  2. Input range: column of actual sales.
  3. Damping factor: enter 1α1-\alpha (e.g., 0.2 for α=0.8\alpha=0.8).
  4. Set output range → click OK.

The resulting smoothed series tracks the data while reducing noise. A higher damping factor (lower α\alpha) produces a smoother line.

Visualising the Forecast Process

flowchart TD
    A[Start: F₁ = y₁] --> B[Read new actual yₜ]
    B --> C[Compute Fₜ₊₁ = α·yₜ + (1−α)·Fₜ]
    C --> D[Update Fₜ = Fₜ₊₁]
    D --> B

Key takeaways

  • Exponential smoothing is a weighted average with weights decaying exponentially (α(1α)k\alpha(1-\alpha)^k).
  • Smoothing factor α\alpha (0 ≤ α ≤ 1) controls responsiveness: high α → fast adaptation, low α → heavy smoothing.
  • The damping factor = 1α1-\alpha; Excel uses damping factor, not α.
  • Initial forecast is usually the first observation (naive).
  • Three strengths: adaptability, simplicity, smoothness.
  • The method produces forecasts that react quickly to recent changes while still using all past data.

Autocorrelation and Autoregressive Models

Autocorrelation (also called lagged correlation or serial correlation) measures how a time series is correlated with its own past values. Intuitively: does today’s number carry information about tomorrow’s? In most business data – stock prices, daily sales, temperature – the past does influence the future. Autocorrelation quantifies that influence.

Mathematical definition

For a time series y1,y2,,yny_1, y_2, \dots, y_n, the autocorrelation at lag kk is the Pearson correlation between the series and itself shifted by kk time steps:

ρk=t=k+1n(ytyˉ)(ytkyˉ)t=k+1n(ytyˉ)2t=k+1n(ytkyˉ)2\rho_k = \frac{\sum_{t=k+1}^{n} (y_t - \bar{y})(y_{t-k} - \bar{y})}{\sqrt{\sum_{t=k+1}^{n} (y_t - \bar{y})^2 \sum_{t=k+1}^{n} (y_{t-k} - \bar{y})^2}}

In practice, to compute ρ1\rho_1:

  • Create two series: (y2,y3,,yn)(y_2, y_3, \dots, y_n) and (y1,y2,,yn1)(y_1, y_2, \dots, y_{n-1}).
  • Compute their correlation (e.g., CORREL() in Excel).

Worked example – toy sales data

Given daily sales: values from 100 to 130, ending at 125 on Sunday (7 days).
For lag 1, align:

OriginalLagged 1
y2=120y_2 = 120y1=100y_1 = 100
y3=115y_3 = 115y2=120y_2 = 120
y7=125y_7 = 125y6y_6

The correlation of these two series equals 0.196.
Interpretation: a 1‑unit increase in past day’s sales is associated with a 0.2‑unit increase in the next day’s sales (linear approximation).

Extending to higher lags

  • Lag 2: correlate (y3,y4,,yn)(y_3, y_4, \dots, y_n) with (y1,y2,,yn2)(y_1, y_2, \dots, y_{n-2}).
  • Lag kk: correlate (yk+1,,yn)(y_{k+1}, \dots, y_n) with (y1,,ynk)(y_1, \dots, y_{n-k}).

Typically, autocorrelation decreases as the lag increases (e.g., today’s stock price influences tomorrow most, the day after a little less, etc.).

Sign of autocorrelation – what it tells you

Autocorrelation signPatternBusiness example
PositiveHigh values followed by high; low followed by lowDaily store sales (recurring customer behaviour); warm days follow warm days
NegativeHigh values followed by low; low followed by highAlternating marketing expenditure (high spend → budget cut next period)

Exam tip: Positive autocorrelation is far more common in business. Negative autocorrelation often indicates deliberate alternating policies.


Autoregressive (AR) Models

An autoregressive model exploits autocorrelation by modelling the current value as a function of its own past values. The name literally means “regressing on itself”.

AR of order 1 – AR(1)

yt=c+ϕ1yt1+εty_t = c + \phi_1 y_{t-1} + \varepsilon_t
  • yty_t = current value
  • yt1y_{t-1} = value at previous time point
  • ϕ1\phi_1 = coefficient (strength of influence)
  • cc = intercept
  • εt\varepsilon_t = random error

Creating the lagged predictor: shift the series by one time step. Then run ordinary linear regression with yty_t as response and yt1y_{t-1} as predictor.

Bakery sales example

Data: daily sales from 2 Jan 2021 to 30 Sep 2022.
For an AR(1) model:

  • Dependent variable: sales on day tt
  • Independent variable: sales on day t1t-1 (lagged series)

Regression output (Excel Data Analysis ToolPak):

CoefficientEstimatepp-value
Intercept (cc)242.9≈ 0
Lagged sales (ϕ1\phi_1)0.739≈ 0
  • Adjusted R2R^2: ~54% – past day’s sales explains 54% of today’s variation.
  • Both coefficients are statistically significant (p0p \approx 0).

Interpretation:

  • If previous day’s sales were zero, expected sales = 242.9 units.
  • For every 1‑unit increase in past sales, today’s sales increase by 0.739 units.

Prediction: Fitted equation:

y^t+1=242.942+0.739yt\hat{y}_{t+1} = 242.942 + 0.739 \, y_t

On 30 Sep 2022, sales = 795.95 units. Prediction for 1 Oct 2022:

y^=242.942+0.739×795.95=831.15 units\hat{y} = 242.942 + 0.739 \times 795.95 = 831.15 \text{ units}

AR of order 2 – AR(2)

yt=c+ϕ1yt1+ϕ2yt2+εty_t = c + \phi_1 y_{t-1} + \phi_2 y_{t-2} + \varepsilon_t

Extends to include two previous lags. The appropriate order is chosen by examining autocorrelation at multiple lags or using cross‑validation.

Exam tip: For an AR model to work, significant autocorrelation must exist in the data. Check the autocorrelation plot before fitting.


Choosing among forecasting methods – a recap

The lecture contrasted AR models with earlier methods. In practice, evaluate several candidates on a held‑out test set (last few observations) using root mean squared error (RMSE).

MethodCore idea
NaïveUse last observed value for all future forecasts
Seasonal naïveUse last observed value from same season (e.g., last Monday for next Monday)
Average methodForecast = sample mean of all past values
Weighted averageWeighted mean of all past values, higher weight on recent
Exponential smoothingWeights decay exponentially: α(1α)k\alpha (1-\alpha)^{k} for values kk periods back
Drift methodLinear trend from first to last observation, projected forward
Autoregressive (AR)Linear regression on own past values

Cross‑validation procedure for time series:

  1. Hold out the last mm observations as the test set (e.g., last month).
  2. Train each method on the remaining data.
  3. Compute RMSE on the test set.
  4. Select the method with the smallest RMSE.

Key takeaways

  • Autocorrelation measures how a time series correlates with its own past; it is the foundation of autoregressive models.
  • ρk\rho_k is computed by correlating the series with its kk-lagged version; typically decays with kk.
  • Positive autocorrelation: high → high; negative: high → low (rarer in business).
  • AR(1): yt=c+ϕ1yt1+εty_t = c + \phi_1 y_{t-1} + \varepsilon_t; estimated via linear regression on the lagged variable.
  • AR models require significant autocorrelation; order selection can use autocorrelation analysis or cross‑validation.
  • Always compare AR with simpler benchmarks (naïve, exponential smoothing, drift) using a hold‑out RMSE.

A Case Study: Forecasting Gold Price in India (1964–2023)

This case study applies forecasting techniques to annual gold price data (1964–2023, 60 years). The dataset includes inflation as a potential predictor. The goal: predict gold price for the next year and evaluate which method works best. A cross-validation approach holds out the last 5 years (2019–2023) as a test set; the first 55 years train the models.

Questions and Data Overview

Six key questions guide the analysis:

  1. Is there a trend in gold price?
  2. Is there seasonality in this yearly series?
  3. Can past inflation (lagged) serve as a predictor in a linear regression model?
  4. Which simple methods (Naive, Seasonal Naive, Average, Weighted Average, Drift) perform well?
  5. What is the autocorrelation structure? Would an autoregressive model be suitable?
  6. Using cross-validation, which of the candidate models forecasts best?

1. Trend and Seasonality

Intuition: Visualizing the time series reveals overall behavior and whether trend or repeating cycles exist.

  • The gold price plot shows a slow linear increase until ~2003, a dip around 2000, then exponential growth, another dip around 2012, followed by renewed exponential rise. The trend is erratic – not consistently linear or exponential – making a simple linear trend unsuitable.
  • Seasonality is absent. Because the data is annual (yearly), repeating patterns within a year cannot exist. Any method relying on seasonality (e.g., Seasonal Naive, seasonal AR) is inappropriate.

Exam tip: For annual data, seasonality is impossible unless the series is recorded at sub‑annual intervals. Always check the frequency first.

2. Linear Regression with Inflation as Predictor

Intuition: Inflation is commonly believed to drive gold prices. A regression model uses lagged inflation (inflation from the previous year) to predict gold price.

  • Model: Goldt=β0+β1Inflationt1+ε\text{Gold}_t = \beta_0 + \beta_1 \cdot \text{Inflation}_{t-1} + \varepsilon
  • Fitted equation (training data 1964–2018): Predicted Gold=8191.447(coefficient)×Inflation\text{Predicted Gold} = 8191.447 - \text{(coefficient)} \times \text{Inflation}
  • The coefficient on inflation is not statistically significant (high p‑value). Although the common belief links gold to inflation, over the 60‑year period inflation changed little while gold prices soared. Inflation alone is a weak predictor.
  • Predictions for 2019–2023 are poor. For 2019, predicted ≈ 7,775 vs. actual ≈ 35,000. RMSE is extremely high (similar to the simple average method).

Takeaway: Simple linear regression on a single, non‑trending predictor fails when the target has a strong time‑dependent growth.

3. Simple Forecasting Methods

Five simple methods were considered:

  • Naive method: Forecast next year = last observed value. (Good benchmark, always included.)
  • Seasonal naive: Requires seasonality – not applicable.
  • Average method: Forecast = mean of all training data (55 years). Unlikely to capture rising trend.
  • Weighted average method: Gives more weight to recent observations. Here, weights proportional to 1,2,3,4,5 for the last 5 years (most recent gets weight 5). Subjective – other schemes possible.
  • Drift method: Assumes constant linear change per period; not suitable because trend is not linear over the whole period.

Decision: Only Naive, Average, and Weighted Average are used. Seasonal naive and drift are dropped.

Forecasts on test set (2019–2023):

YearActual Gold PriceNaive (31,438)Average (7,223)Weighted Avg
2019~35,00031,4387,223~23,000 (est)
2020...31,4387,223increasing
...............
2023...31,4387,223...

RMSE results:

  • Average: ~43,567 (very poor)
  • Naive: 20,536
  • Weighted average: 12,869

Weighted average captures some upward trend by heavily weighting recent data, outperforming naive. Average method fails completely.

4. Autoregressive Model of Order 1 (AR1)

Intuition: Gold price is highly correlated with its own past. Autocorrelation measures this: a high, slowly decaying autocorrelation suggests an autoregressive (AR) model will work.

Autocorrelation values (training data):

LagAutocorrelation
10.989
20.964
30.935
40.908

Values are very high and decrease with lag – the farther back, the less influence on the present. This pattern supports an AR model.

AR1 model fitted:

Goldt=263.282+1.047Goldt1+ε\text{Gold}_t = 263.282 + 1.047 \cdot \text{Gold}_{t-1} + \varepsilon

  • Coefficient of lagged gold is highly significant. For every unit increase in last year’s price, this year’s price increases by ~1.047 units (plus intercept).
  • Forecasting for 2019: Use gold price in 2018 (31,438). Prediction: 263.282+1.047×31,43833,176263.282 + 1.047 \times 31,438 \approx 33,176. Actual: 35,000. Error ~1,824.
  • Repeating for all 5 test years yields RMSE = 6,568 – far lower than any simple method.

Why it works: The AR1 model captures the persistence and growth inherent in the series without assuming a fixed trend shape.

5. Cross-Validation Results Summary

MethodRMSE (test set)
Linear regression (inflation)~43,500 (approx)
Average method43,567
Naive method20,536
Weighted average (last 5, weights 1-5)12,869
AR1 model6,568

The AR1 model yields more than 100% improvement in RMSE over the next best (weighted average). The lecture notes that further refinements could include:

  • Combining regression with AR (ARIMAX).
  • Higher‑order AR (AR2, AR3).
  • Adding trend terms (linear, exponential) as additional predictors in an AR framework.

6. Beyond: Improving the Model

The case study hints at more advanced approaches. For gold price, one could add a linear trend (time index 1,2,3,…) and an exponential trend (e1,e2,e3,e^1, e^2, e^3,\dots) as extra regressors alongside the lagged gold. Running a regression with these would likely improve predictions further.

Contrast with bakery sales data (from earlier module): That data had seasonality, so seasonal naive and seasonal AR would be appropriate. This case shows that method selection must always match the data’s characteristics.

Exam tip: Always start with a naive forecast as a baseline. Any serious model must beat its RMSE. Here, AR1 beat it by a factor of 3.

Key Takeaways

  • Annual data cannot have seasonality – skip seasonal methods.
  • Visual inspection reveals trend shape (here: erratic, partly exponential) and zero seasonality.
  • Simple linear regression on a single predictor (inflation) fails when the predictor lacks a time trend of its own.
  • Among simple methods, weighted average (giving more weight to recent data) captured growth and outperformed naive.
  • Autocorrelation was very high (0.99 at lag 1), making an AR1 model the best performer (RMSE 6,568 vs. 12,869 for weighted average).
  • Cross-validation (hold‑out last 5 years) provided an honest comparison – AR1 was clearly superior.
  • Always refine models by testing additional predictors (trend terms, other economic variables) and higher AR orders.

Statistical Methods in Quality Management

Importance of Statistics in Quality Management

Quality management (QM) is a systematic approach to ensuring products, services, or processes meet or exceed customer expectations. It integrates planning, monitoring, and improvement of operations to deliver consistent, reliable outcomes. Core principles include customer focus, process optimization, continuous improvement, and evidence-based decision making. Frameworks such as Total Quality Management (TQM) , Six Sigma, and ISO standards provide structured methods to reduce errors, increase efficiency, foster customer satisfaction, and maintain competitive advantage.

Statistics supplies the tools to measure, analyze, and improve quality scientifically. By applying statistical methods, organizations can:

  • Quantify variation in processes.
  • Identify root causes of defects.
  • Implement solutions for consistent performance.

Key Statistical Techniques in QM

TechniquePurpose in Quality Management
Control charts (Statistical Process Control)Monitor process performance over time; detect deviations before they escalate
SamplingAssess product quality without inspecting every unit – saves time and cost
Estimation (sample means, standard deviations)Infer population parameters from samples to check adherence to standards
Hypothesis testingDetermine whether a process meets required standards
Regression analysisIdentify factors (e.g., in manufacturing) that influence defects
Design of experiments (DOE)Optimise formulations or processes (e.g., pharmaceutical drug development)

Intuition: Why Statistics Matters

A manufacturing process (or any pipeline) produces a stream of items. Inspecting every item is impossible for time and cost reasons. Instead, sample statistics (e.g., sample mean, sample standard deviation) are used to infer whether the entire output meets gold standards. Statistical techniques like estimation and hypothesis testing become critical for drawing these conclusions.

Six Sigma exemplifies the role of statistics in reducing process variability to achieve near-perfect quality levels. By using hypothesis testing, regression, or DOE, businesses detect deviations from the gold standard and pinpoint which part of the pipeline causes the deviation. This enables data-driven decisions that keep errors within acceptable limits.

Worked Examples (from industry)

  • Automobile manufacturer uses regression analysis to identify factors correlated with defects in car components. The regression model reveals which process variables are positively correlated with defects, allowing targeted corrective actions.
  • Pharmaceutical company uses design of experiments (DOE) to optimise the formulation of a new drug, systematically varying ingredients to find the best combination.

Benefits of Statistical QM

  • Facilitates continuous improvement by providing measurable insights into process performance.
  • Enables setting benchmarks and tracking progress.
  • Supports evidence-based adjustments to meet quality standards.
  • Ensures regulatory compliance in manufacturing, healthcare, and service delivery.
  • Minimises waste and enhances customer satisfaction.
flowchart LR
  A[Process / Pipeline] --> B[Sampling]
  B --> C[Sample statistics<br>mean, std dev]
  C --> D{Statistical Analysis}
  D --> |Control charts| E[Monitor variation]
  D --> |Hypothesis tests| F[Compare to standards]
  D --> |Regression / DOE| G[Identify root causes]
  E --> H[Detect deviations]
  F --> H
  G --> H
  H --> I[Take corrective action]
  I --> A

Key takeaways

  • Quality management relies on evidence-based decisions; statistics provides the scientific measurement and analysis framework.
  • Control charts and sampling are foundational for monitoring and cost-efficient inspection.
  • Estimation and hypothesis testing let managers infer process behaviour from samples.
  • Regression analysis and DOE help identify causes of defects and optimise products.
  • Statistical methods transform quality management from abstract principle into a measurable, improvable process.

Hypothesis Testing in Quality Management

Hypothesis testing enables managers to decide whether an observed deviation in a process or product is due to random chance or signals a real problem. In quality management, these decisions have direct operational, financial, and safety consequences.

Type I and Type II Errors

Every test risks one of two mistakes. The null hypothesis (H0H_0) typically represents the “status quo” — that the process is acceptable. Rejecting H0H_0 means concluding there is a problem; failing to reject means no action is taken.

Decision →<br>Reality ↓Reject H0H_0Do not reject H0H_0
H0H_0 trueType I error (false positive)<br>Conclude a problem exists when it does notCorrect decision
H0H_0 falseCorrect decisionType II error (false negative)<br>Conclude no problem when one exists

Why each error matters in quality

  • Type I error (α\alpha) – “False alarm.”
    Example: A batch that meets standards is rejected, causing unnecessary rework, scrap, or inspection costs.
    Control: Set a low significance level (commonly α=0.05\alpha = 0.05 or 0.01).

  • Type II error (β\beta) – “Miss.”
    Example: A defective batch passes inspection, leading to recalls, legal liability, or safety hazards (e.g., faulty brake pads, wrong drug concentration).
    Control: Increase sample size or test power (1β1-\beta).

Exam tip: In quality, Type I errors waste money; Type II errors can kill people. Which error matters more depends on the consequence — not on a fixed rule.

Consequences of errors in quality management

ImpactType I dominantType II dominant
Financial lossesRejecting good batches → increased costFailing to detect defects → recalls, warranty claims
ReputationSubstandard products damage trust
Operational efficiencyExcessive inspections / rework
Safety risksAviation, healthcare, food: catastrophic failures

Key takeaways – Type I & II errors

  • Type I = false positive (reject true H0H_0); Type II = false negative (fail to reject false H0H_0).
  • α\alpha (significance level) controls Type I; β\beta controls Type II (power = 1β1-\beta).
  • In manufacturing, Type I often drives cost; in safety-critical settings, Type II is paramount.
  • Balancing errors requires setting appropriate α\alpha, increasing sample size, and choosing the correct test.

Worked Examples

Example 1: Steel rod diameter (two-tailed test)

Situation: A factory produces steel rods with a target mean diameter μ=5\mu = 5 mm. A random sample of n=30n=30 rods yields xˉ=4.98\bar{x}=4.98 mm, s=0.05s=0.05 mm. Is the process misaligned?

  • Hypotheses: H0:μ=5H_0: \mu = 5 vs. H1:μ5H_1: \mu \neq 5 (two-tailed — both under‑ and over‑fill are unacceptable).
  • Test statistic (t-test, since σ\sigma unknown):

t=n(xˉμ0)s=30(4.985)0.05=2.2t = \frac{\sqrt{n}(\bar{x}-\mu_0)}{s} = \frac{\sqrt{30}(4.98-5)}{0.05} = -2.2

  • Null distribution: tt with df=29df = 29.
  • p-value: For a two-tailed test, p=2×P(T29<2.2)2×0.018=0.036p = 2 \times P(T_{29} < -2.2) \approx 2 \times 0.018 = 0.036 (3.6%).
  • Decision: p=0.036<α=0.05p = 0.036 < \alpha = 0.05 → reject H0H_0.

Conclusion: The observed deviation is unlikely due to chance. The machinery needs recalibration.

Example 2: Brake pad compressive strength (one-tailed test)

Situation: Minimum acceptable mean compressive strength is 100 MPa. A sample of n=15n=15 brake pads gives xˉ=99.3\bar{x}=99.3 MPa, s=1.6s=1.6 MPa. Does the supplier meet the standard?

  • Hypotheses: H0:μ100H_0: \mu \geq 100 vs. H1:μ<100H_1: \mu < 100 (one-tailed — only under‑strength is a concern).
  • Test statistic:

t=15(99.3100)1.6=1.7t = \frac{\sqrt{15}(99.3-100)}{1.6} = -1.7

  • Null distribution: tt with df=14df = 14.
  • p-value: P(T14<1.7)0.056P(T_{14} < -1.7) \approx 0.056 (5.6%).
  • Decision: p=0.056>α=0.05p = 0.056 > \alpha = 0.05 → do not reject H0H_0.

Conclusion: There is insufficient evidence to claim the supplier is substandard. The sample mean of 99.3 MPa could be due to random variation. (Recommend increasing sample size for a definitive verdict.)

Exercises for practice

  1. Sugar packaging: A company fills 1‑kg bags. Suspecting underfilling, they sample n=25n=25 bags: xˉ=0.97\bar{x}=0.97 kg, s=0.05s=0.05 kg. Formulate hypotheses and decide (one‑tailed? two‑tailed?) whether the filling machine needs adjustment.
  2. Call center wait times: Before a new scheduling system, average wait time was 4.5 min. After, a sample of n=50n=50 calls shows xˉ=4.1\bar{x}=4.1 min, s=0.8s=0.8 min. Test whether the system effectively reduced wait time.

Key takeaways – Hypothesis testing in practice

  • Choose the right tail: Two-tailed when any deviation is unacceptable; one-tailed when only a specific direction matters (e.g., under‑strength, over‑weight).
  • Use tt‑test when σ\sigma unknown — the most common case in quality.
  • Context drives the decision: A “non‑significant” result (p > 0.05) may still warrant follow‑up with a larger sample if the consequence of a Type II error is severe.
  • Hypothesis testing enables early detection, supplier accountability, evidence-based process changes, and cost savings from reduced waste/rework.

Regression Analysis to Model Input and Output Relationships in Quality Control

Regression analysis models how input variables (independent variables) affect an output variable (dependent variable). In quality control, this quantifies the relationship between process factors and product quality, enabling prediction, identification of key drivers, and optimization of operating conditions. By understanding which inputs matter and by how much, teams can reduce variability, minimize defects, and make data-driven improvements.

Importance of Regression in Quality Control

  • Identify key drivers – Determines which factors (e.g., machine temperature, raw material properties) significantly influence quality or defect rates.
  • Quantify relationships – Produces a mathematical model that predicts output from input values, supporting proactive decision-making and scenario forecasting.
  • Find optimal settings – Helps minimize defects, risks, or costs by selecting input levels that keep the output within acceptable bounds.
  • Understand sources of variability – Reduces unwanted variation by isolating which inputs contribute to inconsistency.
  • Support Six Sigma initiatives – Provides evidence for reducing defects, rework, and costs through targeted process changes.

Linear Regression: Worked Examples

The general linear regression model with multiple inputs is written as:

Y=β0+β1X1+β2X2++ϵY = \beta_0 + \beta_1 X_1 + \beta_2 X_2 + \cdots + \epsilon

where YY is the output, XiX_i are inputs, βi\beta_i are coefficients, and ϵ\epsilon is random error.

Example 1: Controlling Product Weight in Packaging

A food company packages 1‑kg bags. Two inputs are suspected to affect bag weight: machine speed (bags per minute) and hopper pressure (psi). Data collected at various settings yields the following linear regression results:

  • Every increase of 10 bags per minute → bag weight decreases by 0.02 kg.
  • Every increase of 5 psi → bag weight increases by 0.01 kg.

The company uses scenario forecasting to predict weight at different input combinations, e.g., machine speed = 40 bags/min and hopper pressure = 15 psi gives a weight closest to 1 kg. Multiple acceptable settings may exist; the regression model provides the flexibility to choose a feasible, compliant combination.

Example 2: Defect Rate in an Assembly Line

An electronics manufacturer wants to predict the percentage of defective units based on two inputs: worker training hours and machine maintenance frequency (days since last maintenance). Regression results:

  • Every additional 5 hours of training → defect rate decreases by 4 %.
  • Every additional 5 days since last maintenance → defect rate increases by 6 %.

The company seeks an optimum level, not necessarily zero defects, because unlimited training or daily maintenance would incur prohibitive costs. For an acceptable threshold of 10 % defects, the model suggests, e.g., maintaining machines every 10 days and providing at least 15 hours of training. This balances quality with cost.

ExampleInput variablesEffect on outputObjective
Packaging weightMachine speed, hopper pressureSpeed ↓ weight; pressure ↑ weightFind settings that yield weight ≈ 1 kg
Assembly defectsTraining hours, days since maintenanceTraining ↓ defects; maintenance delay ↑ defectsKeep defects ≤ 10 % at minimal cost

Logistic Regression in Quality Control

Logistic regression is used when the output variable is binary, e.g., pass/fail, in control/out of control. It models the probability of an event (e.g., defect) as a function of predictors:

P(Y=1)=11+e(β0+β1X1+β2X2+)P(Y=1) = \frac{1}{1 + e^{-(\beta_0 + \beta_1 X_1 + \beta_2 X_2 + \cdots)}}

Example: A manufacturer wants to predict the probability that a product fails quality checks based on temperature, pressure, and machine speed. Logistic regression quantifies how each predictor affects the odds of failure. The manager can:

  • Identify which factors contribute most to quality issues (high positive coefficients).
  • Estimate the likelihood of defects under current process conditions.
  • Determine optimal ranges for predictors to minimize defect probability.
  • Pinpoint high-risk factors for immediate corrective action.

Exam tip: Logistic regression is ideal for binary quality outcomes (e.g., defective vs. non‑defective, conforming vs. non‑conforming). It provides probabilities, not continuous predictions, and is sensitive to sample size and class balance.

Key takeaways

  • Regression (linear or logistic) quantifies how inputs affect outputs in quality management.
  • Linear regression predicts continuous outcomes (weight, defect percentage) and aids scenario forecasting.
  • Logistic regression predicts binary outcomes (pass/fail) and estimates probabilities of defects.
  • Both methods identify key drivers and support optimization, but practical constraints (cost, feasibility) often require a target acceptable level rather than absolute perfection.
  • Regression is a cornerstone for data-driven process improvement, variability reduction, and Six Sigma.

Statistical Decision Theory – Introduction

Statistical decision theory provides a structured framework for making choices when outcomes depend on uncertain events. The core idea: combine probabilities, data, and decision rules to minimize risk or maximize expected payoff. Every business manager faces decisions under uncertainty — the quality of those decisions hinges on the quantity and quality of available information.


Elements of the Decision Process

Every decision problem under uncertainty contains four components:

  1. Alternative courses of action (acts/strategies) – the options the decision maker can choose (e.g., launch a new product vs. expand marketing).
  2. States of nature – uncertain, uncontrollable events that affect outcomes (e.g., high market demand vs. low market demand).
  3. Payoff – a numerical value (profit, cost, utility) conditional on the combination of an action and a state. The payoff is always conditional because the state is unknown at decision time.
  4. Decision rule – the criterion for selecting the best action, based on the decision maker’s goals and available information.

Payoff Matrix

A payoff matrix is a table that displays the payoff for every action–state pair. It enables direct comparison of outcomes under different scenarios.

Payoff matrix = each row an action, each column a state, each cell the payoff for that combination.

Example: Product Launch vs. Marketing Expansion

ActionState: High demandState: Low demand
Launch new product₹200,000₹50,000
Expand marketing for existing product₹150,000₹100,000

The decision maker cannot simply pick the maximum payoff (₹200,000) because that payoff is contingent on "high demand" occurring. The matrix forces explicit consideration of both possibilities.


Opportunity Loss (Regret) Matrix

The opportunity loss matrix (or regret matrix) quantifies the cost of not choosing the best action for each state. It is constructed as:

Regret=Maximum payoff in that stateActual payoff from chosen action\text{Regret} = \text{Maximum payoff in that state} - \text{Actual payoff from chosen action}

Steps to build it:

  1. For each state, identify the maximum payoff across all actions.
  2. In each column, subtract every payoff from that column’s maximum.

Regret Matrix for the Example

  • High demand: max payoff = ₹200,000 (Launch)
  • Low demand: max payoff = ₹100,000 (Expand)
ActionRegret in High demandRegret in Low demand
Launch new product₹200k − ₹200k = ₹0₹100k − ₹50k = ₹50,000
Expand marketing₹200k − ₹150k = ₹50,000₹100k − ₹100k = ₹0

Interpretation: If the firm launches the product and demand turns out to be low, it loses ₹50,000 compared to what it could have earned by expanding marketing.

flowchart LR
    A[Decision problem] --> B[Payoff matrix: direct profit]
    A --> C[Opportunity loss matrix: regret of non-optimal choice]
    B --> D[Used when probabilities are known, risk-neutral]
    C --> E[Used for minimax regret, conservative]

When to use each:

MatrixUse case
Payoff matrixMaximise expected profit when state probabilities can be estimated
Opportunity loss matrixMinimise maximum possible regret when probabilities are unknown or decision maker is cautious

Exam tip: The regret matrix is not an alternative payoff matrix — it is derived from the payoff matrix. A common mistake is to confuse the two. Regret always uses the difference from the best-in-column.


Key takeaways

  • Four elements: actions, states of nature, conditional payoffs, and a decision rule.
  • A payoff matrix organises all possible outcomes for each action–state pair.
  • An opportunity loss matrix shows the regret of not picking the best action in each state; each cell = column max − actual payoff.
  • The same example can be analysed with either matrix depending on whether the goal is reward maximisation or regret minimisation.

Concept of Decision-Making Under Uncertainty

Decision theory (or decision analysis) formalizes the process of choosing among alternative courses of action when at least two alternatives exist. The decision environment is classified by the amount of information available about the outcomes:

  • Certainty – The outcome of each action is known perfectly. The decision is trivial: pick the action with the largest payoff. Statistically uninteresting.
  • Uncertainty – More than one possible outcome (state of nature) exists, but the decision-maker cannot assign probabilities to them.
  • Risk – States of nature exist and the decision-maker can assign probabilities (objective or subjective) to each.

Decision Process

  1. Identify and define the problem.
  2. List all possible future events – the states of nature (S1,S2,,SnS_1, S_2, \dots, S_n).
  3. Identify all possible courses of action (alternatives) – A1,A2,,AmA_1, A_2, \dots, A_m.
  4. Construct a payoff table showing the payoff (profit, cost, etc.) for every combination of action and state of nature.
  5. Choose a decision criterion (rule) to select the best action.

Decision Making Under Uncertainty

The decision-maker has knowledge of the possible states of nature but lacks any information about their likelihoods. Four classic criteria are used:

1. Maximax Criterion (Criterion of Optimism)

Select the alternative that yields the maximum of the maximum payoffs.

  • For each alternative, find the highest payoff across all states.
  • Choose the alternative with the largest of these maxima.

Exam tip: Maximax is unrealistically optimistic; it assumes the best-case scenario will occur.

2. Maximin Criterion (Criterion of Pessimism)

Select the alternative that yields the maximum of the minimum payoffs.

  • For each alternative, find the lowest payoff across all states.
  • Choose the alternative with the largest of these minima.

This ensures a guaranteed worst-case floor – a conservative, security-oriented approach.

3. Minimax Regret Criterion (Opportunity Loss / Minimum Regret)

Minimises the maximum opportunity cost (regret) of a decision.

Procedure:

  1. For each state of nature, identify the best possible payoff.
  2. For each action–state combination, compute regret = best payoff in that state − actual payoff.
  3. For each alternative, find the maximum regret.
  4. Select the alternative with the minimum of those maximum regrets.
flowchart TD
    A[Compute regret for each action-state] --> B[Find max regret per action]
    B --> C[Select action with smallest max regret]

This criterion strikes a balance: it limits the worst regret a manager can experience, though it may sacrifice high rewards.

4. Hurwicz Criterion (Criterion of Realism)

A compromise between maximax and maximin. The decision-maker chooses a coefficient of optimism α\alpha (0α10 \le \alpha \le 1), where α=1\alpha = 1 gives maximax and α=0\alpha = 0 gives maximin.

For each alternative ii, compute:

Hi=α×(maximum payoff for Ai)+(1α)×(minimum payoff for Ai)H_i = \alpha \times (\text{maximum payoff for } A_i) + (1-\alpha) \times (\text{minimum payoff for } A_i)

Select the alternative with the highest HiH_i.


Worked Example: Biscuit Selection

A shopkeeper must choose one biscuit brand: Marigold, Good Day, or Oreo. Three possible states of nature: expected sales next year – Low, Medium, High. Payoffs in thousands of rupees:

AlternativeLow (5,000 units)Medium (10,000 units)High (20,000 units)
Marigold153045
Good Day204065
Oreo255070

Maximax:
Maximum payoffs: Marigold = 45, Good Day = 65, Oreo = 70 → choose Oreo.

Maximin:
Minimum payoffs: Marigold = 15, Good Day = 20, Oreo = 25 → choose Oreo.

Minimax Regret:

First compute the best payoff in each state:

  • Low: 25 (Oreo)
  • Medium: 50 (Oreo)
  • High: 70 (Oreo)

Regret table (best − actual):

AlternativeLowMediumHighMax Regret
Marigold10202525
Good Day510510
Oreo0000

Select Oreo (minimax regret = 0). In this example all three criteria select Oreo.

Hurwicz with α=0.5\alpha = 0.5:

  • Marigold: 0.5×45+0.5×15=300.5 \times 45 + 0.5 \times 15 = 30
  • Good Day: 0.5×65+0.5×20=42.50.5 \times 65 + 0.5 \times 20 = 42.5
  • Oreo: 0.5×70+0.5×25=47.50.5 \times 70 + 0.5 \times 25 = 47.5 → choose Oreo.

Since both extremes point to Oreo, any weighted average also points to Oreo. This is not always the case, as seen next.


Additional Example: Bottling Company (Take-Home Exercise)

A company must choose among three actions to meet rising demand: Expand existing plant, Construct a new plant, or Subcontract production. Four states of nature: High, Medium, Low, or None (demand). Payoffs in thousands of rupees:

ActionHighMediumLowNone
Expand5020-25-45
Construct7030-40-80
Subcontract3015-5-10

Applying the criteria will yield different optimal actions:

  • Maximax → Construct (70).
  • Maximin → Subcontract (−10 is the highest minimum).
  • Minimax regret → Compute regret and select the action with smallest max regret (likely Subcontract or Expand).
  • Hurwicz → Varies with α\alpha; at α=0.5\alpha=0.5:
    • Expand: 0.5(50)+0.5(45)=2.50.5(50) + 0.5(-45) = 2.5
    • Construct: 0.5(70)+0.5(80)=50.5(70) + 0.5(-80) = -5
    • Subcontract: 0.5(30)+0.5(10)=100.5(30) + 0.5(-10) = 10Subcontract.

Exam tip: When maximax and maximin give different answers, Hurwicz offers a flexible middle ground. Always check how changing α\alpha alters the decision.

Key Takeaways

  • Under uncertainty, no probabilities are known; under risk, probabilities are assigned.
  • Maximax – optimistic; Maximin – pessimistic; Minimax regret – minimises worst-case opportunity loss; Hurwicz – weighted average of best and worst.
  • The choice of criterion heavily influences the decision; in some problems different criteria recommend different actions.
  • The Hurwicz α\alpha parameter reflects the manager’s degree of optimism.

Concept of Decision Trees

A decision tree is a graphical tool for evaluating multiple decision alternatives under uncertainty. It breaks down complex decisions into sequential steps, mimicking natural decision-making. Each node is a decision point or a chance event; branches represent possible choices or outcomes with associated probabilities and payoffs. The structured approach allows decision makers to visualize chains of events and systematically weigh risks and rewards.

Decision trees are widely used in business analytics, finance, marketing, operations, and quality management to optimise strategies and reduce uncertainty. The core objective: compute the expected monetary value (EMV) of each branch and choose the path with the highest expected payoff.

Example: Launching a New Smartwatch

A retail company must decide whether to launch a new smartwatch immediately or conduct market research first. Uncertainties include market reception (success or failure), research outcome (favours launch or not), and associated costs/probabilities. The decision tree captures all paths and their EMVs.

flowchart TD
    A[Decision] --> B1[Launch immediately]
    A --> B2[Conduct market research\n(cost: ₹200,000)]
    
    B1 --> C1[Success (0.6)]
    B1 --> C2[Failure (0.4)]
    
    B2 --> D1[Research favours launch (0.7)]
    B2 --> D2[Research does not favour launch (0.3)]
    
    D1 --> E1[Success (0.6)]
    D1 --> E2[Failure (0.4)]
    D2 --> F1[Abandon: loss = research cost]
    
    C1 -->|Profit ₹1,000,000| G1[EMV₁]
    C2 -->|Loss ₹500,000| G1
    E1 -->|Profit ₹1,000,000| G2[EMV₂ sub-branch]
    E2 -->|Loss ₹500,000| G2
    F1 -->|Loss ₹200,000| G2

EMV calculation

  • Launch immediately:
    EMV1=0.6×1,000,000+0.4×(500,000)=600,000200,000=400,000\text{EMV}_1 = 0.6 \times 1{,}000{,}000 + 0.4 \times (-500{,}000) = 600{,}000 - 200{,}000 = ₹400{,}000

  • Market research first:

    • If research favours launch (70 % chance), the sub‑branch EMV is the same as above: ₹400,000.
    • If research does not favour launch (30 % chance), the loss is only the research cost: ₹200,000.
    • Overall EMV:
      EMV2=0.7×400,000+0.3×0200,000=280,000200,000=80,000\text{EMV}_2 = 0.7 \times 400{,}000 + 0.3 \times 0 - 200{,}000 = 280{,}000 - 200{,}000 = ₹80{,}000

Since ₹400,000 > ₹80,000, the optimal decision is launch immediately.

Exam tip: Always subtract the research cost from the total EMV of the research branch — a common oversight. The EMV of the launch branch already accounts for the profit/loss numbers given.

Decision Trees for Quality Control Decisions

Decision trees also apply to batch inspection in manufacturing. A manager must decide: approve, perform further tests, or reject a batch based on sample defect rates. The tree uses pre‑defined thresholds derived from historical data.

Example: Automobile Parts Batch Inspection

  • Each batch contains 1,000 parts; a random sample of 50 is inspected.
  • Decision thresholds (from historical analysis):
    • Defect rate < 2 % → approve batch.
    • Defect rate 2–5 % → borderline; conduct further testing.
    • Defect rate > 5 % → reject batch.

For a sample of 50 parts:

  • 0 or 1 defective → approve (defect rate ≤ 2 %).
  • 2, 3, or 4 defective → further testing.
  • 5 or more defects → reject (defect rate ≥ 10 %).
flowchart LR
    A[Sample (n=50)] --> B{Defect count}
    B -->|0–1 defects| C[Approve]
    B -->|2–4 defects| D[Further testing]
    B -->|≥5 defects| E[Reject]

Setting Thresholds with Historical Data

Rather than arbitrary cutoffs, thresholds should be data‑driven. Two common approaches:

  1. Percentile analysis – Examine the distribution of defect rates from past batches. Identify natural cutoffs where higher defect rates are associated with high rework costs or customer returns. For example, the 90th percentile might mark the point beyond which rejection is economically justified.

  2. Cost‑benefit simulation – Define the costs of each decision:

    • Scrap cost (rejecting a good batch)
    • Inspection cost (further testing)
    • Failure cost (defective products reaching customers – returns, warranty claims, legal risks)

    Simulate different threshold pairs (e.g., lower=1 %, upper=3 %; lower=2 %, upper=5 %) and compute total expected cost. The optimal thresholds minimise total cost.

Exam tip: Threshold selection is a trade‑off between strictness (high rejection → scrap cost) and leniency (high defect rate shipped → failure cost). Always consider both sides in an exam problem.

Automation and Continuous Improvement

  • Once thresholds are set, the decision tree can be automated – every new batch is sampled, classified, and routed to the appropriate action without manual intervention.
  • Continuous improvement: Re‑evaluate thresholds periodically (monthly/quarterly) using updated defect patterns to adapt to process changes.

Key takeaways

  • A decision tree maps decisions, chance events, probabilities, and payoffs into a clear visual framework.
  • EMV is the core metric: EMV=(probability×payoff)\text{EMV} = \sum (\text{probability} \times \text{payoff}) – choose the branch with the highest EMV.
  • In quality control, decision trees classify batches based on sample defect rates and predefined thresholds (e.g., approve if ≤2 defects/n).
  • Thresholds should be derived from historical data using percentiles or cost‑benefit simulations, not guesswork.
  • Decision trees enable automated quality assurance, reducing subjective judgment and improving product quality.

Statistical Process Control (SPC)

Statistical Process Control (SPC) is a data-driven methodology used to monitor and control processes so that they produce consistent, reliable output. The core insight: every process has inherent variation. SPC helps distinguish normal variation from abnormal variation — enabling early corrective action before defects occur.

Types of Process Variation

  • Common cause variation – natural, expected fluctuations from minor, uncontrollable factors. Low magnitude, always present.
  • Special cause variation – unusual, large disturbances from specific issues (equipment failure, human error, environmental change). Indicates a process out of control.
flowchart LR
  A[Process variation] --> B[Common cause: natural, low magnitude]
  A --> C[Special cause: assignable, high magnitude]
  B --> D[Process stable (in control)]
  C --> E[Process unstable (out of control) – investigate]

SPC provides tools to differentiate these two types and maintain process stability.

Key SPC Tools

Control charts are the most essential; also used: histograms, Pareto charts, process capability analysis. This section focuses on control charts (also called Shewhart charts, after Walter A. Shewhart, 1920s).


Control Charts: Structure & Purpose

A control chart is a graphical tool that tracks a process metric over time. Every control chart has three components:

ComponentDescription
Central line (CL)The average or expected value of the process
Upper control limit (UCL)Upper bound of acceptable variation
Lower control limit (LCL)Lower bound of acceptable variation
Data pointsActual observations plotted over time

A process is stable (in control) when all points fall within the control limits and show no unusual patterns. Any point outside the limits, or a systematic trend, signals a special cause that requires investigation.

Worked Example: Email Response Time

A company monitors daily average response time (minutes) for 15 days.

Day12345131415
Time121514????>22
  • Mean response time = 16 minutes → central line at 16.
  • Initially, UCL = 22, LCL = 10 (chosen subjectively as ±6 minutes).

Points on day 13 touch the limit; day 15 exceeds the UCL. Also an increasing trend from day 1 to day 15. This suggests a special cause (e.g., increased queries, system downtime, staffing issues) → investigate and correct.


Setting Control Limits: The Empirical Rule

Subjective limits are not ideal. A rigorous, data-driven approach uses confidence intervals based on the normal distribution. The standard rule:

UCL=μ+3σLCL=μ3σ\text{UCL} = \mu + 3\sigma \qquad \text{LCL} = \mu - 3\sigma

where μ\mu is the process mean and σ\sigma the process standard deviation.

Why ±3σ? The Empirical Rule

For normally distributed data:

  • 68%\approx 68\% of observations lie within μ±1σ\mu \pm 1\sigma
  • 95%\approx 95\% within μ±2σ\mu \pm 2\sigma
  • 99.7%\approx 99.7\% within μ±3σ\mu \pm 3\sigma

Thus, only 0.3% of points fall outside ±3σ under common-cause variation. A point beyond ±3σ is strong evidence of a special cause.

Re‑evaluating the Example

The response‑time data had μ=16\mu = 16, σ=3.1\sigma = 3.1. Using ±3σ:

UCL=16+3(3.1)=25.3LCL=163(3.1)=6.7\text{UCL} = 16 + 3(3.1) = 25.3 \quad \text{LCL} = 16 - 3(3.1) = 6.7

All 15 observations now fall within these wider limits. The process appears in control under the ±3σ rule (no points outside). This demonstrates how changing the limit rule changes the diagnosis.

Exam tip: The ±3σ rule is the most common control‑limit choice. Always check whether limits are given as subjective values or computed from the data.


Six Sigma: A Stricter Standard

Six Sigma is a methodology for reducing defects and variability. In SPC, it extends the control‑limit concept to ±6σ from the mean.

For a perfectly normal process:

  • 99.99966%99.99966\% of points lie within μ±6σ\mu \pm 6\sigma
  • Only 0.00034%0.00034\% fall outside → 3.4 defects per million opportunities

This extremely low defect rate is the Six Sigma target. If a point falls outside ±6σ, it almost certainly indicates a special cause.

Rule% within limitsDefects per million (approx.)
±3σ99.73%2700
±6σ99.99966%3.4

Six Sigma is widely adopted in manufacturing, healthcare, and finance to maintain high quality through continuous monitoring and improvement.


Key Takeaways

  • SPC distinguishes common cause (normal) from special cause (assignable) variation.
  • Control charts (Shewhart charts) plot process data over time with a central line and two control limits (UCL, LCL).
  • The standard data‑driven limit is μ±3σ\mu \pm 3\sigma, based on the empirical rule (99.7% coverage).
  • Points outside ±3σ signal a special cause → investigate.
  • Six Sigma uses μ±6σ\mu \pm 6\sigma limits, aiming for only 3.4 defects per million.
  • Control charts enable early detection of process shifts, trends, and outliers, supporting proactive quality management.

Statistical Process Control – Control Charts

Statistical process control (SPC) is a methodology for monitoring, controlling, and improving production processes. The most widely used SPC tool is the control chart – a visual, time‑ordered display of process variation that flags when a process is drifting outside acceptable limits and corrective action is needed.

Four common types are covered: X‑bar chart, R chart, P chart, and NP chart. Each is designed for a specific data type and monitoring purpose.


X‑bar and R Charts (Mean and Range Charts)

Intuition: When the process output is a continuous measurement (weight, length, temperature), we care about both the average level and the spread. The X‑bar chart tracks the mean; the R chart tracks the range (max – min) within each sample. Together they detect shifts in location (e.g., machine calibration drift) and changes in variability (e.g., tool wear).

Use case: Continuous variables – e.g., weight of tablets, length of metal rods, fuel efficiency, time to complete a job.

Two charts in one:

  • X‑bar chart – monitors the process mean over time. Centre line = overall mean xˉˉ\bar{\bar{x}}. Upper and lower control limits (UCL, LCL) are typically set at ±3σxˉ\pm 3\sigma_{\bar{x}} (or using factor A2A_2 times average range).
  • R chart – monitors process variability. Centre line = average range Rˉ\bar{R}. Limits use factors D3D_3 and D4D_4 (or equivalent).

Worked Example – Pharmaceutical Tablet Weight

A company produces tablets of target weight 500 mg. Every hour a sample of 5 tablets is weighed for 10 hours.

SampleTablet 1Tablet 2Tablet 3Tablet 4Tablet 5Sample Mean xˉ\bar{x}Range RR
1–10

Computed overall mean: xˉˉ=500.2\bar{\bar{x}} = 500.2 mg
Average range: Rˉ=0.91\bar{R} = 0.91 mg
Standard deviation of sample means: σxˉ=0.39\sigma_{\bar{x}} = 0.39 mg

Using ±3σ limits (stated as “6‑sigma limits”):

  • UCL = 500.2+0.5=500.7500.2 + 0.5 = 500.7 mg
  • LCL = 500.20.5=499.7500.2 - 0.5 = 499.7 mg

All sample means fall inside these limits → process mean is stable.

Similarly, the R chart with centre line 0.91 mg shows all ranges within control limits → variability is stable.

Interpretation: If an X‑bar point exceeds UCL/LCL → possible calibration issue or ingredient mixing error. If an R point rises → increasing variability (e.g., dull cutting tool, inconsistent mixing).

Key takeaways – X‑bar and R charts

  • Used for continuous data; monitor both mean (X‑bar) and spread (R).
  • Centre line for X‑bar = xˉˉ\bar{\bar{x}}; for R = Rˉ\bar{R}.
  • Points outside control limits signal need for investigation.
  • Common in manufacturing, pharma, food processing.

P Chart (Proportion Chart)

Intuition: When quality is measured as pass/fail (attribute data), we monitor the proportion of defective items. The P chart tracks this proportion over time, with control limits that adjust for changing sample sizes.

Use case: Categorical data – pass/fail, complaint/not complaint, defective/acceptable.

  • Centre line = overall proportion pˉ\bar{p}.
  • Upper control limit and lower control limit vary with sample size because the standard error of a proportion depends on nn: Standard error=pˉ(1pˉ)n\text{Standard error} = \sqrt{\frac{\bar{p}(1-\bar{p})}{n}}
  • UCL and LCL are typically pˉ±3×SE\bar{p} \pm 3 \times \text{SE}.

Example – Call Centre Complaints

A call centre records daily customer complaints. Data includes:

DayCallsComplaintsProportion pp
110050.05
5120150.125
69010.011
10110140.127

Because sample size (number of calls) changes each day, the control limits are not constant – they widen when nn is small and narrow when nn is large.

A point above the UCL (e.g., day 5 or 10) signals an unusually high complaint rate that warrants investigation – possible staffing shortage, training gap, or software issue. A point below the LCL (e.g., day 6) might indicate a truly good day or underreporting; both should be examined.

Exam tip: P‑chart limits are variable when sample sizes differ. Do not compare a point to a fixed limit – always check the local UCL/LCL for that sample.

Key takeaways – P chart

  • Used for attribute data (pass/fail, defective/non‑defective).
  • Monitors proportion of defects; limits vary if sample size varies.
  • Points outside limits indicate special‑cause variation.
  • Investigate both high and low outliers (low may be underreporting).

NP Chart (Number of Defectives Chart)

Intuition: When sample size is constant, it is simpler to plot the count of defective items rather than the proportion. The NP chart does exactly that – it tracks the raw number of defects.

Use case: Constant sample size across subgroups.

  • Centre line = average number of defectives npˉn\bar{p}.
  • Control limits: npˉ±3npˉ(1pˉ)n\bar{p} \pm 3\sqrt{n\bar{p}(1-\bar{p})}.

Example: A bakery produces 500 loaves daily and inspects each batch for defects (undercooked, burnt crust). The number of defective loaves is plotted each day. An increasing trend might indicate temperature control problems.

Key takeaways – NP chart

  • Similar to P chart but tracks count of defectives.
  • Requires constant sample size.
  • Simpler to interpret when nn does not change.

Choosing the Right Control Chart

flowchart TD
  A[What type of data?] --> B{Continuous or attribute?}
  B -->|Continuous| C[X‑bar & R charts]
  B -->|Attribute| D{Constant sample size?}
  D -->|Yes| E[NP chart]
  D -->|No| F[P chart]

Summary Comparison

ChartData TypeMonitorsCentre LineLimits
X‑barContinuousProcess meanxˉˉ\bar{\bar{x}}xˉˉ±A2Rˉ\bar{\bar{x}} \pm A_2\bar{R} (or ±3σ)
RContinuousVariability (range)Rˉ\bar{R}D3Rˉ, D4RˉD_3\bar{R},\ D_4\bar{R}
PAttribute (proportion)Proportion defectivepˉ\bar{p}pˉ±3pˉ(1pˉ)/n\bar{p} \pm 3\sqrt{\bar{p}(1-\bar{p}) / n} (vary with nn)
NPAttribute (count)Number defectivenpˉn\bar{p}npˉ±3npˉ(1pˉ)n\bar{p} \pm 3\sqrt{n\bar{p}(1-\bar{p})} (constant nn)

Final Key Takeaways – Control Charts

  • All control charts detect special‑cause variation – deviations from normal process behaviour.
  • X‑bar and R charts handle continuous measurements; P and NP charts handle pass/fail data.
  • Process is in control when all points lie within the limits and no non‑random patterns exist.
  • Early detection of out‑of‑control signals prevents costly defects and ensures customer satisfaction.

Design of Experiments (DOE)

Design of Experiments (DOE) is a structured, systematic approach to determine the relationship between factors (independent variables) and outcomes (dependent variables). Intuitively: instead of changing one thing at a time and hoping for improvement, DOE lets you test many variables simultaneously in a carefully planned way—saving time, money, and guesswork.

Why Use DOE?

BenefitExplanation
Optimize product/process qualityIdentify the best combination of factors (e.g., temperature, pressure, material) that yields fewer defects and higher consistency.
Cost reduction & resource efficiencyFewer trials needed because multiple factors are tested together; savings in materials, labour, and production time.
Improve customer satisfactionOptimise service delivery (e.g., call centre response time, store layouts) by testing variations systematically.
Enhance innovation & product developmentTest new designs or features before launch, reducing risk of product failure and increasing market success.

Key Concepts

  • Factor – an input variable under investigation (e.g., compression force, drying time).
  • Level – a specific setting or category of a factor (e.g., low/medium/high for compression; short/long for drying time).
  • Treatment – a unique combination of factor levels.
  • Balanced design – all treatments are tested with equal sample sizes; gives each combination equal importance.
  • Full factorial experiment – tests every possible combination of all factors.
    • Total treatments = product of levels of each factor:
      Number of treatments=a×b×c×\text{Number of treatments} = a \times b \times c \times \dots
    • Example: 3 levels × 2 levels × 2 levels = 12 treatments.
  • Randomized block design – total number of experimental runs is decided first, then each run is randomly assigned to one of the treatment buckets.

Worked Example 1: Tablet Manufacturing (Pharmaceutical)

A company must ensure tablets dissolve within the required time. Key factors affecting dissolution rate:

FactorLevels
Compression forceLow, Medium, High
Drying timeShort, Long
Ingredient proportionComposition A, Composition B

Full factorial design: 3 × 2 × 2 = 12 treatment combinations. Each treatment is tested (e.g., 10 replicates each) to estimate the effect of each factor and identify the best settings.

Possible outcome: High compression force + long drying time produce the most consistent dissolution rates.

Business impact:

  • Optimized tablet production → fewer defects, better regulatory compliance.
  • Reduced material waste and production time.
  • Avoided quality failures that could lead to recalls or customer dissatisfaction.

Worked Example 2: Email Marketing (Retail)

A retail company wants to increase customer engagement through email campaigns. Factors:

FactorLevels
Subject lineShort, Long
Discount typePercentage off, Fixed amount off
Email layoutImage-heavy, Text-heavy

DOE approach: send different combinations to separate customer subsets, tracking open rates, click-through rates, and conversions.

Possible outcome: short subject line + percentage discount + image-heavy layout yields highest engagement.

Business impact:

  • Data-driven campaign optimization (instead of intuition).
  • Higher ROI on marketing efforts.
  • Improved customer retention through more relevant, engaging content.

Exam tip: Remember the difference between full factorial (all combinations, exhaustive) and randomized block (random assignment to a subset of combinations). Full factorial is thorough but can be expensive; randomized block is more efficient when resources are limited.

Key Takeaways

  • DOE is a structured method to test multiple factors simultaneously, replacing inefficient trial-and-error.
  • Factors (inputs) and levels (settings) define the experimental space; each unique combination is a treatment.
  • Full factorial design tests every combination; the number of treatments equals the product of the factor levels.
  • Balanced designs give equal sample size to each treatment, improving statistical reliability.
  • DOE is used across manufacturing (process optimization) and services (marketing campaigns) to reduce cost, improve quality, and increase customer satisfaction.
Study this interactively — ask questions and quiz yourself — in the study app, or see how it connects across the degree in the concept map.