FAQ/kw/means - CBU statistics Wiki

Upload page content

You can upload content for the page named below. If you change the page name, you can also upload content for another page. If the page name is empty, we derive the page name from the file name.

File to load page content from
Page name
Comment
Type the odd characters out in each group: abz2a 125t7 HhHaHh year.s 5433r21 worl3d

location: FAQ / kw / means

The SPSS syntax below computes the raw score means with given mean rank (as outputted by !kwpairs). This may be a more intuitive way of expressing the locations of each group. Run immediately after running !kwpairs as the macro assumes the data has been backed up in a file called input.sav which is created by running !kwpairs.

[COPY AND PASTE BELOW SYNTAX INTO A SPSS SYNTAX WINDOW; SELECT ALL AND RUN; EDIT LAST TWO LINES TO SUBSTITUTE OBSERVED MEAN RANKS]

* input a column of scores (y) and group
* run immediately after using !kwpairs macro
* using the outputted mean ranks as input in
* bottom line below; 
* BACKUP DATA BEFORE RUNNING THIS MACRO
*
* outputs in file called output.sav (located in
* My Documents folder) and in output window
* the raw data value in original data with
* corresponding mean rank obtained by
* interpolation

set errors=none.
set mprint=off.

DEFINE RMEAN (!POS !TOKENS(1)).

get file=input.sav.

COMPUTE MR=!1.

RANK
  VARIABLES=y  (A)   /RANK /PRINT=YES
  /TIES=MEAN .
exe.

SORT CASES BY RY(A).

IF (MR GT RY) LR=MIN(ABS(MR-RY)).
IF (MR LT RY) UR=MIN(ABS(MR-RY)).
EXE.

IF (LR GT 0) IND=1.
IF (UR GT 0) IND=2.
EXE.

aggregate outfile=* 
 /break=IND
 /LRY LY=MAX(RY Y)
 /URY UY=MIN(RY Y).

IF (IND EQ 1) LRYY=LRY.
IF (IND EQ 1) LYY=LY.
IF (IND EQ 2) URYY=URY.
IF (IND EQ 2) UYY=UY.
EXE.

COMPUTE dummy=1.
EXE.

aggregate outfile=* 
 /break=dummy
 /RY1 Y1 RY2 Y2=FIRST(LRYY LYY URYY UYY).

COMPUTE MR=!1.
COMPUTE RMN=Y1 + (Y2-Y1) * (MR-RY1) / (RY2-RY1).
EXE.

aggregate outfile=* 
 /break=dummy
 /LY=FIRST(RMN).

save outfile=output.sav /keep = LY.
exe.

GET FILE=OUTPUT.SAV.

compute mr=!1.

formats all (f11.8).
variable labels mr 'Mean Rank' /ly 'Raw mean' .

report format=list automatic align(center)
  /variables=mr ly
  /title "Raw score mean obtained by interpolation having given mean rank".
         
!ENDDEFINE.

* input a single group mean rank as outputted
* by !kwpairs macro: 
* macro outputs raw data value in original data
* with inputted corresponding mean rank

* substitute the two outputted mean ranks
* for 8.5 and 8.0714 given below

RMEAN 8.5.
RMEAN 8.0714.