4.5 Patterns, trends and relationships
Pearson and Spearman correlation, rolling means and changing trends.
Key points
Correlation measures how two variables move together. Causation needs more evidence, such as a controlled experiment.
What NVIDIA says (2)
“pearson : Standard correlation coefficient spearman : Spearman rank correlation”
“However, it’s important to remember that correlation and causation are two different things.”
Monotonic means one variable tends to rise when the other rises, not always at the same rate. Spearman uses ranks, so it captures that without assuming a line.
What NVIDIA says (1)
“Method used to compute correlation: pearson : Standard correlation coefficient spearman : Spearman rank correlation”
A trend is the long-run direction of a series. A rolling window averages nearby values to smooth out noise.
What NVIDIA says (1)
“Parameters : window int, offset or a BaseIndexer subclass Size of the window, i.e., the number of observations used to calculate the statistic.”
A linear model assumes a straight-line relationship. When the pattern curves, a nonlinear model can describe it better.
What NVIDIA says (2)
“While there is a strong relationship between population and time, the relationship is not linear because various factors influence changes from year to year.”
“Nonlinear regression can estimate models with arbitrary relationships between independent and dependent variables.”
Key terms
- Correlation: A measure of how two variables move together; it does not prove cause.
- Rolling mean: The average over a sliding window of recent rows, used to smooth noise.
Sample question
Two columns have a strong Pearson correlation. What can you conclude?
Show the answer
Answer: They move together linearly, but correlation alone does not show that one causes the other
Correlation measures how two variables move together. Causation needs more evidence, such as a controlled experiment.
What NVIDIA says (2)
“pearson : Standard correlation coefficient spearman : Spearman rank correlation”
“However, it’s important to remember that correlation and causation are two different things.”
Practice 4.5 (4 questions) Full Descriptive Analysis and Visualization guide
← 4.4 Hypothesis testing and significance · 5.1 Python for data analysis →