A generic function for computing the variance of an object.
variance(x, ...)# S3 method for numeric
variance(x, ...)
# S3 method for matrix
variance(x, ...)
# S3 method for numeric
covariance(x, ...)
An object.
Additional arguments used by methods.
The implementation of variance() for numeric variables coerces the input to
a vector then uses stats::var() to compute the variance. This means that,
unlike stats::var(), if variance() is passed a matrix or a 2-dimensional
array, it will still return the variance (stats::var() returns the
covariance matrix in that case).
variance.distribution(), covariance()