statistic-methods

0th

Percentile

Extraction of the Test Statistic and Linear Statistic

Methods for extraction of the test statistic and linear statistic.

Keywords
methods
Usage
# S4 method for IndependenceLinearStatistic
statistic(object, type = c("test", "linear", "centered", "standardized"), …)
# S4 method for IndependenceTestStatistic
statistic(object, type = c("test", "linear", "centered", "standardized"), …)
# S4 method for IndependenceTest
statistic(object, type = c("test", "linear", "centered", "standardized"), …)
Arguments
object

an object from which the test statistic or linear statistic can be extracted.

type

a character, the type of statistic: either "test" (default) for the test statistic, "linear" for the unstandardized linear statistic "centered" for the centered linear statistic or "standardized" for the standardized linear statistic.

further arguments (currently ignored).

Details

The method statistic extracts the test statistic or the, possibly multivariate, linear statistic in its unstandardized, centered or standardized form.

The test statistic (type = "test") is returned by default. The unstandardized, centered or standardized linear statistic is obtained by setting type to "linear", "centered" or "standardized" respectively.

Value

The test statistic or the unstandardized, centered or standardized linear statistic extracted from object. A numeric vector or matrix.

Aliases
  • statistic
  • statistic-methods
  • statistic,IndependenceLinearStatistic-method
  • statistic,IndependenceTestStatistic-method
  • statistic,IndependenceTest-method
Examples
# NOT RUN {
## 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)

## The centered linear statistic...
statistic(ct, type = "centered")

## ...is identical to
statistic(ct, type = "linear") - expectation(ct)

## The standardized linear statistic, illustrating departures from the null
## hypothesis of independence...
statistic(ct, type = "standardized")

## ...is identical to
(statistic(ct, type = "linear") - expectation(ct)) / sqrt(variance(ct))
# }
Documentation reproduced from package coin, version 1.3-1, License: GPL-2

Community examples

Looks like there are no examples yet.