Graphing error bars for group mean differences and 95% CIs

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Graphing error bars for group mean differences and 95% CIs

Jill Stoltzfus
Hello everyone. Is there a simple way to have SPSS graph error bars for group mean differences to show 95% CIs, similar to a forest plot with meta analysis? I've tried just about every configuration for error bars, but I can't seem to get this to work.

Thanks.

Jill

Reply | Threaded
Open this post in threaded view
|

Re: Graphing error bars for group mean differences and 95% CIs

ViAnn Beadle

Are there any examples of a forest plot online that you want to duplicate? Tell us a bit about your data—are you trying to do a meta analysis? Finally, what fails with the usual error bars available in GGRAPH, GRAPH, or IGRAPH?

 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Jill Stoltzfus
Sent: Thursday, April 23, 2009 8:50 AM
To: [hidden email]
Subject: Graphing error bars for group mean differences and 95% CIs

 

Hello everyone. Is there a simple way to have SPSS graph error bars for group mean differences to show 95% CIs, similar to a forest plot with meta analysis? I've tried just about every configuration for error bars, but I can't seem to get this to work.

Thanks.

Jill

 

Reply | Threaded
Open this post in threaded view
|

Re: Graphing error bars for group mean differences and 95% CIs

Marta Garcia-Granero
Hi:

With summary data like you have, you can use HILO graphs. See this
example (designed for a mean with its 95%CI, but you can adapt if to
mean differences easily):

DATA LIST LIST /Year(F5.0) Mean(F4.1) SE(F4.1).
BEGIN DATA
1995 123 2.1
1996 134 2.2
1997 122 2.1
1998 156 2.4
END DATA.

COMPUTE upperval = mean+1.96*se .
COMPUTE lowerval = mean-1.96*se .
EXECUTE .
GRAPH  /HILO(SIMPLE)=VALUE( upperval lowerval mean ) BY year .

If sample size is low, it would be better to replace 1.96 by the
critical value for the student t distribution with df = error df.

Adding a reference horizontal line at y=0 would be a great idea, to show
if the 95%CI limits overlap 0 (non significant differences) or not.

Perhaps you can use OMS to extract the relevant data (mean difference,
SE of difference and 95%CI for differences) from the multiple
comparisons pivot table. This approach has the advantage of using the
correct critical t value (instead of z=1.96) and adjusted for the
multiple comparisons method used (Tukey, Bonferroni...).

I can send you some code if you want.

HTH,
Marta García-Granero

>
>
>
> *From:* SPSSX(r) Discussion [mailto:[hidden email]] *On
> Behalf Of *Jill Stoltzfus
> *Sent:* Thursday, April 23, 2009 8:50 AM
> *To:* [hidden email]
> *Subject:* Graphing error bars for group mean differences and 95% CIs
>
>
>
> Hello everyone. Is there a simple way to have SPSS graph error bars
> for group mean differences to show 95% CIs, similar to a forest plot
> with meta analysis? I've tried just about every configuration for
> error bars, but I can't seem to get this to work.
>
> Thanks.
>
> Jill
>
>
>


--
For miscellaneous SPSS related statistical stuff, visit:
http://gjyp.nl/marta/

=====================
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
|

Re: Graphing error bars for group mean differences and 95% CIs

Jill Stoltzfus
In reply to this post by Jill Stoltzfus
I would appreciate the code--thanks so much.

Jill

--- On Thu, 4/23/09, Marta García-Granero <[hidden email]> wrote:

From: Marta García-Granero <[hidden email]>
Subject: Re: Graphing error bars for group mean differences and 95% CIs
To: [hidden email]
Date: Thursday, April 23, 2009, 11:26 AM

Hi:

With summary data like you have, you can use HILO graphs. See this
example (designed for a mean with its 95%CI, but you can adapt if to
mean differences easily):

DATA LIST LIST /Year(F5.0) Mean(F4.1) SE(F4.1).
BEGIN DATA
1995 123 2.1
1996 134 2.2
1997 122 2.1
1998 156 2.4
END DATA.

COMPUTE upperval = mean+1.96*se .
COMPUTE lowerval = mean-1.96*se .
EXECUTE .
GRAPH  /HILO(SIMPLE)=VALUE( upperval lowerval mean ) BY year .

If sample size is low, it would be better to replace 1.96 by the
critical value for the student t distribution with df = error df.

Adding a reference horizontal line at y=0 would be a great idea, to show
if the 95%CI limits overlap 0 (non significant differences) or not.

