Hui Jeong(Hailyee) Ha

Human Mobility, Transportation & Spatial Data Science

All Geocomputation lectures

Lecture 7 · Binary logistic regression

Will a student walk or cycle to campus?

We’ll use the campus travel example to practise explaining odds ratios and predicted probabilities.

From the lecture slides

Reading the odds ratio · Slide 27
Reading the odds ratio · Slide 27
Odds and probability in the campus travel example · Slide 18
Odds and probability in the campus travel example · Slide 18
Campus travel model: reading the predictor comparisons · Slide 39
Campus travel model: reading the predictor comparisons · Slide 39

Hi everyone! Probability and odds are easy to mix up. Let’s use the same campus travel question for both. We’ll compare students who live at different distances and practise saying what the odds ratio means.

Decide what a ‘yes’ means

In our 650-student example, walking or cycling is Active, coded 1. Transit and car together are Other, coded 0. With pass status and housing fixed, an extra kilometre gives an estimated odds ratio of about 0.854. How much the probability changes depends on the student’s distance, housing and pass status.

Tell the story of one student or one store

Try comparing students who live 3 km and 8 km away and share the same pass status and housing. We did the same kind of comparison for PetSmart sites and a first-year sales target. In the odds-ratio figure, start by finding 1. Then check whether the intervals cross that line.

In R

Use the displayed campus-travel coefficients to compare two students with the same housing and pass status.

distance_km <- c(3, 8)
has_pass <- 1
shared <- 0
studio <- 0  # Residence is the reference
score <- -0.541 - 0.158 * (distance_km - 5) -
  0.420 * has_pass - 0.161 * shared - 0.485 * studio

plogis(score)   # profile-specific probabilities
exp(-0.158)    # odds ratio for one additional kilometre

For a pass holder living in residence, compare the two predicted probabilities. Then read the single odds ratio as a per-kilometre change in odds.

Key takeaways

  • Name the event, comparison group and unit of change.
  • Use the odds ratio to explain how the odds change. Give a predicted probability for a student with a specific distance, housing type and pass status.