.BG
.FN var
.FN cor
.TL
Variance, Covariance, and Correlation
.CS
var(x, y)
cor(x, y, trim=0)
.AG x
matrix or vector.
.AG y
matrix or vector. If omitted, same as `x'.
.AG trim
the proportion trimmed in the internal calculations for `cor'.
.RT
correlations or variances (covariances).
If `x' or `y' is a matrix, the result is a
correlation or covariance matrix; the `[i,j]' element
corresponds to the `i'th column of `x' and the `j'th column
of `y'.
.PP
Variances are sample variances:
.Cs
sum((x-mean(x))^2)/(length(x)-1)
.Ce
Untrimmed correlations are computed from these variances.
Trimmed correlations are computed by the standardized
sums and differences method.
Correlations are computed to single-precision accuracy.
.EX
cor(cbind(longley.x,longley.y))   # correlation matrix for longley data
std.dev <- sqrt(var(x))   # standard deviation of a vector
.KW math
.WR
