variance {distributional} | R Documentation |
Variance
Description
A generic function for computing the variance of an object.
Usage
variance(x, ...)
## S3 method for class 'numeric'
variance(x, ...)
## S3 method for class 'matrix'
variance(x, ...)
## S3 method for class 'numeric'
covariance(x, ...)
Arguments
x |
An object. |
... |
Additional arguments used by methods. |
Details
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).
See Also
variance.distribution()
, covariance()
[Package distributional version 0.4.0 Index]