# if covariance is -150, what is the type of relationship between two variables?

The covariance of of two variables has been calculated to be -150. what does the statistics telling about the relationship between two variables ?

• Covariances are not unit free, so the raw numerical value doesn't convey meaning on its own. Aside from the fact that it's less that 0, there's not much to be said. Jul 27, 2017 at 9:56
• My variable has a mean of $317$. Is it large or small?
– whuber
Jul 27, 2017 at 15:06

To add to Łukasz Deryło's answer: as he writes, a covariance of -150 implies a negative relationship. Whether this is a strong relationship or a weak one depends on the variables' variances. Below I plot examples for a strong relationship (each separate variable has a variance of 200, so the covariance is large, in absolute terms, compared to the variance), and for a weak relationship (each variance is 2000, so the covariance is small, in absolute terms, compared to the variance).

## R code:

library(MASS)

nn <- 100
epsilon <- 0.1
variance <- 2000 # weak relationship

opar <- par(mfrow=c(2,2))
for ( ii in 1:4 ) {
while ( TRUE ) {
dataset <- mvrnorm(n=100,mu=c(0,0),Sigma=rbind(c(2000,-150),c(-150,2000)))
if ( abs(cov(dataset)[1,2]-(-150)) < epsilon ) break
}
plot(dataset,pch=19,xlab="",ylab="",main=paste("Covariance:",cov(dataset)[1,2]))
}
par(opar)


## EDIT: Anscombe's quartet

As whuber notes, the covariance in itself doesn't really tell us a lot about a dataset. To illustrate, I'll take Anscombe's quartet and modify it slightly. Note how very different scatterplots can all have the same (rounded) covariance of -150:

anscombe.mod <- anscombe
anscombe.mod[,c("x1","x2","x3","x4")] <- sqrt(150/5.5)*anscombe[,c("x1","x2","x3","x4")]
anscombe.mod[,c("y1","y2","y3","y4")] <- -sqrt(150/5.5)*anscombe[,c("y1","y2","y3","y4")]
opar <- par(mfrow=c(2,2))
with(anscombe.mod,plot(x1,y1,pch=19,main=paste("Covariance:",round(cov(x1,y1),0))))
with(anscombe.mod,plot(x2,y2,pch=19,main=paste("Covariance:",round(cov(x2,y2),0))))
with(anscombe.mod,plot(x3,y3,pch=19,main=paste("Covariance:",round(cov(x3,y3),0))))
with(anscombe.mod,plot(x4,y4,pch=19,main=paste("Covariance:",round(cov(x4,y4),0))))
par(opar)


## FINAL EDIT (I promise!)

Finally, here is a covariance of -150 with perhaps the most tenuous "negative relationship" between $x$ and $y$ imaginable:

xx <- yy <- seq(0,100,by=10)
yy[9] <- -336.7
plot(xx,yy,pch=19,main=paste("Covariance:",cov(xx,yy)))

• It's nice to see the plots. Two suggestions: (1) show a wider range of possible behavior. Since the covariance tells us absolutely nothing about the overall relationship, you can illustrate that by throwing in one influential outlier to illustrate how the relationship can be strongly and consistently positive, yet the covariance can be negative. (2) Be more efficient: after generating sample data, simply rescale them to achieve the desired covariance. This obviates repeated data generation until a threshold is met; it assures an exact value; and it shows how little meaning "-150" holds.
– whuber
Jul 27, 2017 at 15:22
• @whuber: I'll be honest - I was too dumb to figure out how to change a given dataset to achieve a given covariance. Googling and searching on CV didn't help, so in the end I went with the brute force rejection sampling. I'm a bit frustrated with myself; any hints would be appreciated. Jul 27, 2017 at 16:08
• Just something do add is, have you seen Datasaurus Dozen ? Is an even more exaggerated version of the Anscombe's quartet published earlier this year. You can find the original online publication here Jul 27, 2017 at 19:01
• I, for one, think of you as the opposite of "dumb" and I would be pleased to indicate one method. You can scale either or both of $x$ and $y$. To do so symmetrically, generate $x,y$ data. Let their computed covariance be $v$. Define the "scale" to be $s = \sqrt{|-150/v|}$ and the "sign" $u$ be $-1$ when $-150/v\lt 0$, $1$ otherwise. The data $(sx, usy)$ (which will preserve the order of the $x$ and maybe reverse the $y$) have covariance $-150$ because $$\operatorname{Cov}(sx, usy)=s(us)\operatorname{Cov}(x,y)=us^2 v = \pm u \left(\frac{-150}{v}\right)v = -150.$$(+1 for the edits, btw.)
– whuber
Jul 27, 2017 at 19:07
• @Guilherme In an answer at stats.stackexchange.com/a/152034/919 I went beyond all of that by providing software that will produce such examples at will merely by specifying the properties you want them to have. As an example I used the code to reproduce Anscombe's Quartet.
– whuber
Jul 27, 2017 at 19:11

It tells you only that relationship is negative. This means that low values of one variable tend to occur together with high values of the other.

It is hard to tell if this covariance is big or small (if your relationship is strong or weak) because $cov(X,Y)$ ranges from $-sd(X)\cdot sd(Y)$ to $sd(X)\cdot sd(Y)$. So it depends on the scale of your variables.

To judge if this relationship is strong or not, you need to convert covariance to correlation (divide it by $sd(X)\cdot sd(Y)$). This ranges from $-1$ to $1$ and many different guidelines for interpretation can be found in the Web and textbooks.

You can run test for significance of correlation too.

• This interpretation, although common, confuses means with general tendencies. The covariance could easily be negative even when the vast majority of data follow a positive relationship.
– whuber
Jul 27, 2017 at 15:07
• Wikipedia: Pearson correlation coefficient
– Paul
Jul 28, 2017 at 1:06