Coefficient of linear correlation between two data lists
stats[describe, linearcorrelation](data1, data2)
first statistical list
second statistical list
Important: The stats package has been deprecated. Use the superseding package Statistics instead.
The function linearcorrelation of the subpackage stats[describe, ...] computes the coefficient of linear correlation between two statistical lists.
The linear correlation measures how well a linear function (a straight line) explains the relationship between two data lists. If a straight line is an excellent explanation of the relationship, then the linear correlation coefficient will have a high magnitude. The correlation is positive if an increase in one variable corresponds to an increase in the other, and negative when an increase in one corresponds to a decrease in the other. The range of this function is -1 (high negative correlation) to 0 (no linear correlation) to 1 (high positive linear correlation).
The two data lists must have the same number of observations, with the same weights for each corresponding element.
The coefficient of linear correlation is computed by dividing the covariance by the square root of the product of the variance of the two data lists.
Classes are assumed to be represented by the class mark, for example 10..12 has the value 11.
See stats[describe, covariance] and stats[describe, variance] for the treatment of missing data.
There are other measures of correlation besides the linear correlation. A low value for the coefficient of linear correlation does not imply that the data is not correlated. For example, if the pairs of data describe a circle, the correlation is high with respect to the circle, but low with respect to a straight line.
The command with(stats[describe],linearcorrelation) allows the use of the abbreviated form of this command.
These two sets of data are on an increasing straight line
data1 ≔ 1,2,3
data2 ≔ 3,5,7
These are on a decreasing straight line
data3 ≔ 1,2,3
data4 ≔ 7,5,3
These have low correlation
data5 ≔ 1,2,3,4,5
data6 ≔ 0,5,−6,1,1
Download Help Document