stats: Classical estimates for tables

View source: R/stats.R

statsR Documentation

Classical estimates for tables

Description

Some standard/classical (non-compositional) statistics

Usage

stats(
  x,
  margins = NULL,
  statistics = c("phi", "cramer", "chisq", "yates"),
  maggr = mean
)

Arguments

x

a data.frame, matrix or table

margins

margins

statistics

statistics of interest

maggr

a function for calculating the mean margins of a table, default is the arithmetic mean

Details

statistics ‘phi’ is the values of the table divided by the product of margins. ‘cramer’ normalize these values according to the dimension of the table. ‘chisq’ are the expected values according to Pearson while ‘yates’ according to Yates.

For the maggr function argument, arithmetic means (mean) should be chosen to obtain the classical results. Any other user-provided functions should be take with care since the classical estimations relies on the arithmetic mean.

Value

List containing all statistics

Author(s)

Matthias Templ

References

Egozcue, J.J., Pawlowsky-Glahn, V., Templ, M., Hron, K. (2015) Independence in contingency tables using simplicial geometry. Communications in Statistics - Theory and Methods, 44 (18), 3978–3996.

Examples

data(precipitation) 
tab1 <- indTab(precipitation)
stats(precipitation)
stats(precipitation, statistics = "cramer")
stats(precipitation, statistics = "chisq")
stats(precipitation, statistics = "yates")

## take with care 
## (the provided statistics are not designed for that case):
stats(precipitation, statistics = "chisq", maggr = gmean)

matthias-da/robCompositions documentation built on Jan. 15, 2024, 11:24 p.m.