expectation-methods {coin} | R Documentation |
Extracts the conditional expectation and covariance for linear statistics from objects inheriting from "IndependenceTest".
expectation(object, ...) covariance(object, ...) variance(object, ...)
object |
an object inheriting from class
|
... |
further arguments (currently ignored). |
extracts the expectation of the linear
statistic of object
.
extracts the covariance of the linear
statistic of object
.
extracts the variance of the linear
statistic of object
.
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")