Explain correlation vs. causation with a software example
This tests your critical thinking about data and ability to avoid logical fallacies. A good answer defines both terms, then gives a software example where a third, confounding variable (like traffic) is the true cause of two correlated metrics.
WHAT THIS TESTS: This question tests your ability to perform rigorous root cause analysis. It's not a statistics quiz; it's about whether you can look at a dashboard with two metrics moving together and correctly identify the underlying driver, rather than jumping to a false conclusion. The interviewer is checking if you can spot and articulate the role of a confounding variable, a core skill for debugging complex systems and interpreting experimental results.
A GOOD ANSWER COVERS: First, provide clear definitions: Correlation is a statistical relationship where two variables tend to move together. Causation is a direct, verifiable link where a change in one variable produces a change in another. Second, state the core principle: correlation is a necessary hint for causation, but it is not sufficient proof. Third, and most importantly, introduce the concept of a confounding variable—a hidden third factor that affects both variables and creates the observed correlation. Finally, tie it all together with a plausible software example.
COMMON WRONG ANSWERS: Giving a generic, non-software example like "ice cream sales and shark attacks" is a classic red flag. While correct, it fails to demonstrate experience with software systems. Another common mistake is correctly stating that two metrics are correlated but not causal, but then failing to identify the specific confounding variable. For example, saying "CPU and memory are correlated" is weak; saying "they are correlated because of rising user traffic" is strong. Simply defining the terms without any example shows a lack of practical application.
LIKELY FOLLOW-UPS: Expect questions like: "How would you design an experiment to prove causation in your example?" (A/B test, canary release). Or, "What statistical techniques can help suggest causality?" (Granger causality, regression with controls). Or, "Describe another pair of correlated metrics from a system you've worked on and identify the confounding variable."
ONE CONCRETE EXAMPLE: In our API gateway, we observed that the P99 latency for endpoint A and the number of database connection timeouts were highly correlated, with a coefficient of +0.9. A junior engineer might assume the slow endpoint was causing the database to time out. However, the root cause was a confounding variable: a large client starting a massive data sync every hour. This sync job flooded endpoint A with requests, increasing its latency. Simultaneously, the high volume of requests exhausted the database connection pool, causing timeouts across the entire system, not just for endpoint A. The client's sync job was the cause; high latency and DB timeouts were two separate effects.
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.