皮尔逊与Pairwise.prop.test的矛盾

Contradiction between Pearson and Pairwise.prop.test

我有两个长度相同的向量 ab。向量包含玩游戏的次数。例如,游戏 1 在组 a 中进行了 265350,而在组 b 中进行了 52516

a <- c(265350, 89148, 243182, 208991, 113090, 124698, 146574, 33649, 276435, 9320, 58630, 20139, 26178, 7837, 6405, 399)
b <- c(52516, 42840, 60571, 58355, 46975, 47262, 58197, 42074, 50090, 27198, 45491, 43048, 44512, 27266, 43519, 28766)

我想用皮尔逊卡方检验来检验两个向量之间的独立性。在 R 中输入

chisq.test(a,b)

我得到 p 值 0.2348,这意味着两个向量是独立的(H 为真)。

但是当我 运行 pairwise.prop.test(a,b) 并得到所有成对的 p 值时,几乎所有的 p 值都非常低,这意味着两个向量之间存在成对依赖,但这是相反的到第一个结果。怎么可能 ?

pairwise.prop.test 不适合您的情况。

正如文档中提到的那样:

Calculate pairwise comparisons between pairs of proportions with correction for multiple testing

还有:

x (first argument).
Vector of counts of successes or a matrix with 2 columns giving the counts of successes and failures, respectively.

n (second argument).
Vector of counts of trials; ignored if x is a matrix.

因此,xn 中的成功次数是试验,即 x <=(小于或等于)n 中的每一对。这就是 pairwise.prop.test 用于比例的原因。举个例子,假设抛硬币 1000 次,正面朝上数为 550。x 为 550,n 为 1000。在你的情况下,你没有类似的东西,你只有两组游戏的计数。

检验独立性的正确假设检验是您已经使用过的 chisq.test(a,b),我相信这一点。