Boxplot and mean

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

Boxplot and mean

Igor
Hello,
Please how can I plot in the same figure both the boxplot and the mean?
Please help me.



--
Sent from: http://spssx-discussion.1045642.n5.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
Reply | Threaded
Open this post in threaded view
|

Re: Boxplot and mean

Andy W
Not the prettiest example, but here you go.

***********************.
SET SEED 10.
INPUT PROGRAM.
LOOP #i = 1 TO 100.
  LOOP #j = 1 TO 10.
    COMPUTE Group = #j.
    COMPUTE Val = RV.NORMAL(#j,1).
    END CASE.
  END LOOP.
END LOOP.
END FILE.
END INPUT PROGRAM.
EXECUTE.

GGRAPH
  /GRAPHDATASET NAME="g1" VARIABLES=Group Val
  /GRAPHDATASET NAME="g2" VARIABLES=Group MEAN(Val)[name="MEAN_Val"]
  /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
  SOURCE: g1=userSource(id("g1"))
  DATA: Group=col(source(g1), name("Group"), unit.category())
  DATA: Val=col(source(g1), name("Val"))
  DATA: id=col(source(g1), name("$CASENUM"), unit.category())
  SOURCE: g2=userSource(id("g2"))
  DATA: Group_g2=col(source(g2), name("Group"), unit.category())
  DATA: MEAN_Val=col(source(g2), name("MEAN_Val"))
  GUIDE: axis(dim(1), label("Group"))
  GUIDE: axis(dim(2), label("Val"))
  SCALE: linear(dim(2), include(0))
  ELEMENT: schema(position(bin.quantile.letter(Group*Val)), label(id))
  ELEMENT: point(position(Group_g2*MEAN_Val), size(size."20"))
END GPL.
***********************.



-----
Andy W
[hidden email]
http://andrewpwheeler.wordpress.com/
--
Sent from: http://spssx-discussion.1045642.n5.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
Andy W
apwheele@gmail.com
http://andrewpwheeler.wordpress.com/