1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
* Box-Cox transformation for all 31 values of lambda between -2 to 1 (increments of .1).
* Raynald Levesque 2003/11/08.

GET FILE='c:\\program files\\spss\\employee data.sav'.
COMPUTE var1=salary.

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.
EXECUTE.