VAR: Variance of a vector of observations, dividing by n rather...

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/VAR.r

Description

This function computes the usual variance but divides by n, not by n-1.

Usage

1
VAR(x)

Arguments

x

Vector of values for which variance is computed

Details

To think of each of n observations weighted by 1/n this function VAR computes squared deviations from the mean and averages them. Thus, the sum of squared deviations is divided by n rather than by n-1, as for the unbiased estimate of the variance.

Value

The value of the variance.

Author(s)

Michael Greenacre

References

Greenacre, M. (2018), Compositional Data Analysis in Practice, Chapman & Hall / CRC.

See Also

LR.VAR, CLOSE

Examples

1
2
3
4
5
6
7
8
data(cups)
cups <- CLOSE(cups)

# variances using base R function var
apply(cups, 2, var)

# variances using easyCODA function VAR
apply(cups, 2, VAR)

easyCODA documentation built on Jan. 15, 2022, 3 a.m.