Two random variablesandare said to be independent when their joint probability (see below) is equal to the product of the probabilities of each:
This means, in terms of conditional probabilities,
that is, the probability ofoccurring is not affected by the occurrence of. This is typically how independence is defined, in verbal terms: the occurrence of one event does not influence the occurrence of the other.
I.I.D. stands for independent and identically distributed, it's a shortening used all over in statistics. IID variables are independent but also distributed in the same way.
The concept is the basic assumptions of many foundational results in statistics.
The joint probability of one or more events is the probability that they happen together. If ,,, ... are the random variables, their joint probability is written as
If the variables are independent, their joint probability reduces to the product of their probabilities: .
If we have the joint probability of two or more random variables, the marginal probability of each is the probability related to that variable and to its own space of events; it expresses the probability of the variable when the value of the other one is not known. It calculated by summing the joint probability over the space of events of the other variable. More specifically, given,
The illustration here (Image by IkamusumeFan (own work, released under CC BY-SA 3.0), via Wikimedia Commons) shows points extracted from a joint probability (the black dots) and the marginal probabilities as well.
Given the random variablesandwith respective meansand , their covariance is defined as
It is a measure of how jointly the two variables vary: a positive covariance means that whengrows,grows as well and a negative covariance means that whengrows,decreases.
The word correlation is measured by a correlation coefficient which exists in several definitions depending on what is exactly measured; it is always a sort of normalised covariance. The correspondent of the covariance itself is Pearson's definition, which defines the correlation coefficient as the covariance normalised by the product of the standard deviations of the two variables:
and it can also be written as
The correlation coefficient has these properties:
It is symmetric:
If the variables are independent, then (but the reverse is not true)
Let's expand on the last point there really. We said that if two random variables are independent, then the correlation coefficient is zero. This is easy to prove as it follows directly from the definition above (also bear in mind Fubini's theorem:
The reverse is not true. Look at this amazing Q&A on Cross Validated for a well explained counter-example.
Correlation says "how much" it happens that whengrows,grows as well. It is not a measure of the slope of the linear relation betweenand. This is greatly illustrated in the figure above (from Wikipedia's page, under CC0 ), which reports sets of data points withandand their correlation coefficient.
In the central figure, because the variance ofis 0, then the correlation is undefined. In the bottom row, the relation between variables is not linear, the correlation does not capture that.