'Forest-plots' or Errror bar-charts in SPSS

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

'Forest-plots' or Errror bar-charts in SPSS

Laurie Petch

Hi,

Thanks to those who responded with very helpful messages in response to my queries about using SPSS for meta-analysis. Now I'm at the stage of reporting the results, please can anyone help me with a way of drawing up a 'forest plot' like those produced by the Cochrane RevMan software using SPSS? Perhaps someone knows an ingenious way to import SPSS data to RevMan in order to do this? Or, maybe someone has a macro to do the same thing using SPSS? Alternatively, if someone could help me draw up a simple error bar-chart in SPSS, showing the effect size with its 95% confidence interval for each study, that would also help.

Thanks,

Laurie

--------------
Laurie Petch
Chartered Educational Psychologist (British Psychological Society)

Regina, Canada

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 'Forest-plots' or Errror bar-charts in SPSS

Marta García-Granero
Hi Laurie

LP> Thanks to those who responded with very helpful messages in
LP> response to my queries about using SPSS for meta-analysis. Now I'm
LP> at the stage of reporting the results, please can anyone help me
LP> with a way of drawing up a 'forest plot' like those produced by
LP> the Cochrane RevMan software using SPSS? Perhaps someone knows an
LP> ingenious way to import SPSS data to RevMan in order to do this?
LP> Or, maybe someone has a macro to do the same thing using
LP> SPSS? Alternatively, if someone could help me draw up a simple
LP> error bar-chart in SPSS, showing the effect size with its 95%
LP> confidence interval for each study, that would also help.

* Sample dataset (processed data )*.
DATA LIST LIST/ trial(F4) year(A5) study(A10) measure cilow ciup percwi(4 F8.3).
BEGIN DATA
 1 "1989" "Hodnett  " .502 .262  .962   4.940
 2 "1991" "Kennell  " .352 .216  .575   8.694
 3 "1992" "Bréart-Fr" .785 .483 1.276   8.878
 4 "1992" "Bréart-Bg" .811 .653 1.007  44.598
 5 "1997" "Gagnon   " .867 .573 1.311  12.237
 6 "1998" "Langer   " .280 .203  .384  20.654
 7 "    " "Total    " .594 .514  .687 100.000
END DATA.

A) Assuming you have SPSS 14:

SORT CASES BY trial(D).
STRING YearAndStudy(A30).
COMPUTE YearAndStudy=CONCAT(RTRIM(year)," ",study).
COMPUTE RefLine=1.

GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=YearAndStudy ciup cilow measure percwi RefLine
  MISSING=LISTWISE REPORTMISSING=NO
 /GRAPHSPEC SOURCE=INLINE.

* If the effect you are measuring is OR or RR, then this syntax can
 do the task *.

BEGIN GPL
 SOURCE: s=userSource(id("graphdataset"))
 DATA:   YearAndStudy=col(source(s),   name("YearAndStudy"), unit.category())
 DATA:   ciup=col(source(s),    name("ciup"))
 DATA:   cilow=col(source(s),   name("cilow"))
 DATA:   measure=col(source(s), name("measure"))
 DATA:   percwi=col(source(s),  name("percwi"))
 DATA:   RefLine=col(source(s), name("RefLine"))
 COORD:  transpose(rect(dim(1,2), transpose()))
 GUIDE:  axis(dim(2), label(" Favours treatment                 Favours Control"))
 SCALE:  cat(dim(1))
 SCALE:  log(dim(2))
 ELEMENT: interval(position(region.spread.range(YearAndStudy*(cilow+ciup))),
  shape(shape.line), color(color.black))
 ELEMENT: point(position(YearAndStudy*measure), shape(shape.square),
  size(percwi), color.interior(color.black))
 ELEMENT: line(position(YearAndStudy*RefLine), shape(shape.line))
END GPL.

If your meta-analyzing means, then the reference line should be set at
0 [COMPUTE RefLine=0] and the scale should be linear instead of
logarithmic [SCALE: linear(dim(2))].

B) If you don't have SPSS 14, but older, then use the simpler syntax
(uglier graph) you can find in the collection of meta-analytic files I
wrote time ago:

http://www.spsstools.net/Syntax/MetaAnalysis/META-SPSS.ZIP

Basically:

GRAPH /HILO(SIMPLE)=VALUE( ciup cilow measure ) BY study.

(same sample dataset is used).

Then edit the graph to transpose the coordinates system, change the
scale to log (if needed), add a reference line at 0 or 1 (depending on
the summary measure), save the chart template an apply it to new
graphs:

GRAPH /HILO(SIMPLE)=VALUE( ciup cilow measure ) BY study
 /TEMPLATE='Your template file'.

--
Regards,
Dr. Marta García-Granero,PhD           mailto:[hidden email]
Statistician

