Previous: Single-Variable Statistics, Up: Statistical Operations on Vectors [Contents][Index]
The functions in this section take two arguments, which must be vectors of equal size. The vectors are each flattened in the same way as by the single-variable statistical functions. Given a numeric prefix argument of 1, these functions instead take one object from the stack, which must be an Nx2 matrix of data values. Once again, variable names can be used in place of actual vectors and matrices.
The u C (calc-vector-covariance
) [vcov
] command
computes the sample covariance of two vectors. The covariance
of vectors x and y is the sum of the products of the
differences between the elements of x and the mean of x
times the differences between the corresponding elements of y
and the mean of y, all divided by ‘N-1’. Note that
the variance of a vector is just the covariance of the vector
with itself. Once again, if the inputs are error forms the
errors are used as weight factors. If both x and y
are composed of error forms, the error for a given data point
is taken as the square root of the sum of the squares of the two
input errors.
The I u C (calc-vector-pop-covariance
) [vpcov
]
command computes the population covariance, which is the same as the
sample covariance computed by u C except dividing by ‘N’
instead of ‘N-1’.
The H u C (calc-vector-correlation
) [vcorr
]
command computes the linear correlation coefficient of two vectors.
This is defined by the covariance of the vectors divided by the
product of their standard deviations. (There is no difference
between sample or population statistics here.)
Previous: Single-Variable Statistics, Up: Statistical Operations on Vectors [Contents][Index]