|
From: | ftr public |
Subject: | Box-cox transformation |
Date: | Mon, 15 Jan 2018 17:18:06 +0100 |
User-agent: | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 |
Hello, I did not find a function that produces a Box-Cox transformation in PSPP. On Raynald's SPSS macro pages a SPSS macro with syntax has been published is published that does the job. * 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. I used the Box-Cox transformation macro which produces a series of values for the variable to be transformed called xl for values of lambda above -2.1. The original variables in the test data set, salary, shows a skew of 2.12 and a kurtosis of above 5. After having run the macro I don't see how to continue. How to decide which is the best lambda value and thus, the best transformation? I did a frequency of all transformed xl variables to find the transformed , i.e. xl, variable with the skew and kurtosis the closest to 0. I also tried to visually find the best transformation. FREQUENCIES xl1 to xl31 /FORMAT= NOTABLE /STATISTICS=SKEWNESS KURTOSIS. EXAMINE VARIABLES= xl1 to xl31 /PLOT= NPPLOT. Are these the appropriate ways ? In my view the results show that xl10 and xl11 show a good combination of skew and kurtosis and are together close to 0. My questions: 1/ Are there other ways in PSPP to run a box-cox transformation ? 2/ Which is the best way to find the best transformation ? If not what do you recommend how to decide about the appropriate transformed variable ? Thanks in advance, ftr |
[Prev in Thread] | Current Thread | [Next in Thread] |