Perhaps you can use OMS to extract the relevant data (mean difference,
SE of difference and 95%CI for differences) from the multiple
comparisons pivot table. This approach has the advantage of using the
correct critical t value (instead of z=1.96) and adjusted for the
multiple comparisons method used (Tukey, Bonferroni...).

I can send you some code if you want.

HTH,
Marta García-Granero

>
>
>
> *From:* SPSSX(r) Discussion [mailto:SPSSX-L@...] *On
> Behalf Of *Jill Stoltzfus
> *Sent:* Thursday, April 23, 2009 8:50 AM
> *To:* SPSSX-L@...
> *Subject:* Graphing error bars for group mean differences and 95% CIs
>
>
>
> Hello everyone. Is there a simple way to have SPSS graph error bars
> for group mean differences to show 95% CIs, similar to a forest plot
> with meta analysis? I've tried just about every configuration for
> error bars, but I can't seem to get this to work.
>
> Thanks.
>
> Jill
>
>
>


--
For miscellaneous SPSS related statistical stuff, visit:
http://gjyp.nl/marta/

=====================
To manage your subscription to SPSSX-L, send a message to
LISTSERV@... (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
|

Re: Graphing error bars for group mean differences and 95% CIs

Marta Garcia-Granero
Jill Stoltzfus wrote:
> I would appreciate the code--thanks so much.
>
* The code assumes that the variables are sorted in alphabetical order
(like in the example,
  although it could also be Measure1, Measure2.... ,or Sleep1, Sleep2,
Sleep3...Sleep6 - or similar) *.

* Sample dataset (replace by your own data) *.
DATA LIST LIST/A B C D (4 F8.2).
BEGIN DATA
3.18    3.27    3.34    3.87
0.80    2.73    2.18    2.28
2.13    2.12    2.13    2.26
1.35    1.92    2.28    2.72
2.10    2.06    2.53    2.73
1.30    2.45    2.35    4.41
3.30    3.10    3.07    3.86
2.93    2.49    2.93    3.25
3.50    3.03    3.32    2.78
0.55    2.26    1.96    2.08
0.33    0.37    1.12    1.05
1.55    2.48    2.23    2.38
2.10    2.12    2.31    2.46
3.49    3.63    3.70    3.63
0.70    0.83    1.57    1.27
2.20    3.06    2.92    2.95
1.35    2.32    2.12    2.65
1.73    2.74    2.68    2.92
4.68    4.54    4.63    4.81
0.83    1.16    2.04    2.70
0.43    0.93    2.70    3.16
END DATA.

* First, restructure dataset *.
VARSTOCASES /ID = id
  /MAKE measure FROM A B C D
  /INDEX = Pattern(measure).

* Warning: this steps are language dependent, set olang to english for
success *.

DATASET DECLARE MeanDifferences.
SET OLANG=ENGLISH.
OMS
 /SELECT TABLES
 /IF COMMANDS = ["UNIANOVA"]
     SUBTYPES = ["POSTHOC Multiple Comparisons"]
 /DESTINATION FORMAT = SAV
  OUTFILE = MeanDifferences.

* ANOVA code (uses Tukey as MC method, replace by your favorite one) *.
UNIANOVA
  measure  BY Pattern id
  /RANDOM = id
  /METHOD = SSTYPE(3)
  /INTERCEPT = EXCLUDE
  /POSTHOC = Pattern ( TUKEY )
  /CRITERIA = ALPHA(.05)
  /DESIGN = Pattern id .
OMSEND.

* Labeling and cleaning *.
DATASET ACTIVATE MeanDifferences.
DELETE VARIABLES Command_ Subtype_ Label_.
STRING Title(A8).
COMPUTE Title=CONCAT(Var1,'-',Var2).
* Getting rid of redundant comparisons *.
COMPUTE MD=ABS(MeanDifferenceIJ).
SORT CASES BY MD(A) Title(A).
COMPUTE Flag=1.
DO IF (TRUNC($casenum/2) EQ ($casenum/2)).
. COMPUTE Flag=0.
END IF.
EXE.
SELECT IF(NOT(Flag =0)).
SORT CASES BY Title(A).
GRAPH  /HILO(SIMPLE)=VALUE( LowerBound UpperBound MeanDifferenceIJ) BY
Title .

HTH,
Marta

--
For miscellaneous SPSS related statistical stuff, visit:
http://gjyp.nl/marta/

=====================
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