算法手册/ 问卷研究/ 排序题分析

排序题分析

计算公式

符号

符号含义
n有效作答份数
m被排对象数
rij第 i 份作答给对象 j 的名次
Rj对象 j 的名次合计
S名次合计与平均名次的离差平方和
Ti第 i 份作答内的结校正项
WKendall's W 一致性系数
χ2与 W 对应的卡方统计量
ptopt对象进入前 t 名的比例

核心公式

公式 (1.1):平均名次与名次合计
\[ \bar R_{j}=\frac{1}{n}\sum_{i=1}^{n}r_{ij},\qquad R_{j}=\sum_{i=1}^{n}r_{ij} \]
公式 (1.2):Kendall's W(含结校正)
\[ W=\frac{12S}{n^{2}(m^{3}-m)-n\sum_{i=1}^{n}T_{i}},\qquad S=\sum_{j=1}^{m}\left(R_{j}-\frac{n(m+1)}{2}\right)^{2},\qquad T_{i}=\sum_{t}(t^{3}-t) \]
公式 (1.3):W 的卡方检验
\[ \chi^{2}=n(m-1)W,\qquad \mathrm{df}=m-1 \]
公式 (1.4):首位率与前 t 名比例
\[ p_{j}^{\mathrm{first}}=\frac{\#\{i:r_{ij}=1\}}{n},\qquad p_{j}^{\mathrm{top}\,t}=\frac{\#\{i:r_{ij}\le t\}}{n} \]

参考文献

  1. Kendall, M. G., & Babington Smith, B. (1939). The problem of m rankings. The Annals of Mathematical Statistics, 10(3), 275–287.
  2. Friedman, M. (1937). The use of ranks to avoid the assumption of normality implicit in the analysis of variance. Journal of the American Statistical Association, 32(200), 675–701.
  3. Siegel, S., & Castellan, N. J. (1988). Nonparametric statistics for the behavioral sciences (2nd ed.). McGraw-Hill.

算法参数

参数取值默认影响
名次方向 名次越小越靠前 / 分数越高越靠前 名次越小越靠前 选择“分数越高越靠前”时按 m+1−x 翻转,平均名次与 W 的方向随之改变。

验证报告

数据与 R 包

数据文件 ranking.csv
样本与变量 N = 60;O1–O5 五个被排对象
R 包 DescTools 0.99.60

提示词

O1–O5 是 60 位受访者对 5 个对象的排序(1 = 最靠前),做排序题分析。

R 代码

library(DescTools)
d <- read.csv("ranking.csv")
m <- as.matrix(d)
cat("n", nrow(m), "m", ncol(m), "\n")
print(colMeans(m), digits = 15)
print(apply(m, 2, median), digits = 15)
print(colMeans(m == 1), digits = 15)
print(colMeans(m <= 2), digits = 15)
print(colMeans(m <= 3), digits = 15)
print(KendallW(t(m), correct = TRUE, test = TRUE))

对比结果

指标SPSSAUR差值
Kendall's W0.58077777780.58077777782.22e−11
χ²139.3866666667139.38666666673.3e−11
自由度440
O1 平均名次1.38333333331.38333333333.33e−11
O5 平均名次4.51666666674.51666666673.33e−11
O1 首位率(%)70.000000000070.00000000000
O5 前二率(%)5.00000000005.00000000000

结论:Kendall's W、χ²、自由度、平均名次、首位率与前二率均与 R 一致,最大差 3e−11。名次按“1 = 最靠前”理解;数据无并列名次,W 的结校正项为 0。

操作手册 问题反馈

引用SPSSAU. 排序题分析:计算公式与参数[EB/OL]. SPSSAU算法手册, 2026-11-20. https://www.spssau.com/algorithm/questionnaire/ranking.html.