Correlation
Корреляция
Correlation measures how two quantities vary together. It can show whether higher values of one tend to go with higher or lower values of the other, but it cannot tell you whether one causes the other.
Also known as: корреляция и причинность
What correlation tells you
Suppose you record the number of requests and the median response time for each minute. If busier minutes tend to have slower responses, the two measurements are positively correlated. If busier minutes tend to have lower response times, they are negatively correlated. Each pair must describe the same minute: sorting the two columns separately before comparing them would destroy the original pairing.
Choosing a coefficient
Pearson’s correlation measures linear association. It ranges from −1 to +1. A value of +1 means all points lie on an upward-sloping line; −1 means they lie on a downward-sloping line. A value near zero means little linear association, not necessarily little association of any kind. If either variable is constant, Pearson’s correlation is undefined.
Spearman’s rank correlation applies Pearson’s calculation to ranks instead of raw values. It measures whether higher values of one variable tend to go with consistently higher or lower values of the other, even if the relationship curves. For example, a growing workload might increase response times slowly at first and then sharply as a service approaches capacity.
Example: zero correlation, clear dependence
Take x = [-2, -1, 0, 1, 2] and y = [4, 1, 0, 1, 4]. Pearson’s correlation is exactly zero, even though y = x². The negative and positive sides balance out in the calculation. A scatter plot immediately shows the U-shape that the coefficient misses. A plot can also reveal whether a large correlation is driven by just one extreme observation.
Where it helps—and where it doesn't
Analysts use correlation to explore how metrics move together. In machine learning, a correlation matrix can flag features that might carry redundant information. Treat it as a starting point: dropping a feature should depend on what happens to model performance on validation data, not on a fixed correlation cutoff.
Correlation alone cannot answer what would happen if you changed one variable. For example, users who finish a tutorial might return more often because they were already more motivated. Comparing finishers with non-finishers does not isolate the tutorial's effect. A randomized A/B test that offers the tutorial to one group but not the other can estimate the effect of offering it by comparing retention across the assigned groups.
Interview questions
An interviewer might ask whether zero correlation implies independence. In general, no: the squared-value example has zero Pearson correlation and a deterministic relationship. Another common prompt is to interpret a high correlation between two daily metrics. Explain what was paired, check the sample size and the plot, and look for shared trends or seasonality. Two metrics can rise every weekend without either driving the other.