zVarArrayError: Variation array relative error

View source: R/zVarArrayError.R

zVarArrayErrorR Documentation

Variation array relative error

Description

This function computes squared relative errors of variation arrays per group with respect to the overall variation array based on observed data in a compositional data set. Groups can be defined by either zero/unobserved data patterns or by a grouping factor in fully observed zero-free data sets.

Usage

zVarArrayError(
  X,
  label = 0,
  groups = NULL,
  breakdown = FALSE,
  suppress.print = FALSE
)

Arguments

X

Compositional data set (matrix or data.frame class).

label

Unique label (numeric or character) used to denote zeros/unobserved data in X (label = 0, default).

groups

Grouping factor in fully observed zero-free data sets (groups = NULL, default).

breakdown

Logical value. Show results broken down by group (breakdown = FALSE, default).

suppress.print

Suppress printed feedback (suppress.print = FALSE, default).

Details

Squared relative errors (SRE) are calculated by confronting variation arrays (log-ratio variances and means) obtained per group and the overall variation array based on observed data. Raw SREs are computed for each available pair-wise log-ratio. The weighted version uses the corresponding group sizes to weight raw SREs. Total SRE is obtained as the sum of weighted SREs for each log-ratio. Further details by group are provided by setting breakdown = TRUE.

Value

1. SRE for each log-ratio variance and mean. 2. Weighted SRE for each log-ratio variance and mean. 3. Total SRE across log-ratio variances and means. 4. Percentage contribution of each log-ratio to SRE in log-ratio variances and means. If breakdown = TRUE: 4. SREs per group. 5. Weighted SREs per group. 6. Percentage contribution of each group to total SRE.

See Also

zPatterns, zVarArray.

Examples

data(Water)
zPatterns(Water, label = 0)
zVarArrayError(Water)
zVarArrayError(Water, breakdown = TRUE)

# From a completed data set

data(mdl) # matrix of limits of detection for Water
Water_multKM <- multKM(Water,label=0,dl=mdl) # nondetects imputation

# Results split by two ficticious groups A and B
zVarArrayError(Water_multKM,groups=rep(c("A","B"),each=50))

Japal/zCompositions documentation built on March 17, 2024, 5:19 p.m.