| statistic-methods {coin} | R Documentation |
Methods for extraction of the test statistic and linear statistic.
## S4 method for signature 'IndependenceLinearStatistic'
statistic(object, type = c("test", "linear", "standardized"), ...)
## S4 method for signature 'IndependenceTest'
statistic(object, type = c("test", "linear", "standardized"), ...)
## S4 method for signature 'IndependenceTestStatistic'
statistic(object, type = c("test", "linear", "standardized"), ...)
object |
an object from which the test statistic or linear statistic can be extracted. |
type |
a character, the type of statistic: either |
... |
further arguments (currently ignored). |
The method statistic extracts the test statistic or the, possibly
multivariate, linear statistic in its unstandardized or standardized form.
The test statistic (type = "test") is returned by default. The
unstandardized or standardized linear statistic is obtained by setting
type to "linear" or "standardized" respectively.
The test statistic or the unstandardized or standardized linear statistic
extracted from object. A numeric vector or matrix.
## Example data
dta <- data.frame(
y = gl(4, 5),
x = gl(5, 4)
)
## Asymptotic Cochran-Mantel-Haenszel Test
ct <- cmh_test(y ~ x, data = dta)
## Test statistic
statistic(ct)
## The unstandardized linear statistic...
statistic(ct, type = "linear")
## ...is identical to the contingency table
xtabs(~ x + y, data = dta)
## Illustrating departures from the null hypothesis of independence using the
## standardized linear statistic
statistic(ct, type = "standardized")