Mathematics |
Covariance and Correlation Coefficients
The MATLAB statistical capabilities include two functions for the computation of correlation coefficients and covariance.
Function |
Description |
|
Variance of vector - measure of spread or dispersion of sample variable. Covariance of matrix - measure of strength of linear relationships between variables. |
|
Correlation coefficient - normalized measure of linear relationship strength between variables. |
Covariance
cov
returns the variance for a vector of data. The variance of the data in the first column of count
is
For an array of data, cov
calculates the covariance matrix. The variance values for the array columns are arranged along the diagonal of the covariance matrix. The remaining entries reflect the covariance between the columns of the original array. For an m-by-n matrix, the covariance matrix has size n-by-n. For example, the covariance matrix for count
, cov(count)
, is arranged as
Correlation Coefficients
corrcoef
produces a matrix of correlation coefficients for an array of data where each row is an observation and each column is a variable. The correlation coefficient is a normalized measure of the strength of the linear relationship between two variables. Uncorrelated data results in a correlation coefficient of 0; equivalent data sets have a correlation coefficient of 1.
For an m-by-n matrix, the correlation coefficient matrix has size n-by-n. The arrangement of the elements in the correlation coefficient matrix corresponds to the location of the elements in the covariance matrix described above.
Clearly there is a strong linear correlation between the three traffic counts observed at the three locations, as the results are close to 1.
Function Summary | Finite Differences |