[R] Question about package coin
Achim.Zeileis at uibk.ac.at
Sun May 30 11:24:06 CEST 2010
On Sat, 29 May 2010, Bryan Keller wrote:
> Anyone know if coin can run a permutation test based on a (user-defined)
> statistic other than the mean difference? The function
> independence_test does the permutation t-test via difference in means.
...by default, that is.
> I'm wondering if it's possible to use independence_test to run a
> permutation test for some other statistic than the difference in means.
> For example, I'd like to run a permutation test using Welch's t instead
> of the difference in means.
> The help for independence_test reveals that "teststat" is an argument
> which allows for specification of standardized scalar test statistic, a
> maximum type statistic, or a quadratic form. I cannot, however, figure
> out if it is possible to specify how the statistic should be calculated
> by, for example, supplying a function.
Have you considered reading the references mentioned in the documentation.
I suggest you start with
vignette("LegoCondInf", package = "coin")
which essentially is the "The American Statistician" paper mentioned in
the help pages.
The general framework is that the user can specify data transformations
for which an independence test is computed. Depending on the data
transformation, this can be a t test, chi-squared test, Wilcoxon test,
Kruskal-Wallis test, and many many more.
Furthermore, note that the null hypothesis is always permutation
invariance. Hence, the Welch test does not fit into this framework because
under the null it assumes same means but with potentially different
variances, which is not invariant with respect to permutations.
Therefore, the default t statistic in independence_test() computes a mean
difference standardized by the one-sample standard deviation (with only a
single mean!). This is neither the pooled two-sample standard deviation
(with two means) that t.test(..., var.equal = TRUE) uses nor the
two-sample standard deviation (with two means and two standard deviations)
of the Welch test.
More information about the R-help