
Logistic Regression for Binary Outcomes
Logistic regression models the probability of a yes-or-no outcome by keeping predictions between 0 and 1, and reads each coefficient as a change in log odds when other predictors are held fixed.
स्रोत
पूरा पाठ सारांश
A seed either germinates or it does not, and logistic regression is built for exactly this kind of binary outcome. Instead of predicting a label directly, it predicts a probability between 0 and 1. A linear combination of predictors can take any value from very negative to very positive, so it cannot serve as a probability. The logistic function, also called the inverse logit link, squashes that unbounded score into the 0-to-1 range. A score of 0 maps to probability 0.5, large positive scores approach 1, and large negative scores approach 0 without ever crossing either boundary.
Suppose we record, for a hypothetical set of 200 seeds, whether each germinated (1) or not (0), along with a soil moisture reading in consistent units. A fitted model might report an intercept of -1.2 and a moisture coefficient of 0.8 per unit. The intercept is the log odds of germination when moisture is zero, and the coefficient means that each additional unit of moisture raises the log odds by 0.8, holding other included predictors fixed. A positive coefficient therefore points toward higher probability, though the size of that push depends on where on the curve you sit.
Because log odds are hard to read, convert to probabilities. At moisture 2, the linear score is -1.2 + 0.8 times 2 = 0.4, giving odds of about 1.49 and a predicted probability near 0.60. At moisture 3, the score is 1.2, odds about 3.32, and probability near 0.77. At moisture 0, the score is -1.2, odds about 0.30, and probability near 0.23. Students can check each conversion with the formula probability equals odds divided by one plus odds.
The coefficient describes an association within the fitted model, not a causal effect of watering. Change the set of included predictors and the coefficient can shift. A constant change in log odds is also not a constant change in probability. The same 0.8 step moves probability a lot near the middle and very little near the extremes, because the logistic curve flattens at its ends.
Turning a probability into a yes-or-no decision needs a threshold. A common default is 0.5, but that is a choice, not a law. If failing to germinate is costly, a lower threshold may be sensible. The threshold should follow the purpose of the decision, and it should be reported alongside the model so readers know how labels were produced.
In class, give pairs a small table of hypothetical seeds with moisture values and labels. Ask them to compute predicted probabilities, mark them on a number line from 0 to 1, then draw a threshold and sort seeds into predicted germinators and non-germinators. Have each pair tape its number line to the wall and explain one misclassified seed. The visible lines and spoken reasoning show whether students grasp that the model outputs probability and that the cutoff is their own decision.


