Correlation is when there is a statistical associaton or pattern where two variables change together. It can be modeled by the following equation.
\[
r = \frac{\sum (x_i - \bar{x})(y_i - \bar{y})}
{\sqrt{\sum (x_i - \bar{x})^2 \sum (y_i - \bar{y})^2}}
\] Here,
- \(r\) is the correlation coefficient.
- \(x_i\), \(y_i\) are individual observations.
- \(\bar{x}\), \(\bar{y}\) are the means of the variables.