---
"It is unwise to use a statistical procedure whose use one does
not understand. SPSS syntax guide cannot supply this knowledge, and it
is certainly no substitute for the basic understanding of statistics
and statistical thinking that is essential for the wise choice of
methods and the correct interpretation of their results".

(Adapted from WinPepi manual - I'm sure Joe Abrahmson will not mind)
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 'Forest-plots' or Errror bar-charts in SPSS

nina
In reply to this post by Laurie Petch
Dear all,

my aim is to produce a forest plot with the study names (string variables) situated along the y-axis
and horizontal error bars. The x-axis will refer to the size of the correlation coefficients of the different studies.

It seems that the syntax pasted below which had been posted previously here does not work for newer versions of SPSS... Specifically, an error message pops up telling me that an "inline graph specification had been here expected" but hadn't been found. Can anybody help me modyfying the syntax? Many thanks in advance!

Best
Nina

***

http://spssx-discussion.1045642.n5.nabble.com/Forest-plots-or-Errror-bar-charts-in-SPSS-td1070926.html

***

DATA LIST LIST/ trial(F4) year(A5) study(A10) measure cilow ciup percwi(4 F8.3).
BEGIN DATA
 1 "1989" "Hodnett  " .502 .262  .962   4.940
 2 "1991" "Kennell  " .352 .216  .575   8.694
 3 "1992" "Bréart-Fr" .785 .483 1.276   8.878
 4 "1992" "Bréart-Bg" .811 .653 1.007  44.598
 5 "1997" "Gagnon   " .867 .573 1.311  12.237
 6 "1998" "Langer   " .280 .203  .384  20.654
 7 "    " "Total    " .594 .514  .687 100.000
END DATA.

A) Assuming you have SPSS 14:

SORT CASES BY trial(D).
STRING YearAndStudy(A30).
COMPUTE YearAndStudy=CONCAT(RTRIM(year)," ",study).
COMPUTE RefLine=1.

GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=YearAndStudy ciup cilow measure percwi RefLine
  MISSING=LISTWISE REPORTMISSING=NO
 /GRAPHSPEC SOURCE=INLINE.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 'Forest-plots' or Errror bar-charts in SPSS

Jon Peck
You are missing the actual chart code.  Go back to that link and get the BEGIN GPL...END GPL. lines and add them to your syntax.

On Wed, Aug 9, 2017 at 12:08 PM, nina <[hidden email]> wrote:
Dear all,

my aim is to produce a forest plot with the study names (string variables)
situated along the y-axis
and horizontal error bars. The x-axis will refer to the size of the
correlation coefficients of the different studies.

It seems that the syntax pasted below which had been posted previously here
does not work for newer versions of SPSS... Specifically, an error message
pops up telling me that an "inline graph specification had been here
expected" but hadn't been found. Can anybody help me modyfying the syntax?
Many thanks in advance!

Best
Nina

***

http://spssx-discussion.1045642.n5.nabble.com/Forest-plots-or-Errror-bar-charts-in-SPSS-td1070926.html

***

DATA LIST LIST/ trial(F4) year(A5) study(A10) measure cilow ciup percwi(4
F8.3).
BEGIN DATA
 1 "1989" "Hodnett  " .502 .262  .962   4.940
 2 "1991" "Kennell  " .352 .216  .575   8.694
 3 "1992" "Bréart-Fr" .785 .483 1.276   8.878
 4 "1992" "Bréart-Bg" .811 .653 1.007  44.598
 5 "1997" "Gagnon   " .867 .573 1.311  12.237
 6 "1998" "Langer   " .280 .203  .384  20.654
 7 "    " "Total    " .594 .514  .687 100.000
END DATA.

A) Assuming you have SPSS 14:

SORT CASES BY trial(D).
STRING YearAndStudy(A30).
COMPUTE YearAndStudy=CONCAT(RTRIM(year)," ",study).
COMPUTE RefLine=1.

GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=YearAndStudy ciup cilow
measure percwi RefLine
  MISSING=LISTWISE REPORTMISSING=NO
 /GRAPHSPEC SOURCE=INLINE.




--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Forest-plots-or-Errror-bar-charts-in-SPSS-tp1070926p5734630.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD



--
Jon K Peck
[hidden email]

===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

AW: 'Forest-plots' or Errror bar-charts in SPSS

nina

...of course! that helped! Thank you! Just one remaining question:

how could I flip the x- and y-axis (the y-axis woud refer to a string variable)?

Many thanks!

Nina


Von: Jon Peck [via SPSSX Discussion] <ml+[hidden email]>
Gesendet: Mittwoch, 9. August 2017 20:51:31
An: nina
Betreff: Re: 'Forest-plots' or Errror bar-charts in SPSS
 
You are missing the actual chart code.  Go back to that link and get the BEGIN GPL...END GPL. lines and add them to your syntax.

