当涉及到自定义表中的 z 检验时,SPSS 对多响应集的处理与分类变量不同。我认为这种行为与响应的重叠有关,但我不知道如何。
那么,当涉及到多响应集(MRsets)时,SPSS 如何进行 z 检验呢?
我的目标是在 R 中为 MRsets 重现 SPSS z-test,但我无法弄清楚 SPSS 实际做了什么。通常,SPSS 自定义表 z-testing 与
prop.test(c(proportion1,proportion2),c(columnSum1,columSum2),"two.sided",correct=F)
但显然,MRsets 是不同的。
为了清楚起见,请看一下这个分类与 MRset 的比较。
Categorical var z-test (C & D 列根据z-test没有区别)
- 分类数据集(无重叠,3623 例):下载数据集
- 分类重叠矩阵(无重叠):
分类 z 检验 SPSS 语法
CTABLES /VLABELS VARIABLES=splitVar catVar DISPLAY=DEFAULT /TABLE splitVar [C][COUNT F40.0] BY catVar [C] /CATEGORIES VARIABLES=splitVar catVar ORDER=A KEY=VALUE EMPTY=EXCLUDE /COMPARETEST TYPE=PROP ALPHA=0.05 ADJUST=NONE ORIGIN=COLUMN INCLUDEMRSETS=NO CATEGORIES=ALLVISIBLE.
C<->D z 测试的 R 再现(第一行):http ://www.r-fiddle.org/#/fiddle?id=p4gw9ftk
"Categorical var z-test" "Doing a proportions test for first row (splitVar=1) and columns C and D" prop.test(c(198,242), c(198+35,242+65), alternative="two.sided", correct=F ) "As we see, there are no significant differences in the proportions on an alpha=0.05 level"
MRset z-test(表中数字相同,但z-test结果不同:C&D列差异显着)
- MRset 数据集(包括重叠,2404 个案例):下载数据集
- MRset重叠矩阵:
- MRset z 测试输出:
MRset z-test SPSS 语法:
CTABLES /VLABELS VARIABLES=splitVar $MySet DISPLAY=DEFAULT /TABLE splitVar [C] BY $MySet [C][COUNT F40.0] /CATEGORIES VARIABLES=splitVar ORDER=A KEY=VALUE EMPTY=EXCLUDE /CATEGORIES VARIABLES=$MySet EMPTY=INCLUDE /COMPARETEST TYPE=PROP ALPHA=0.05 ADJUST=NONE ORIGIN=COLUMN INCLUDEMRSETS=YES CATEGORIES=ALLVISIBLE.
C<->D z 测试的 R 再现(第一行):http ://www.r-fiddle.org/#/fiddle?id=GAhnnrv0
"MRset z-test" "Doing a proportions test for first row (splitVar=1) and columns C and D" overlap_splitvar1_CD <- 53 overlap_splitvar2_CD <- 9 prop.test(c(198-overlap_splitvar1_CD,242-overlap_splitvar1_CD), c(198+35-overlap_splitvar1_CD-overlap_splitvar2_CD,242+65-overlap_splitvar1_CD-overlap_splitvar2_CD), alternative="two.sided", correct=F ) "As we see, there are still no significant differences in the proportions on an alpha=0.05 level. In contrast, SPSS does detect a difference. Why?"
从 MRset R 代码中可以看出,即使是重叠案例的减法也无济于事。也许它与加权或什么有关?非常感谢您的想法。
可能有用的链接:关于权重和多重响应集的说明