我原文附件中的SPSS指令,就是一个自动生成中心化(centered)值的程序。当然,你要懂一点点SPSS指令,才能将其嵌入到你的操作程序中去。
我在上面的例子,为了简单起见,只涉及X和Z两个自变量。如果你有更多的变量(如20个甚至更多),怎么办?不难,只需在原来的Part 2中加上相关变量名,及用上DO REPEAT … END REPEAT的循环即可(以下红字为新加部分):
*Part 2: Create centered scores of X1c-X20c, Z1c-Z20c, and XZ1c-XZ20c.
COMPUTE c=1.
AGG OUT/BREAK c/X1m to X20m=MEAN(X1 to X20)/Z1m to Z20m=MEAN(Z1 to Z20). /*Calculate mean of X1-X20 and Z1-Z20.
DO REPEAT X=X1 to X20/Xc=X1c to X20c/Xm=X1m to X20m/Z=Z1 to Z20/Zc=Z1c to Z20c/Zm=Z1m to Z20m/XZc=XZ1c to XZ20c.
compute Xc=X-Xm. /*Centered X1 to X20.
compute Zc=Z-Zm. /*Centered Z1 to Z20.
compute XZc=Xc*Zc. /*Products of X1c by Z1c to X20c by Z20c.
END REPEAT.