Learn R Programming

zCompositions (version 1.3.4)

lcTest: Log-contrast homogeneity test

Description

This function tests for homogeneity across groups of means and variances of user-defined log-contrasts. Groups can be defined by either zero/unobserved data patterns or by a grouping factor in fully observed zero-free data sets.

Usage

lcTest(X, label = 0, groups = NULL, lc = NULL, method = c("parametric",
  "nonparametric"), b = 1000)

Arguments

X

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

label

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

groups

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

lc

User-defined log-contrast (see details below).

method

Approach used for mean and variance homogeneity testing (method = "parametric", default).

b

Number of bootstrap resamples used by permutation test (b = 1000, default).

Value

Test p-values for log-contrast means and variances.

Details

Homogeneity of log-contrast means and variances across groups is tested using either parametric or non-parametric tests. When method = "parametric", ordinary analysis of variance and Bartlett's tests are used. Alternatively, Kruskal-Wallis and Fligner-Killen tests are used instead when method = "nonparametric". The results of a permutation test of homogeneity of variation arrays based on total weighted squared relative errors are also provided (see zVarArrayTest for more details). The log-contrast is specified by the lc argument using a vector of codes 1, -1 and 0 for components in the numerator, denominator and omitted respectively.

References

Palarea-Albaladejo J. and Martin-Fernandez JA. zCompositions -- R package for multivariate imputation of left-censored data under a compositional approach. Chemometrics and Intelligence Laboratory Systems 2015; 143: 85-96.

See Also

zPatterns, zVarArray, zVarArrayError

Examples

Run this code
# NOT RUN {
data(Water)
zPatterns(Water, label = 0)

# Test of homogeneity in log-contrast Potassium/Arsenic*Calcium
lcTest(Water, label = 0, lc = c(1,-1,-1,0))
# }

Run the code above in your browser using DataLab