lcTest: Log-contrast homogeneity test

View source: R/lcTest.R

lcTestR Documentation

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).

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.

Value

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

See Also

zPatterns, zVarArray, zVarArrayError.

Examples

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))

zCompositions documentation built on Aug. 24, 2023, 1:08 a.m.