error bar graph with lines for subgroups?

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

error bar graph with lines for subgroups?

Ian Martin-2
Is it not possible to produce a plot to show interaction in 2-way ANOVA, graphing means with error bars, and joining the means for subgroups?

I can produce the error bar graph, but can't find a way to join the subgroup means with straight lines, as is done (without error bars) as an option in GLM.

In graph legacy dialog, this gives the means and error bars, but without the lines joining subgroup means:
GRAPH
  /ERRORBAR(CI 90)=ntaxa BY Year BY Exposure.
 
In GPL, the equivalent:
* Chart Builder.
GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=Year MEANCI(ntaxa, 95)[name="MEAN_ntaxa" LOW="MEAN_ntaxa_LOW" HIGH="MEAN_ntaxa_HIGH"] Exposure MISSING=LISTWISE REPORTMISSING=NO
  /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
  SOURCE: s=userSource(id("graphdataset"))
  DATA: Year=col(source(s), name("Year"), unit.category())
  DATA: MEAN_ntaxa=col(source(s), name("MEAN_ntaxa"))
  DATA: Exposure=col(source(s), name("Exposure"), unit.category())
  DATA: LOW=col(source(s), name("MEAN_ntaxa_LOW"))
  DATA: HIGH=col(source(s), name("MEAN_ntaxa_HIGH"))
  COORD: rect(dim(1,2), cluster(3,0))
  GUIDE: axis(dim(3), label("Year"))
  GUIDE: axis(dim(2), label("Mean Number of Taxa"))
  GUIDE: legend(aesthetic(aesthetic.color.exterior), label("Exposure"))
  GUIDE: text.footnote(label("Error Bars: 95% CI"))
  SCALE: cat(dim(3), include("1.00", "2.00"))
  SCALE: linear(dim(2), include(0))
  SCALE: cat(aesthetic(aesthetic.color.exterior), include("1.00", "2.00"))
  SCALE: cat(dim(1), include("1.00", "2.00"))
  ELEMENT: point(position(Exposure*MEAN_ntaxa*Year), color.exterior(Exposure))
  ELEMENT: interval(position(region.spread.range(Exposure*(LOW+HIGH)*Year)), shape.interior(shape.ibeam), color.interior(Exposure))
END GPL.
 

In GLM, the interaction (without error bars) gives a profile plot of EM means, with lines joining subgroups in the plot subcommand:
GLM ntaxa BY Exposure Year
  /METHOD=SSTYPE(3)
  /INTERCEPT=INCLUDE
  /PLOT=PROFILE(Year*Exposure)
  /EMMEANS=TABLES(Exposure) COMPARE ADJ(LSD)
  /EMMEANS=TABLES(Year) COMPARE ADJ(LSD)
  /EMMEANS=TABLES(Exposure*Year)
  /PRINT=DESCRIPTIVE ETASQ OPOWER HOMOGENEITY
  /CRITERIA=ALPHA(.1)
  /DESIGN= Exposure Year Exposure*Year.

I'd like to have the separate lines for the separate subgroups, AND the error bars on the means, rather than "either/or".  Apologies if I'm missing something obvious, but I don't have a terrific grasp of syntax.

regards,
Ian
 
Ian D. Martin, Ph.D.

=====================
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: error bar graph with lines for subgroups?

Andy W
Untested but for the GGRAPH code you should be able to take the ELEMENT line:

ELEMENT: point(position(Exposure*MEAN_ntaxa*Year), color.exterior(Exposure))

And add an additional ELEMENT: line with the same arguments:

ELEMENT: line(position(Exposure*MEAN_ntaxa*Year), color.interior(Exposure))
ELEMENT: point(position(Exposure*MEAN_ntaxa*Year), color.interior(Exposure))

Lines only have "interior" colors, so I changed the color for the points to be interior as well (this should hopefully make the legend alittle less cluttered.)
Andy W
apwheele@gmail.com
http://andrewpwheeler.wordpress.com/