On Wed, Aug 9, 2017 at 12:08 PM, nina <[hidden email]> wrote:
Dear all,

my aim is to produce a forest plot with the study names (string variables)
situated along the y-axis
and horizontal error bars. The x-axis will refer to the size of the
correlation coefficients of the different studies.

It seems that the syntax pasted below which had been posted previously here
does not work for newer versions of SPSS... Specifically, an error message
pops up telling me that an "inline graph specification had been here
expected" but hadn't been found. Can anybody help me modyfying the syntax?
Many thanks in advance!

Best
Nina

***

http://spssx-discussion.1045642.n5.nabble.com/Forest-plots-or-Errror-bar-charts-in-SPSS-td1070926.html

***

DATA LIST LIST/ trial(F4) year(A5) study(A10) measure cilow ciup percwi(4
F8.3).
BEGIN DATA
 1 "1989" "Hodnett  " .502 .262  .962   4.940
 2 "1991" "Kennell  " .352 .216  .575   8.694
 3 "1992" "Bréart-Fr" .785 .483 1.276   8.878
 4 "1992" "Bréart-Bg" .811 .653 1.007  44.598
 5 "1997" "Gagnon   " .867 .573 1.311  12.237
 6 "1998" "Langer   " .280 .203  .384  20.654
 7 "    " "Total    " .594 .514  .687 100.000
END DATA.

A) Assuming you have SPSS 14:

SORT CASES BY trial(D).
STRING YearAndStudy(A30).
COMPUTE YearAndStudy=CONCAT(RTRIM(year)," ",study).
COMPUTE RefLine=1.

GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=YearAndStudy ciup cilow
measure percwi RefLine
  MISSING=LISTWISE REPORTMISSING=NO
 /GRAPHSPEC SOURCE=INLINE.




--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Forest-plots-or-Errror-bar-charts-in-SPSS-tp1070926p5734630.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD



--
Jon K Peck
[hidden email]

===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD


If you reply to this email, your message will be added to the discussion below:
http://spssx-discussion.1045642.n5.nabble.com/Forest-plots-or-Errror-bar-charts-in-SPSS-tp1070926p5734631.html
To unsubscribe from 'Forest-plots' or Errror bar-charts in SPSS, click here.
NAML
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: AW: 'Forest-plots' or Errror bar-charts in SPSS

Andy W
The code is alittle confusing, as it had a transpose of a transpose. So if you eliminated the inner transpose on the COORD statement you get the studies on the Y axis. Here are a few more updates I would do that plot as well.

GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=YearAndStudy ciup cilow measure percwi RefLine
  MISSING=LISTWISE REPORTMISSING=NO
 /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
 SOURCE: s=userSource(id("graphdataset"))
 DATA:   YearAndStudy=col(source(s),   name("YearAndStudy"), unit.category())
 DATA:   ciup=col(source(s),    name("ciup"))
 DATA:   cilow=col(source(s),   name("cilow"))
 DATA:   measure=col(source(s), name("measure"))
 DATA:   percwi=col(source(s),  name("percwi"))
 DATA:   RefLine=col(source(s), name("RefLine"))
 COORD:  transpose(rect(dim(1,2)))
 GUIDE: text.title(label("<- Favours treatment       |       Favours Control ->"))
 GUIDE:  axis(dim(2))
 GUIDE:  form.line(position(*,1), color(color.grey))
 GUIDE:  legend(aesthetic(aesthetic.size), null())
 SCALE:  cat(dim(1), reverse())
 SCALE:  log(dim(2), base(2))
 SCALE: pow(aesthetic(aesthetic.size), aestheticMinimum(size."4px"), aestheticMaximum(size."16px"))
 ELEMENT: interval(position(region.spread.range(YearAndStudy*(cilow+ciup))),
  shape(shape.line), color(color.black))
 ELEMENT: point(position(YearAndStudy*measure), shape(shape.square),
  size(percwi), color.interior(color.black))
END GPL.



I edited the title to line up appropriately, but the rest is simply via the look of my chart template. Those few updates to Marta's code include:

 - studies on Y axis
 - studies sorted so older are at the top, newer and total at the bottom
 - X axis uses log base 2
 - used a GUIDE for the reference line, instead of a variable (the form.line makes it go through the whole graph is the only real difference)
 - the guide line at 1 is light grey and plotted behind the data
 - squares are plotted on square root scale, so it is associated with the area of the square, not its edge size
 - eliminate the legend for the square sizes
 - made the favours treatment a title instead of axis label
Andy W
apwheele@gmail.com
http://andrewpwheeler.wordpress.com/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: AW: 'Forest-plots' or Errror bar-charts in SPSS

nina
Dear Andy & Jon,

many thanks for your help - really a great & supportive community here!

Best,
Nina
Loading...