As I understand, we can get correlation by normalizing covariance using the equation

ρi,j=cov(Xi,Xj)σiσj

where σi=√E[(Xi−μi)2] is the standard deviation of Xi.

My concern is what if the standard deviation equals zero? Is there any condition that guarantees it cannot be zero?

Thanks.

**Answer**

It’s true that, if one of your SD’s is 0, that equation is undefined. However, a better way to think about this is that if one of your SD’s is 0, there is no correlation. In loose conceptual terms, a correlation is telling you about how one variable moves around as the other variable moves around. An SD of 0 implies that variable is not ‘moving around’. You would have to have a vector of a constant, such as `rep(constant, n_times)`

.

**Attribution***Source : Link , Question Author : chepukha , Answer Author : gung – Reinstate Monica*