expectation-methods {coin} | R Documentation |
Extract the Expectation and Variance / Covariance of Linear Statistics
Description
Extracts the conditional expectation and covariance
for linear statistics from objects inheriting from "IndependenceTest".
Usage
expectation(object, ...)
covariance(object, ...)
variance(object, ...)
Arguments
Methods
- expectation
- extracts the expectation of the linear
statistic of
object
.
- covariance
- extracts the covariance of the linear
statistic of
object
.
- variance
- extracts the variance of the linear
statistic of
object
.
Examples
df <- data.frame(y = gl(3, 2), x = gl(3, 2)[sample(1:6)])
### Cochran-Mantel-Haenzel Test
ct <- cmh_test(y ~ x, data = df)
### the linear statistic, i.e, the contingency table
l <- statistic(ct, type = "linear")
l
### expectation
El <- expectation(ct)
El
### covariance
Vl <- covariance(ct)
Vl
### the standardized contingency table (hard way)
(l - El) / sqrt(variance(ct))
### easy way
statistic(ct, type = "standardized")
[Package
coin version 1.0-3
Index]