Two Attributes

Top  Previous  Next

Fathom Reference > Fathom Operators, Functions, and Units > Statistics Functions > Two Attributes

All of the following functions take two attributes for arguments. For the linear regression functions, the first argument is the predictor, or independent, variable; the second argument is the response, or dependent, variable.

correlation

Returns the correlation coefficient for two numeric attributes. For example, correlation(stories, height) will return the correlation coefficient for stories and height. This value will be between –1 and +1 and is a measure of how closely the values of one attribute follow those of the other.

covariance

Returns the average of the products of the deviations of each of two attributes from the mean. For example, one use would be to compute covariance(hp, mpg)/variance(hp), which would give the slope of the least-squares regression line for mpg versus hp.

linRegrIntercept

Linear regression intercept. Returns the intercept of the least-squares regression line with the first attribute as a predictor and the second attribute as a response. Example: linRegrIntercept(stories, height) would return the height when there are zero stories according to the least-squares regression fit of the attributes stories and height.

linRegrPredicted

Linear regression predicted. Takes two attribute arguments, the first a predictor attribute and the second a response attribute. For each value of the predictor attribute, this returns the value predicted by a least-squares regression using the two attributes.

Example: linRegrPredicted(horsepower, mpg) could be used as the formula for an attribute that contains the predicted value of mpg for each actual value of horsepower.

linRegrResidual

Linear regression residual. Like linRegrPredicted, this is used as a formula for an attribute.
Example: linRegrResidual(Ht_Husband, Ht_Wife) returns, for each case, the difference between the actual value for Ht_Wife and the predicted value.

linRegrSESlope

Linear regression standard error of the slope. The returned value estimates the width of the distribution of values for slope that would be obtained through repeated sampling from the population from which the predictor and response attributes are drawn.
Example: linRegrSESlope(Ht_Husband, Ht_Wife) returns the standard error of the slope of the regression line that has Ht_Husband as the predictor and Ht_Wife as the response.

linRegrSlope

Linear regression slope. Returns the slope of the least-squares regression line with x as the independent attribute and y as the dependent attribute.

popCovariance

Computes the population mean of the product of the deviations of two random variables from their respective means. An optional filter as a third parameter can limit the computation to certain cases.

rSquared

The square of the correlation coefficient for two attributes. covariance(x, y) represents the proportion of the variation of y that is accounted for by the variation in x. It takes on values between 0 and 1.

sampleCovariance

Computes the sample mean of the product of the deviations of two random variables from their respective means. An optional filter as a third parameter can limit the computation to certain cases.