Learn R Programming

coin (version 0.4-2)

statistic-methods: Extract Test Statistics, Linear Statistics and Standardized Statistics

Description

Extract the test statistic and, possibly multivariate, linear statistics in their raw and standardized form from objects of class IndependenceTest-class.

Usage

statistic(object, type = c("test", "linear", "standardized"), ...)

Arguments

object
an object inheriting from class IndependenceTest-class.
type
either test for test statistic, linear for the unstandardized linear statistic or standardized for the standardized linear statistic.
...
further arguments (currently ignored).

Examples

Run this code
df <- data.frame(y = gl(4, 5), x = gl(5, 4))

### Cochran-Mantel-Haenzel Test
ct <- cmh_test(y ~ x, data = df)

### chisq-type statistics
statistic(ct)

### the linear statistic, i.e, the contingency table
statistic(ct, type = "linear")

### the same
table(df$x, df$y)

### and the standardized contingency table for illustrating
### departures from the null hypothesis of independence of x and y
statistic(ct, type = "standardized")

Run the code above in your browser using DataLab