Covariance Calculator
Calculate the covariance between two datasets to measure how variables change together. Enter your data as comma-separated values and choose between population or sample covariance.
Sample Covariance:
Cov(X,Y) = Σ[(Xi - X̄)(Yi - Ȳ)] / (n - 1)
Population Covariance:
Cov(X,Y) = Σ[(Xi - μx)(Yi - μy)] / n
Where:
• X̄, Ȳ = sample means
• n = number of data points
Cov(X,Y) = Σ[(Xi - X̄)(Yi - Ȳ)] / (n - 1)
Population Covariance:
Cov(X,Y) = Σ[(Xi - μx)(Yi - μy)] / n
Where:
• X̄, Ȳ = sample means
• n = number of data points
Example: X = [2,4,6], Y = [1,3,5]
X̄ = 4, Ȳ = 3
Deviations: (-2,-2), (0,0), (2,2)
Products: 4, 0, 4
Cov = (4+0+4) / (3-1) = 8/2 = 4
Positive covariance (both increase together)
X̄ = 4, Ȳ = 3
Deviations: (-2,-2), (0,0), (2,2)
Products: 4, 0, 4
Cov = (4+0+4) / (3-1) = 8/2 = 4
Positive covariance (both increase together)
🔗 Related Calculators
📐 Formula
Sample Covariance:
Cov(X,Y) = Σ[(Xi - X̄)(Yi - Ȳ)] / (n - 1)
Population Covariance:
Cov(X,Y) = Σ[(Xi - μx)(Yi - μy)] / n
Where:
• X̄, Ȳ = sample means
• n = number of data points
Cov(X,Y) = Σ[(Xi - X̄)(Yi - Ȳ)] / (n - 1)
Population Covariance:
Cov(X,Y) = Σ[(Xi - μx)(Yi - μy)] / n
Where:
• X̄, Ȳ = sample means
• n = number of data points
📝 Example Calculation
Example: X = [2,4,6], Y = [1,3,5]
X̄ = 4, Ȳ = 3
Deviations: (-2,-2), (0,0), (2,2)
Products: 4, 0, 4
Cov = (4+0+4) / (3-1) = 8/2 = 4
Positive covariance (both increase together)
X̄ = 4, Ȳ = 3
Deviations: (-2,-2), (0,0), (2,2)
Products: 4, 0, 4
Cov = (4+0+4) / (3-1) = 8/2 = 4
Positive covariance (both increase together)