If all variables involved are numeric, then by default identity transformations are used only, and the raw bivariate "linear statistic" is simply the sum(W * X) and sum(Z * X). Along with the linear statistic, a covariance matrix is computed that can then be used to either derive a maximally-selected t-type statistic or a quadratic form statistic. The latter is the default.
As a (non-sensical) example consider modeling the bivariate vector of Petal.Length
and Petal.Width
by Sepal.Length
in the iris
data. For simplicity I only show the stump here:
library("partykit")
ct <- ctree(Petal.Length + Petal.Width ~ Sepal.Length,
data = iris, maxdepth = 1)
plot(ct)
The test statistic is:
sctest.constparty(ct, node = 1)
## Sepal.Length
## statistic 1.141729e+02
## p.value 1.613105e-25
The same statistic can be replicated in coin
by:
it <- independence_test(Petal.Length + Petal.Width ~ Sepal.Length,
data = iris, teststat = "quadratic")
it
## Asymptotic General Independence Test
##
## data: Petal.Length, Petal.Width by Sepal.Length
## chi-squared = 114.17, df = 2, p-value < 2.2e-16
The building blocks for the statistic are simply the products:
with(iris, sum(Petal.Length * Sepal.Length))
## [1] 3483.76
with(iris, sum(Petal.Width * Sepal.Length))
## [1] 1128.14
statistic(it, "linear")
## Petal.Length Petal.Width
## 3483.76 1128.14
Thus, these essentially capture the marginal correlation or covariance - but so far without any standardization. For standardization, expecation and covariance can be computed:
expectation(it)
## Petal.Length Petal.Width
## 3293.887 1051.216
covariance(it)
## Petal.Length Petal.Width
## Petal.Length 318.3849 132.37025
## Petal.Width 132.3703 59.36044
And then everything can be combined into a single scalar test statistic using a quadratic form:
(statistic(it, "linear") - expectation(it)) %*%
solve(covariance(it)) %*%
t(statistic(it, "linear") - expectation(it))
## 114.1729
statistic(it)
## [1] 114.1729
See vignette("LegoCondInf", package = "coin")
(or doi:10.1198/000313006X118430) for more details and references.
Show Math As -> TeX Commands
$\endgroup$