InsightFab
Knowledge Base/Logistic Regression: When Your Y is "Yes" or "No"
DOE8 min read

Logistic Regression: When Your Y is "Yes" or "No"

Linear regression is unsuitable for "yes/no" outputs such as product defects, customer churn, or part pass/fail. Logistic regression is the standard method for handling such binary outcomes, and this article explains its application within manufacturing scenarios.

Scenario

You want to find out which process parameters affect whether welding is defective. Y is "Good / Defective," and X represents temperature, time, and pressure. A colleague suggested using regression, so you built a linear regression model. However, the predicted values came out as 1.3 (over 100%) and -0.2 (negative yield rate) – which is clearly unreasonable.

Problem: Linear regression assumes Y is a continuous variable, but your Y is only 0 or 1.

What is Logistic Regression?

Logistic regression does not predict Y itself, but rather the probability of Y = 1, and this probability is always between 0 and 1.

Core Mathematics:

P(Y=1) = 1 / (1 + e^-(β₀ + β₁X₁ + β₂X₂ + ...))

This S-shaped curve (Sigmoid) ensures the output is always within [0,1].

Interpreting Key Outputs

Odds Ratio

The coefficients of logistic regression are not intuitive to interpret directly and are usually converted into the Odds Ratio (OR):

OR = e^β

Example:

  • Temperature coefficient β = 0.08
  • OR = e^0.08 = 1.083
  • Interpretation: For every 1°C increase in temperature, the probability of defectiveness is 1.083 times the original (an 8.3% increase).

OR ValueInterpretation
> 1As X increases, the probability of Y=1 increases
= 1X has no effect on Y
< 1As X increases, the probability of Y=1 decreases

P-value

Similar to linear regression, P < 0.05 indicates that this X has a significant effect on Y.

Hosmer-Lemeshow Test

Tests the overall goodness-of-fit of the model (similar to the F-test in regression).

P > 0.05: Model fits well

P < 0.05: Model fit is poor; consider adding other variables or interaction terms.

Common Applications in Manufacturing

ScenarioY (1/0)X (Inputs)
Welding YieldDefective/GoodTemperature, Time, Flux
Injection MoldingShrinkage/No ShrinkageInjection Speed, Holding Pressure, Material Temperature
Equipment LifespanFailure/NormalUsage Time, Temperature, Vibration
Supplier EvaluationNon-conforming/ConformingDelivery Time, Unit Price, Historical Defect Rate

Logistic Regression vs. Linear Regression

Linear RegressionLogistic Regression
Type of YContinuous ValueBinary (0/1)
PredictsValue of YProbability of Y=1
Output Range-∞ to +∞0 to 1
Model EvaluationR², RMSEAUC, Confusion Matrix

Decision Threshold

Logistic regression outputs probabilities, so you need to set a threshold for decision-making (usually 0.5):

  • P ≥ 0.5 → Predicted as Defective
  • P < 0.5 → Predicted as Good

The threshold can be adjusted: if the cost of a defective product is very high, it can be lowered to 0.3, preferring more false positives over missing actual defective products.

Golden Quote

"When your question is 'will it or won't it', not 'how much', logistic regression is the correct tool. Using linear regression to predict defectiveness is like using a thermometer to measure weight."

Want to try it yourself?

Every tool mentioned in this article is available on InsightFab — just upload a CSV to analyze.

Go to Tools