Skip to content
Prev 75638 / 398502 Next

p-values

On Thu, 4 Aug 2005, Peter Ho wrote:

            
Hi Peter,

when I understand the example correctly, the main interest is testing
independence of the judges' ranking and the ice cream brand, where the
judges are interpreted as `blocks' using a chi^2-type statistic based on
the rank sums for each ice cream. In R:

ice <- data.frame(judge = factor(rep(c(1:7),rep(3,7))),
                  variety = factor(c(1,2,4,2,3,5,3,4,6,4,5,7,1,5,6,2,6,7,1,3,7)),
                  rank = c(2,3,1,3,1,2,2,1,3,1,2,3,3,1,2,3,1,2,3,1,2))
library("coin")
it <- independence_test(rank ~ variety | judge, data = ice, teststat = "quadtype")
it

        Asymptotic General Independence Test

data:  rank by
         groups 1, 2, 3, 4, 5, 6, 7
         stratified by judge
T = 12, df = 6, p-value = 0.06197

So without having checked the theory exactly, this looks like being
Dubin's D1 statistic with _asymptotic conditional p-value_ (please have a
look at coin's vignette which explains what happens here).

The Monte-Carlo p-value can now be computed by 99,999 replications:

pvalue(independence_test(rank ~ variety | judge, data = ice,
       teststat = "quadtype", distribution = approximate(B = 99999)))

[1] 0.01778018
99 percent confidence interval:
 0.01672170 0.01888482

which seems to be a little bit smaller than 0.02.

Hope that helps,

Torsten