What is Pearson Correlation
Pearson's correlation coefficient (r) quantifies the linear relationship between two variables. It ranges from -1 to +1, where values close to 0 indicate no linear relationship, and values near -1 or +1 indicate a strong negative or positive linear relationship, respectively.
The Pearson correlation is calculated using the formula: r = Cov(X,Y) / (σ_X * σ_Y), where Cov(X,Y) is the covariance between X and Y, and σ_X and σ_Y are the standard deviations of X and Y.
Covariance Ellipse
The covariance ellipse provides a visual representation of the spread and orientation of data points in a 2D scatter plot. It is derived from the covariance matrix, which captures both the variances (spread) along each axis and the covariance between the two variables.
The eigen-decomposition of the covariance matrix yields principal components that define the axes of the ellipse, indicating the directions of maximum variance in the data.
Least-Squares Fit Line
The least-squares fit line is a linear regression model that minimizes the sum of squared differences between observed and predicted values. This line best represents the trend in the data, providing a clear visual indication of the relationship strength and direction.
Mathematically, it can be described by the equation: y = mx + b, where m (the slope) is calculated as Cov(X,Y) / Var(X), and b (the intercept) is found using the mean values of X and Y.
Why It Matters
Understanding Pearson correlation and covariance ellipses is crucial in fields such as finance, biology, social sciences, and engineering for analyzing relationships between variables. These tools help in making informed decisions based on data-driven insights.
By visualizing these concepts interactively, one can gain a deeper understanding of how sample size, spread, and target correlation strength influence the statistical measures and their interpretations.
Frequently asked questions
What does the covariance ellipse represent?
The covariance ellipse represents the joint variability of two variables in a 2D scatter plot. Its shape and orientation reflect the spread and correlation between the variables, with axes corresponding to principal components.
How is the least-squares fit line calculated?
The least-squares fit line is calculated using linear regression techniques. It minimizes the sum of squared residuals (differences between observed and predicted values) and can be derived from the covariance matrix to find the best-fitting straight line through the data points.
Why does the Pearson correlation coefficient range from -1 to +1?
The range [-1, 1] of the Pearson correlation coefficient is due to its mathematical definition as a ratio involving variances and covariance. This ensures that it always falls within this interval, reflecting the strength and direction of the linear relationship.
How does sample size affect the Pearson correlation?
Sample size can influence the reliability and stability of the Pearson correlation coefficient. Larger samples generally provide more accurate estimates, but even with small samples, strong correlations can be observed if the underlying relationship is clear and consistent.
Try it live
Everything above runs in your browser — open Pearson Correlation & Covariance Ellipse Explorer (2D) and change the parameters while it is running. Nothing is installed, nothing is uploaded, the whole model lives in one tab.
▶ Open Pearson Correlation & Covariance Ellipse Explorer (2D) simulation