Explain the difference between correlation and causation
Tests if you can avoid statistical fallacies. First, define correlation (association) and causation (cause-effect). Then, explain the difference via a confounding variable. A red flag is giving an example where one metric actually could cause the other.
WHAT THIS TESTS: This question tests your practical judgment and scientific rigor. The interviewer wants to know if you can be trusted with a metrics dashboard. Can you distinguish a real signal from noise? Will you avoid wasting engineering cycles by chasing spurious correlations, or will you correctly identify the need for controlled experiments to find the true root cause of a problem? It's about your ability to make sound, data-informed decisions, not just recite statistical definitions.
A GOOD ANSWER COVERS: A strong answer walks through four key points in order. First, define correlation as a statistical relationship where two variables move together, either positively or negatively. Second, define causation as a much stronger claim where a change in one variable is directly responsible for producing a change in another. Third, explain the gap between them, which is often a third, unobserved confounding variable that is the true cause of the changes in both correlated variables. This is the logical fallacy known as 'cum hoc ergo propter hoc'. Fourth, provide a clear, unambiguous software example.
COMMON WRONG ANSWERS: The most common mistake is giving a textbook, non-software example like ice cream sales and shark attacks. While correct, it fails to demonstrate that you can apply the concept to your work. Another red flag is providing a weak software example where causation is plausible. For instance, saying high CPU and high memory usage are correlated. While often linked by a common cause like high traffic, it's also plausible that a memory leak could cause GC thrashing, leading to high CPU. This ambiguity weakens your answer. The worst answer is simply stating "correlation does not imply causation" and stopping, which demonstrates awareness but not understanding.
LIKELY FOLLOW-UPS: Expect follow-up questions like: "How would you design an experiment to prove causation in your example?" (A/B test, controlled rollout). "Tell me about a time you investigated a correlation that turned out to be spurious. What was the impact?" Or, "What statistical techniques can help suggest, but not prove, causation?" (e.g., Granger causality, regression with control variables).
ONE CONCRETE EXAMPLE: During a flash sale on our e-commerce platform, we observe that p99 API latency (Metric A) increases from 200ms to 3,000ms. At the same time, the checkout failure rate (Metric B) increases from 0.5% to 8%. Metric A and Metric B are highly correlated. However, the increased latency is not causing the checkouts to fail. The true cause is a massive surge in user traffic (the confounding variable C). This traffic surge is simultaneously overwhelming the web servers, causing latency, and overloading the database, causing transaction timeouts during checkout. The two metrics are effects of the same cause.
Read the original → en.wikipedia.org
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.