Diff for "FAQ/box" - CBU statistics Wiki
location: Diff for "FAQ/box"
Differences between revisions 6 and 7
Revision 6 as of 2006-07-27 12:20:12
Size: 3822
Editor: pc0082
Comment:
Revision 7 as of 2006-11-28 14:52:07
Size: 3391
Editor: PeterWatson
Comment:
Deletions are marked like this. Additions are marked like this.
Line 8: Line 8:
Set format f10.5. set format f10.5.
Line 32: Line 32:
* This macro fits a clustered boxplot for a continuous response
* and two categorical variables of upto five levels each.
DEFINE !BOX ( !POS !TOKENS(1)
                     / !POS !TOKENS(1)
                     / !POS !TOKENS(1)
DEFINE !BOX (!POS !TOKENS(1)
Line 53: Line 49:
RANK
  VARIABLES = !2
  /NTILES(!3)
  /PRINT = NO
  /TIES = MEAN .
Line 59: Line 50:
RANK
  VARIABLES = !4
  /NTILES(!5)
  /PRINT = NO
  /TIES = MEAN .
VAR LABELS !1 !4/
                           !2 !5/
                           !3 !6/.
Line 65: Line 54:
VAR LABELS !1 !6/
                           !CONCAT(n,!2) !7/
                           !CONCAT(n,!4) !8/.

VALUE LABELS !CONCAT(n,!2) (1) !9
                                              (2) !10
                                              (3) !11
                                              (4) !12
                                              (5) !13/
                !CONCAT(n,!4) (1) !14
                                              (2) !15
                                              (3) !16
                                              (4) !17
                                              (5) !18/.
IGRAPH /VIEWNAME='Boxplot' /X1 = VAR(!concat(n,!2)) TYPE = CATEGORICAL /Y = VAR(!1)
  TYPE = SCALE /STYLE = VAR(!concat(n,!4)) /COORDINATE = VERTICAL /X1LENGTH=3.0
 /YLENGTH=3.0 /X2LENGTH=3.0 /CHARTLOOK='NONE' /CATORDER VAR(!concat(n,!4)) (ASCENDING
  VALUES OMITEMPTY) /CATORDER VAR(!concat(n,!2)) (ASCENDING VALUES OMITEMPTY) /BOX
VALUE LABELS !2 (1) !7
                                              (2) !8
                                              (3) !9
                                              (4) !10
                                              (5) !11/
                             !3 (1) !12
                                             (2) !13
                                             (3) !14
                                             (4) !15
                                             (5) !16/.
IGRAPH /VIEWNAME='Boxplot' /X1 = VAR(!2) TYPE = CATEGORICAL /Y = VAR(!1)
  TYPE = SCALE /STYLE = VAR(!3) /COORDINATE = VERTICAL /X1LENGTH=3.0
 /YLENGTH=3.0 /X2LENGTH=3.0 /CHARTLOOK='NONE' /CATORDER VAR(!4) (ASCENDING
  VALUES OMITEMPTY) /CATORDER VAR(!2) (ASCENDING VALUES OMITEMPTY) /BOX
Line 87: Line 72:
* can pad out labels with as many * as required
Line 90: Line 77:
!BOX SCORE GROUP 3 SEX 2 score gender group CONTROLS PATIENTS OTHERS * * MALE FEMALE * * *. !BOX score group sex score gp gender BLACK WHITE OTHERS * *  M F * * *.

The interactive graphics in SPSS can be accessed from the menu by choosing graphs:interactive. It enables the availability of a greater range of graphics than are present using older, non-interactive graph options. An example is given below in SPSS syntax for one such enhancement: clustered boxplots. Further editing of the graph may be performed by clicking on particular parts of the outputted graph.

[CUT AND PASTE THE SYNTAX IN THE BOX BELOW INTO A SPSS SYNTAX WINDOW AND RUN]

set format f10.5.
Data list free/
Score group  sex.
Begin data
1 1 1
2 1 1
3 1 1
4 1 2
3 1 2
4 1 2
17 2 1
78 2 1
23 2 1
45 2 2
23 2 2
56 2 2
45 3 1
23 3 1
67 3 1
45 3 2
23 3 2
12 3 2
end data.

DEFINE !BOX (!POS !TOKENS(1)
                     / !POS !TOKENS(1)
                     / !POS !TOKENS(1)
                     / !POS !TOKENS(1)
                     / !POS !TOKENS(1)
                     / !POS !TOKENS(1)
                     / !POS !TOKENS(1)
                     / !POS !TOKENS(1)
                     / !POS !TOKENS(1)
                     / !POS !TOKENS(1)
                     / !POS !TOKENS(1)
                     / !POS !TOKENS(1)
                     / !POS !TOKENS(1)
                     / !POS !TOKENS(1)
                     / !POS !TOKENS(1)
                     / !POS !CMDEND).


VAR LABELS      !1      !4/
                           !2      !5/  
                           !3      !6/.

VALUE LABELS    !2        (1) !7
                                              (2) !8
                                              (3) !9
                                              (4) !10
                                              (5) !11/
                             !3         (1)  !12
                                             (2) !13
                                             (3) !14
                                             (4) !15
                                             (5) !16/.
IGRAPH /VIEWNAME='Boxplot' /X1 = VAR(!2) TYPE = CATEGORICAL /Y = VAR(!1)
  TYPE = SCALE  /STYLE = VAR(!3) /COORDINATE = VERTICAL  /X1LENGTH=3.0
 /YLENGTH=3.0 /X2LENGTH=3.0 /CHARTLOOK='NONE' /CATORDER VAR(!4) (ASCENDING
  VALUES OMITEMPTY) /CATORDER VAR(!2) (ASCENDING VALUES OMITEMPTY) /BOX
  OUTLIERS = ON EXTREME = ON MEDIAN = ON WHISKER = T.
EXE.
!ENDDEFINE.

* can pad out labels with as many * as required

* The line below can be adapted as required for specific data to * specify variable column names and their labels in the boxplot, * number of levels of each categorical variable and the names of * these levels to appear in the boxplot. It is set up for the 
* example data above. In the line below asterisks denote levels 
* of variables which are not present.
!BOX score group sex score gp gender BLACK WHITE OTHERS * *  M F * * *.

* Multiple invocations of the macro in the same interactive session will produce the following note:

>The macro name specified on the DEFINE command duplicates the name of a previously defined macro. This instance will take precedence.

This warning does not indicate a problem and may be ignored.

None: FAQ/box (last edited 2013-03-08 10:18:09 by localhost)