Diff for "FAQ/baSPSS" - CBU statistics Wiki
location: Diff for "FAQ/baSPSS"
Differences between revisions 1 and 2
Revision 1 as of 2011-07-06 11:18:48
Size: 3624
Editor: PeterWatson
Comment:
Revision 2 as of 2011-07-06 11:25:06
Size: 4285
Editor: PeterWatson
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
  = Using SPSS 16+ to produce Bland Altman plots =
Line 2: Line 4:
 = Using SPSS 16+ to produce Bland Altman plots = Using the data on the previous page we illustrate, step-by-step, how to use SPSS syntax and its graphing editor to prodcue Bland-Altman plots. Bote: you will need to adjust the file names and variable names in the below accordingly for using on data on your own PC.

We firstly make sure we have the data in a saved SPSS spreadsheet. We only need wright1 and mini1 for our calculations.
Line 27: Line 31:
 
We now run some syntax that will produce a difference by average scatterplot plus the mean and its 95% confidence limits ready for su to add on shortly. Remember you will need to change the file names variable names.
Line 75: Line 81:
The above should give you a data file containing the original dat plus three columns called M (the mean difference), L95 and U95 representing the lower and upper endpoints of tis 95% confidence interval together with a scatterplot of the difference by average in the output file. To finish things off we need to edit the graph manually. This may be done as follows: The above should give you a data file containing the original data plus three columns called M (the mean difference), L95 and U95 representing the lower and upper endpoints of tis 95% confidence interval together with a scatterplot of the difference by average in the output file. To finish things off we need to edit the graph manually. This may be done as follows:
Line 83: Line 89:
You should now be done: having a scatterplot of the difference (y-axis) by average (x-axis) with the three lines on. You should now be finished: having a scatterplot of the difference (y-axis) by average (x-axis) with the three lines on something like [attachment:baplot.doc this.]

Using SPSS 16+ to produce Bland Altman plots

Using the data on the previous page we illustrate, step-by-step, how to use SPSS syntax and its graphing editor to prodcue Bland-Altman plots. Bote: you will need to adjust the file names and variable names in the below accordingly for using on data on your own PC.

We firstly make sure we have the data in a saved SPSS spreadsheet. We only need wright1 and mini1 for our calculations.

DATA LIST LIST/ subject wright1 wright2 mini1 mini2 (5 F8.0).
BEGIN DATA
1       494     490     512     525
2       395     397     430     415
3       516     512     520     508
4       434     401     428     444
5       476     470     500     500
6       557     611     600     625
7       413     415     364     460
8       442     431     380     390
9       650     638     658     642
10      433     429     445     432
11      417     420     432     420
12      656     633     626     605
13      267     275     260     227
14      478     492     477     467
15      178     165     259     268
16      423     372     350     370
17      427     421     451     443
END DATA.
SAVE OUTFILE='C:\Documents and Settings\peterw\Desktop\My Documents\My Documents2\BLAND AND ALTMAN PLOT\dat.sav' /KEEP=WRIGHT1 MINI1. 

We now run some syntax that will produce a difference by average scatterplot plus the mean and its 95% confidence limits ready for su to add on shortly. Remember you will need to change the file names variable names.

GET FILE='C:\Documents and Settings\peterw\Desktop\My Documents\My Documents2\BLAND AND ALTMAN PLOT\dat.sav'. 

COMPUTE diff = WRIGHT1 - MINI1 .
compute average = (WRIGHT1 + MINI1)/2.
EXECUTE .

OMS 
/SELECT TABLES 
/IF SUBTYPES=['Descriptive Statistics'] 
/DESTINATION FORMAT=SAV OUTFILE='C:\Documents and Settings\peterw\Desktop\My Documents\My Documents2\BLAND AND ALTMAN PLOT\des.sav'. 

DESCRIPTIVES  VARIABLES= DIFF
/STATISTICS=MEAN STDDEV.

OMSEND.

SAVE OUTFILE='C:\Documents and Settings\peterw\Desktop\My Documents\My Documents2\BLAND AND ALTMAN PLOT\dat.sav' /KEEP=WRIGHT1 MINI1 DIFF AVERAGE. 

GET FILE='C:\Documents and Settings\peterw\Desktop\My Documents\My Documents2\BLAND AND ALTMAN PLOT\des.sav'. 

RENAME VARIABLES (MEAN STD.DEVIATION=M SD).
COMPUTE L95=M-1.96*SD.
COMPUTE U95=M+1.96*SD.

IF ($CASENUM LE 1) ID=$CASENUM.
SORT CASES BY ID.
SAVE OUTFILE='C:\Documents and Settings\peterw\Desktop\My Documents\My Documents2\BLAND AND ALTMAN PLOT\des.sav' /KEEP=ID M N L95 U95. 

EXE.

GET FILE='C:\Documents and Settings\peterw\Desktop\My Documents\My Documents2\BLAND AND ALTMAN PLOT\dat.sav'. 
COMPUTE ID=1.
EXE.
SORT CASES BY ID.
EXE.

MATCH FILES FILE=*
  /TABLE='C:\Documents and Settings\peterw\Desktop\My Documents\My Documents2\BLAND AND ALTMAN PLOT\des.sav'  
  /BY ID.
EXECUTE.

GRAPH
  /SCATTERPLOT=average WITH diff  
  /MISSING=LISTWISE .

The above should give you a data file containing the original data plus three columns called M (the mean difference), L95 and U95 representing the lower and upper endpoints of tis 95% confidence interval together with a scatterplot of the difference by average in the output file. To finish things off we need to edit the graph manually. This may be done as follows:

  1. Firstly make sure that the range of the Y-axis contains the lower (L95) and upper (U95) confidence limits for the average inter-test difference (M). If the Y axis needs adjusting click on the graph and go to Edit>Select Y axis and then tner the range (and any increments) required.

  2. We are now ready to add the three lines to the plot for the mean difference(M in the outputted data file) and the limits of its 95% confidence interval (called L95 and U95 in the data file). Go to options>Add a reference line to Y- axis. Put Y equal to M by typing Y=-2.116 in the box. Click Apply and Close. A line at Y=-2.11 should appear on the plot.

  3. repeat for the limits of the confidence interval putting Y equal to the values given by L95 and U95 clicking apply and close each time.

You should now be finished: having a scatterplot of the difference (y-axis) by average (x-axis) with the three lines on something like [attachment:baplot.doc this.]

None: FAQ/baSPSS (last edited 2013-03-08 10:17:25 by localhost)