LR.VAR: Total logratio variance

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

Description

Computation of total (weighted)logratio variance.

Usage

1
LR.VAR(LRdata, row.wt = NA, weight=TRUE, vars=FALSE)

Arguments

LRdata

Matrix of logratios, either a vector or preferably the logratio object resulting from one of the functions ALR, CLR, PLR or LR

row.wt

Optional set of row weights (default: equal weights)

weight

Logical indicating if varying weights are returned(default:TRUE). If FALSE, unweighted (equal) weights are returned. Alternatively a set of positive weights can be specified.

vars

If TRUE, output individual variances as well (default FALSE)

Details

The function LR.VAR computes the sum of the logratio variances provided as input, using the weights in the logratio data object.

Value

LRtotvar

The total logratio variance

LRvars

(optional, if vars=TRUE, the individual logratio variances composing the total)

Author(s)

Michael Greenacre

References

Aitchison, J. (1986), The Statistical Analysis of Compositional Data, Chapman & Hall.
Greenacre, M. (2018), Compositional Data Analysis in Practice, Chapman & Hall / CRC Press.

See Also

LR, ALR, invALR, CLR, invCLR

Examples

1
2
3
4
5
6
7
8
data(cups)
# These give identical total logratio variances (weighted, by default)
LR.VAR(CLR(cups))
LR.VAR(LR(cups))
# Summing over all sets of ALRs gives twice the variance
totvar <- 0
for(j in 1:ncol(cups)) totvar <- totvar + LR.VAR(ALR(cups, denom=j))
totvar/2

Example output

Loading required package: ca
Loading required package: vegan
Loading required package: permute
Loading required package: lattice
This is vegan 2.5-7
Loading required package: ellipse

Attaching package:ellipseThe following object is masked frompackage:graphics:

    pairs

[1] 0.002339335
[1] 0.002339335
[1] 0.002339335

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