zVarArray {zCompositions} | R Documentation |
Variation array for grouped data
Description
This function returns overall and separate variation arrays for groups 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
zVarArray(X, label = 0, groups = NULL, suppress.print = FALSE)
Arguments
X |
Compositional data set ( |
label |
Unique label ( |
groups |
Grouping factor in fully observed zero-free data sets ( |
suppress.print |
Suppress printed feedback ( |
Details
This function is mainly aimed to investigate heterogeneous relative variation structures in compositional data sets containing zeros or unobserved values. For each pattern of zero or unobserved values, log-ratio variances (upper triangle of variation matrix) and means (lower triangle of variation matrix) are computed from the available data. Note that (1) NAs are produced for log-ratio variances and means in groups containing less than two observations, and (2) at least two components must be available in each group to compute log-ratios.
The overall estimate is obtained across groups by pairwise deletion. Note that, unlike the ordinary var
function, maximum likelihood estimates of the variances are computed. That is,
the observed sum of squares is divided by the corresponding number of observations n and not by n-1.
Group-wise variation arrays can be obtained from fully observed zero-free data by setting a grouping factor
using the argument groups
.
Value
List of variation arrays by pattern/group and overall.
See Also
Examples
data(Water)
zPatterns(Water, label = 0)
zVarArray(Water)
# 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
zVarArray(Water_multKM,groups=rep(c("A","B"),each=50))