我用对数,平方根,...但是我的因变量还没有达到正态分布。
然后,我知道Box-Cox变换允许我们找到最佳变换方法,以便实现正态分布,从而应用参数检验,如ANOVA。
有没有人能教我如何在SPSS软件中执行Box-Cox变换?可以通过它的语法来应用吗?
发布于 2018-02-07 00:17:05
在Raynald's SPSS tools website上有一个Box Cox转换语法。这些数据只是举个例子。
我添加了一些简单的语法,以便更容易地看到结果。
* Box-Cox transformation for all 31 values of lambda between -2 to 1
(increments of .1).
* Raynald Levesque 2003/11/08.
* http://www.spsstools.net/en/syntax/syntax-index/compute/box-cox-transformation/
GET FILE="C:\{SPSS user folder}\Employee data.sav".
COMPUTE var1=salary./* salary is a skewed test variable.
VECTOR lam(31) /xl(31).
LOOP idx=1 TO 31.
COMPUTE lam(idx)=-2.1 + idx * .1.
DO IF lam(idx)=0.
COMPUTE xl(idx)=LN(var1).
ELSE.
COMPUTE xl(idx)=(var1**lam(idx) - 1)/lam(idx).
END IF.
END LOOP.
* visual examination of results.
EXAMINE
VARIABLES= salary xl1 to xl31
/PLOT=NPPLOT
/stat descrip.
* numerical examination of results.
FREQUENCIES
/VARIABLES= salary, xl1 to xl31
/FORMAT= NOTABLE
/STATISTICS=SKEWNESS KURTOSIS.在将结果复制到电子表格中之后,数值考试效果最好。
https://stackoverflow.com/questions/47420038
复制相似问题