CMH MATH PATH — LESSON 5: LOGISTIC REGRESSION
Predicting Yes/No Events — The Revolution Probability Machine
PART 1: WHY WE NEED A DIFFERENT TOOL
The War Prediction Problem
Let’s say we want to predict: “Will Country X have a civil war next year?”
We try linear regression from Lesson 4:
- X₁ = Poverty rate (%)
- X₂ = Ethnic fractionalization (0-1)
- Y = “War” (0 = No, 1 = Yes)
The Linear Regression Disaster:
We get: Ŷ = -0.8 + 0.05×(Poverty) + 0.6×(Ethnic Fractionalization)
Make a prediction for Country A:
- Poverty = 30%, Ethnic Frac = 0.7
- Ŷ = -0.8 + 0.05×30 + 0.6×0.7 = -0.8 + 1.5 + 0.42 = 1.12
The Problem: What does “1.12” mean for “War: Yes/No”?
- Y=0 means “No war”
- Y=1 means “Yes war”
- But 1.12? “112% war”? Nonsense!
This is why we need logistic regression:
- Predict probabilities (0% to 100%)
- Not arbitrary numbers that can go outside 0-1
PART 2: THE S-CURVE — NATURE’S PROBABILITY MACHINE
The “Tipping Point” Phenomenon
Think about pushing a boulder up a hill:
- At first: Pushing does little (boulder stays put)
- Near top: Small push makes big difference (almost rolls!)
- Past top: Tiny push sends it rolling (definitely goes!)
This is an S-curve (or sigmoid curve):
Probability of War
↑
100% | ┌───┐
| /
50% | ──
| /
0% |────────────┘
+------------------------→ Poverty Rate
(Tipping Point Here!)
Three Key Regions:
- Left flat: Low poverty → Very low war probability (<10%)
- Steep middle: Medium poverty → Small changes, BIG probability jumps!
- Right flat: High poverty → Very high war probability (>90%)
This matches reality!
- Very stable countries rarely collapse
- Very unstable countries often collapse
- Middle countries: Small changes decide fate!
PART 3: FROM LINE TO S-CURVE — THE LOGIT TRANSFORM
Step 1: Predict “Log-Odds” (A Number That Can Be Anything)
Instead of predicting probability directly (0-1), we predict log-odds (-∞ to +∞):
Odds Definition:
Odds = P/(1-P)
(Where P = probability)
Examples:
- P = 0.5 (50%) → Odds = 0.5/0.5 = 1 (“1 to 1”)
- P = 0.75 (75%) → Odds = 0.75/0.25 = 3 (“3 to 1”)
- P = 0.9 (90%) → Odds = 0.9/0.1 = 9 (“9 to 1”)
Log-Odds: Natural log of odds:
- Odds = 1 → log(1) = 0
- Odds = 3 → log(3) = 1.1
- Odds = 0.33 → log(0.33) = -1.1
Key insight: Log-odds can be any number (-∞ to +∞), perfect for linear regression!
Step 2: The Logistic Regression Equation
We do linear regression on log-odds:
log(P/(1-P)) = b₀ + b₁X₁ + b₂X₂ + …
Then transform back to probability:
P = 1 / (1 + e^-(b₀ + b₁X₁ + b₂X₂ + …))
Don’t memorize — just know the computer does this automatically!
PART 4: INTERPRETING LOGISTIC COEFFICIENTS — THE “ODDS RATIO”
The Most Important Concept
In linear regression: b₁ = “For 1-unit increase in X, Y changes by b₁ units”
In logistic regression: e^b₁ = “For 1-unit increase in X, odds multiply by e^b₁”
Example: Civil War Model
Variables:
- X₁ = Youth Unemployment Rate (%)
We get: b₁ = 0.2 for Youth Unemployment
Interpretation:
- e^0.2 = 1.22
- Meaning: Each 1% increase in youth unemployment MULTIPLIES odds of war by 1.22
Concrete example:
- Baseline: YouthUnemp = 20% → Odds of war = 1:9 (10% probability)
- Increase to 21%: New odds = 1:9 × 1.22 = 1.22:9 (≈ 1:7.4 → 11.9% probability)
- Increase to 25%: New odds = 1:9 × (1.22)^5 = 1:9 × 2.7 = 2.7:9 (≈ 1:3.3 → 23% probability)
See the power? Small coefficient (0.2) → Big cumulative effect!
The Three Types of Effects:
1. b > 0 (e^b > 1): Risk factor
- e^b = 1.5 → 1-unit increase in X multiplies odds by 1.5
- Example: Poverty → War risk
2. b < 0 (e^b < 1): Protective factor
- e^b = 0.7 → 1-unit increase in X multiplies odds by 0.7 (reduces!)
- Example: Trust in government → Less war risk
3. b = 0 (e^b = 1): No effect
- e^b = 1 → Odds don’t change
- Example: Maybe “mountainous terrain” has no effect on civil war?
PART 5: HANDS-ON LOGISTIC REGRESSION LAB
Exercise 1: The “Revolution Risk” Calculator (Simplified)
Model:
log(P/(1-P)) = -5 + 0.1×(YouthUnemp) + 0.05×(Poverty) + 0.8×(RecentProtest)
Where:
- YouthUnemp = Youth unemployment rate (%)
- Poverty = Population below poverty line (%)
- RecentProtest = 1 if major protest last year, 0 if not
Calculate probability for Country A:
- YouthUnemp = 25%
- Poverty = 30%
- RecentProtest = 1 (Yes)
Step 1: Calculate log-odds
log-odds = -5 + 0.1×25 + 0.05×30 + 0.8×1
= -5 + 2.5 + 1.5 + 0.8
= -0.2
Step 2: Convert to probability
P = 1 / (1 + e^-(-0.2)) = 1 / (1 + e^0.2) = 1 / (1 + 1.221) = 1/2.221 = 0.45
Interpretation: Country A has 45% chance of revolution next year!
Exercise 2: Spreadsheet Simulation
Step 1: Make up data for 20 “countries”:
Col A: Country ID (1-20)
Col B: YouthUnemp = RANDBETWEEN(10, 50)
Col C: Poverty = RANDBETWEEN(10, 60)
Col D: RecentProtest = RANDBETWEEN(0, 1)
Col E: WarNextYear (we'll make this up logically)
Step 2: Make “WarNextYear” somewhat predictable:
=IF((B2>30)+(C2>40)+(D2=1)>=2, 1, 0)
(If at least 2 risk factors present, war=1, else war=0)
Step 3: Run logistic regression (Google Sheets add-on or Excel Data Analysis)
- Or use online calculator
- Get coefficients b₀, b₁, b₂, b₃
Step 4: Make predictions for new countries
- Use formula: P = 1/(1+exp(-(b₀+b₁×Unemp+b₂×Poverty+b₃×Protest)))
Exercise 3: The “Threshold” Game
Most real decisions use a threshold:
- P > 50% → Predict “War”
- P > 70% → Sound alarm
- P > 90% → Evacuate embassy
Play with thresholds:
- Calculate P for 5 hypothetical countries
- Try threshold = 40%, 50%, 60%
- For each threshold:
- How many predicted wars?
- Check “accuracy” if you knew truth
- Trade-off: Higher threshold = fewer false alarms, but miss more real wars
This is the CMH policymaker’s dilemma!
PART 6: CMH CASE STUDY — PREDICTING REVOLUTIONS
The Goldstone Model (Simplified)
Political scientist Jack Goldstone found key revolution predictors:
Variables:
- Elite Overproduction: Too many educated elites for available jobs
- State Fiscal Crisis: Government running out of money
- Popular Grievances: Mass discontent
- International Pressure: Foreign threats/interference
Logistic model from historical data:
log(P/(1-P)) = -4.3 + 1.2×(EliteOverprod) + 0.8×(FiscalCrisis) + 0.6×(Grievances) + 0.4×(IntlPressure)
Interpret coefficients:
- e^1.2 = 3.32 → Elite overproduction TRIPLES odds of revolution!
- e^0.8 = 2.23 → Fiscal crisis more than DOUBLES odds
- Combined: 3.32 × 2.23 = 7.4 → Both together multiply odds by 7.4×!
Historical test:
- French Revolution (1789): All 4 factors present → P ≈ 85%
- Stable Britain (same era): Only 1 factor → P ≈ 15%
PART 7: BEYOND YES/NO — MULTINOMIAL LOGISTIC REGRESSION
When There Are Multiple Possible Outcomes
Not just “War/Peace” but:
- Regime change type: Democracy, Military rule, Same regime, Civil war
- Election outcome: Party A win, Party B win, Coalition, Crisis
- Crisis resolution: Reform, Repression, Revolution, Collapse
The Idea: Instead of one S-curve, we have multiple comparisons:
- Probability of Democracy vs. Status Quo
- Probability of Military rule vs. Status Quo
- Probability of Civil war vs. Status Quo
CMH Example: Arab Spring Outcomes (2011)
- Tunisia → Democracy (P=60%)
- Egypt → Military rule (P=70%)
- Libya → Civil war (P=80%)
- Saudi Arabia → Status quo (P=90%)
Different factors mattered for each outcome!
PART 8: YOUR CMH LOGISTIC REGRESSION FIELD KIT
Quick Decision Guide
Use Logistic Regression When:
- Predicting categories (Yes/No, Win/Lose, War/Peace)
- Outcome is binary or few categories
- You want probability estimates, not just predictions
- Real-world decision needs risk assessment (40% chance vs. 80% chance)
Use Linear Regression When:
- Predicting continuous numbers (GDP, population, temperature)
- Relationship is roughly linear
- You want to know “how much” not just “if”
The Logistic Regression Report Card
Every logistic model should report:
- Coefficients (b): For interpretation as log-odds
- Odds Ratios (e^b): More intuitive!
- Predicted Probabilities: For example cases
- Classification Table: How good is it at predicting?
- AUC-ROC: Overall predictive power (0.5=random, 0.7=decent, 0.9=excellent)
PART 9: REAL-WORLD APPLICATIONS BEYOND CMH
Everywhere You See Probability Estimates:
- Medicine:
- “Based on your age, weight, symptoms: 30% chance of disease X”
- Treatment decisions based on probability thresholds
- Finance:
- “5% probability of default on this loan”
- Credit scores = logistic regression predictions!
- Marketing:
- “40% chance this customer will buy if shown this ad”
- Target advertising to high-probability customers
- Criminal Justice (Carefully!):
- “Risk scores” for bail decisions
- HUGE ethical concerns! Models can encode bias
The Common Pattern: Never certain, always probabilistic. Better information → better probabilities → better decisions.
PART 10: ETHICAL DANGERS — THE “PREDICTIVE POLICING” TRAP
When Probability Prediction Becomes Oppression
Scenario: Police use logistic regression:
- Predict “probability of violent crime by neighborhood”
- Deploy more officers to high-probability areas
- More officers → More arrests (confirmation!)
- More arrests → Model sees “proof” neighborhood is high-risk
- Feedback loop: Prediction creates reality
The CMH Ethical Rule:
Prediction should inform service, not surveillance. Probability should guide help, not punishment.
Better approach: High predicted unrest probability → Send social workers, job programs, community mediators, not just police.
YOUR MATH HOMEWORK
Exercise 1: Build a “College Admission” Predictor
Hypothetical data on 100 students:
- X₁ = GPA (0-4.0)
- X₂ = SAT score (400-1600)
- X₃ = Extracurriculars (0-10 scale)
- Y = Admitted (1) or Not (0)
Your tasks:
- Make up reasonable data (or find real dataset online)
- Run logistic regression
- Interpret: “Each 0.1 GPA increase multiplies admission odds by _“
- Calculate: Student with GPA=3.5, SAT=1200, EC=7 has what admission probability?
- If college wants to admit ~30%, what probability threshold should they use?
Exercise 2: The “Tipping Point” Analysis
Using the revolution model:
log(P/(1-P)) = -5 + 0.1×(YouthUnemp)
Calculate P for:
- YouthUnemp = 20% → P = ?
- YouthUnemp = 30% → P = ?
- YouthUnemp = 40% → P = ?
- YouthUnemp = 50% → P = ?
Graph it! Notice the S-curve:
- Where is the “tipping point” (steepest part)?
- Why might a government ignore 20→30% rise but panic at 40→50% rise?
- Policy insight: Small interventions before tipping point = huge risk reduction!
Exercise 3: Design a CMH Early Warning System
You’re building a system to predict “Mass Protest Next 6 Months” for 50 countries.
Available monthly data:
- Social media unrest mentions
- Inflation rate
- Youth unemployment
- Previous protest (Y/N)
- Government approval rating
Design questions:
- What would Y variable be? (How define “mass protest”?)
- Which variables as X? Why?
- What probability threshold for “warning”?
- 30%? (Many warnings, some false alarms)
- 60%? (Fewer warnings, miss some events)
- How would you test if system works?
- What ethical safeguards would you build in?
Exercise 4: The “Base Rate” Problem
Scenario: Disease affects 1% of population. Test is 95% accurate.
- If test says “positive”, what’s true probability of disease?
Apply Bayes’ Theorem (related to logistic regression!):
- Prior odds = 1:99 (1% disease)
- Likelihood ratio = 0.95/0.05 = 19 (for positive test)
- Posterior odds = 1:99 × 19 = 19:99 ≈ 1:5.2
- Probability = 1/(1+5.2) = 16%
Even with 95% accurate test, positive result only means 16% chance!
CMH analogy: Even with good model, rare events (revolutions) are hard to predict accurately!
KEY TAKEAWAYS:
- Logistic regression predicts probabilities (0% to 100%) for yes/no events
- Uses S-curve (sigmoid) — flat at ends, steep in middle (tipping points!)
- Coefficients as odds ratios: e^b = “multiplies odds by this much”
- Essential for CMH: Revolutions, wars, elections are yes/no events
- Threshold decisions: Choose probability cutoff based on costs of errors
- Ethical dangers: Predictive systems can create self-fulfilling prophecies
The CMH Mantra:
“Linear regression predicts how much rain will fall.
Logistic regression predicts the chance it will rain at all.
In human affairs, the yes/no questions matter most:
War or peace? Revolution or stability? Collapse or resilience?
But remember: a 30% chance is not a prediction of what WILL happen,
it’s a warning of what COULD happen — and therefore what we should prepare for.”
NEXT LESSON PREVIEW:
Lesson 6: Time Series Analysis — Predicting the Future from the Past
Where we’ll learn:
- How to find patterns over time (trends, cycles, seasons)
- ARIMA models: The workhorse of time prediction
- How to separate signal from noise in historical data
- Why “momentum” exists in social systems (good times tend to continue, crises tend to cascade)
Thought to Ponder: Logistic regression tells us risk at one moment. But societies have memory — today’s risk depends on yesterday’s events. Time series analysis adds this crucial dimension: history matters. The past doesn’t just suggest the future; in social systems, it actively creates it through momentum, trauma, institutional memory, and cycles…
Remember: In CMH, we’re not fortune tellers. We’re risk assessors. Logistic regression gives us the language of risk — not “there will be a war” but “the risk of war has doubled from 20% to 40%.” This changes everything about how leaders should respond. It’s the difference between panic and preparedness, between overreaction and prudent caution.
