Exclude cases over mean plus 2 times sd
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | * (Q) How can I exclude cases which exceeds mean + 2 *SD ? *(A) Posted to by Raynald Levesque to SPSSX-L 2003/01/29. * Visit my SPSS site at http://pages.infinit.net/rlevesqu/index.htm ***************. * Method 1, add mean and sd to data file then use SELECT IF. ***************. GET FILE='c:\\program files\\spss\\employee data.sav'. SORT CASES BY salary. COMPUTE nobreak=1. AGGREGATE OUTFILE='c:\\temp\\sal.sav' /PRESORTED /BREAK=nobreak /meansal=MEAN(salary) /sdsal=SD(salary). MATCH FILES FILE=* /TABLE='c:\\temp\\sal.sav' /BY=nobreak. SELECT IF (salary< meansal + 2*sdsal). EXECUTE. ***************. * Method 2, find z scores of salary, then keep only values within -2 and 2. ***************. GET FILE='c:\\program files\\spss\\employee data.sav'. DESCRIPTIVES VARIABLES=salary /SAVE /STATISTICS=MEAN STDDEV . SELECT IF ABS(zsalary) < 2. EXECUTE. |
Related pages
...