expectation-methods {coin} | R Documentation

## Extraction of the Expectation, Variance and Covariance of the Linear Statistic

### Description

Methods for extraction of the expectation, variance and covariance of the linear statistic.

### Usage

    ## S4 method for signature 'IndependenceLinearStatistic'
    expectation(object, ...)
    ## S4 method for signature 'IndependenceTest'
    expectation(object, ...)

    ## S4 method for signature 'CovarianceMatrix'
    variance(object, ...)
    ## S4 method for signature 'IndependenceLinearStatistic'
    variance(object, ...)
    ## S4 method for signature 'IndependenceTest'
    variance(object, ...)
    ## S4 method for signature 'Variance'
    variance(object, ...)

    ## S4 method for signature 'CovarianceMatrix'
    covariance(object, ...)
    ## S4 method for signature 'IndependenceLinearStatistic'
    covariance(object, ...)
    ## S4 method for signature 'IndependenceTest'
    covariance(object, ...)

### Arguments

`object` | an object from which the expectation, variance or covariance of the linear statistic can be extracted.
`...` | further arguments (currently ignored).

### Details

The methods `expectation`, `variance` and `covariance` extract the expectation, variance and covariance, respectively, of the linear statistic.

### Value

The expectation, variance or covariance of the linear statistic extracted from `object`. A numeric vector or matrix.

### Examples

    ## Example data
    dta <- data.frame(
        y = gl(3, 2),
        x = sample(gl(3, 2))
    )

    ## Asymptotic Cochran-Mantel-Haenszel Test
    ct <- cmh_test(y ~ x, data = dta)

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

    ## ...and its expectation...
    (El <- expectation(ct))

    ## ...and covariance
    (Vl <- covariance(ct))

    ## The standardized contingency table...
    (l - El) / sqrt(variance(ct))

    ## ...is identical to the standardized linear statistic
    statistic(ct, type = "standardized")

[Package coin version 1.1-2 Index]