Compute Commuter Ride Probabilities
LyftData Scientist · Technical ScreenLast updated
This question tests the ability to apply Bayes' Theorem and marginal probability to model commuter behavior and predict ride-hailing demand based on environmental factors.
Scenario
At a major transit hub, commuters decide between taking a Lyft or using public transit. Historical data indicates that 60% of commuters prefer Lyft. On days with heavy rain, 80% of those who prefer Lyft will request a ride, while only 20% of public transit users will switch to Lyft. On clear days, 30% of Lyft-preferring commuters request a ride, and only 5% of public transit users switch to Lyft. Assume that the probability of a rainy day is 25%.
Task
- Calculate the total probability that a randomly selected commuter will request a Lyft on a given day.
- If a commuter requests a Lyft, what is the probability that it is currently raining?
- Let X be an indicator variable where X=1 if a commuter requests a Lyft and X=0 otherwise. Calculate the expected value E[X] for a randomly selected commuter.
Constraints
- Assume P(Rain) = 0.25, P(Clear) = 0.75.
- P(Lyft_Pref) = 0.60, P(Transit_Pref) = 0.40.
- Provide your answers as decimals rounded to four places.
Example
If 100 people pass through the hub, and the probability of a commuter requesting a Lyft is P(L), the expected number of rides is 100 * P(L). Show the step-by-step breakdown using the Law of Total Probability.
Hints
Hint 1
Define the events clearly: R for Rain, C for Clear, L for Lyft Request, and M for Lyft-preferring commuter.
Hint 2
Use the Law of Total Probability to find P(L) by partitioning the space into (Rain, Lyft-Pref), (Rain, Transit-Pref), (Clear, Lyft-Pref), and (Clear, Transit-Pref).
Hint 3
Apply Bayes' Theorem: P(R|L) = (P(L|R) * P(R)) / P(L), where P(L|R) is the probability of a request given it is raining.
Follow-up questions
- How would the calculation change if we assume the probability of rain is not independent of the number of commuters present?
- If the cost of a Lyft ride increases during rain, how might that introduce a selection bias in our observed data?
- Suppose we want to predict ride volume for the next 24 hours; what other variables besides weather should we incorporate to improve our model's precision?
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.