🎓 Statistics & Data • Correlation & Regression
100% Client-Side Privacy
Covariance Calculator (Sample & Population)
Computes sample and population covariance quantifying whether two variables increase or decrease together.
Bivariate Linear Modeling Suite
Linear Regression, Correlation & Residuals
Fit ordinary least-squares regression lines, calculate Pearson and Spearman coefficients, examine residuals, and make predictions.
Independent Variable X (Explanatory)7 values
Dependent Variable Y (Response)7 values
Presets:
Ordinary Least Squares Regression Equation
ŷ = 2.225x - 0.4571
Correlation:Very Strong Positive(r = 0.9968)
Pearson r0.9968
R² Explained99.37%
Slope (m)2.225
Sample Covariance10.3833
Fitted Scatter Plot & Residual Errors
Observed Data Point (x_i, y_i) Regression Line ŷ = mx + b Residual (y - ŷ) Predicted Point (x_p, ŷ_p)
Interactive Linear PredictorEvaluate ŷ = 2.225 · (x) - 0.4571
⟹ŷ = 17.3429
Model Diagnostics & Sum of Squares Table
Spearman Rank (r_s)1
Residual Std Error (s_e)0.4194
Slope t-Statistic28.07 (df = 5)
Sum of Squared Errors (SSE)0.8796
Regression SS (SSR)138.6175
Total SS (SST)139.4971
Step-by-Step Mathematical Derivations
1. Dataset Summary Totals:
- N = 7, Mean X (x̄) = 4, Mean Y (ȳ) = 8.4429
- ΣX = 28, ΣY = 59.1, ΣX² = 140, ΣY² = 638.47, ΣXY = 298.7
2. Sum of Squares:
- SS_xx = ΣX² - (ΣX)² / N = 140 - (28)² / 7 = 28
- SS_yy = ΣY² - (ΣY)² / N = 638.47 - (59.1)² / 7 = 139.4971
- SS_xy = ΣXY - (ΣX · ΣY) / N = 298.7 - (28 · 59.1) / 7 = 62.3
3. Slope & Intercept Calculation:
- Slope m = SS_xy / SS_xx = 62.3 / 28 = 2.225
- Intercept b = ȳ - m · x̄ = 8.4429 - (2.225 · 4) = -0.4571
4. Pearson Correlation & R²:
- r = SS_xy / √(SS_xx · SS_yy) = 62.3 / √(28 · 139.4971) = 0.9968
- R² = r² = (0.9968)² = 0.9937 (99.37% of variance explained)
What is Covariance?
Covariance is a measure of the joint variability of two random variables; positive covariance indicates variables tend to move in tandem.
Formula & Step-by-Step Calculation
Cov(X, Y) = Σ [ (x_i - x̄)(y_i - ȳ) ] / (n - 1)
Sum of cross-deviations divided by degrees of freedom.
Worked Step-by-Step Examples
Example 1
Covariance of X: (1, 2, 3) and Y: (2, 4, 6)
Solution: Cov(X, Y) = 2.00
• x̄=2, ȳ=4; Cross products = (-1)(-2) + (0)(0) + (1)(2) = 4; Cov = 4 / (3 - 1) = 2.00
Common Real-World & Academic Use Cases
- ✓ Modern portfolio theory risk diversification
- ✓ Covariance matrix in PCA dimensionality reduction
- ✓ Geostatistical spatial analysis
How to Use the Covariance Calculator (Sample & Population)
1
Enter X & Y Values
Input equal-sized numeric arrays.
2
Read Covariance
Inspect sample covariance and direction.
Frequently Asked Questions
Q: How does covariance differ from correlation?
Covariance depends on the scale of measurement units, while correlation is normalized between -1 and +1.