stats | R Documentation |
Some standard/classical (non-compositional) statistics
stats(
x,
margins = NULL,
statistics = c("phi", "cramer", "chisq", "yates"),
maggr = mean
)
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 |
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.
List containing all statistics
Matthias Templ
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.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.