boxplots for total and subgroup in same chart

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

boxplots for total and subgroup in same chart

Art Kendall
I thought I had seen this topic before on this list but did not find it in the archives.

If I have 6 groups of cases, I would like to have a single graphic with 7 boxplots. A boxplot for all cases, and 6 for each of the subgroups.


Art Kendall
Social Research Consultants


===================== 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
Art Kendall
Social Research Consultants
Reply | Threaded
Open this post in threaded view
|

Re: boxplots for total and subgroup in same chart

Bruce Weaver
Administrator
Art Kendall wrote
I thought I had seen this topic before on this list but did not find it
in the archives.

If I have 6 groups of cases, I would like to have a single graphic with
7 boxplots. A boxplot for all cases, and 6 for each of the subgroups.


Art Kendall
Social Research Consultants
Hi Art.  You could always make a copy of the original dataset, and in the copy, set the group variable equal to another (constant) value for all cases.  Then stack the original data and the copy, and add a value label (e.g., "All cases") for the new value.  Here's an example using the "Cars" data.

new file.
dataset close all.

get file = "C:\Program Files\SPSSInc\PASWStatistics17\Samples\Cars.sav".
dataset name cars1 .
freq origin. /* where car was manufactured .

dataset copy cars2 .
dataset activate cars2 .
compute origin = 4.
exe.

ADD FILES /FILE=*
  /FILE='cars1'.
exe.

dataset close cars1.

add value labels
 origin 4 'All countries'
.

EXAMINE VARIABLES=weight BY origin
  /PLOT=BOXPLOT
  /STATISTICS=NONE
  /NOTOTAL.

HTH.

Bruce
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).
Reply | Threaded
Open this post in threaded view
|

Re: boxplots for total and subgroup in same chart

Keith McCormick
In reply to this post by Art Kendall
Hi Art,

This may be a valuable clue found in the GPL reference (examples). I am sure that it can be modified for a box plot. I may try to modify it myself if I get the chance. Note the (jobcat + "All") part. The key will be to imitate that with a pasted boxplot.

HTH, Keith
www.keithmccormick.com

Simple Bar Chart with Bar for All Categories (GPL)

SOURCE: s = userSource(id("Employeedata"))
DATA: jobcat=col(source(s), name("jobcat"), unit.category())
DATA: salary=col(source(s), name("salary"))
SCALE: linear(dim(2), include(0))
GUIDE: axis(dim(2), label("Mean Salary"))
GUIDE: axis(dim(1), label("Job Category"))
ELEMENT: interval(position(summary.mean((jobcat+"All")*salary)))



On Thu, May 13, 2010 at 12:24 PM, Art Kendall <[hidden email]> wrote:
I thought I had seen this topic before on this list but did not find it in the archives.

If I have 6 groups of cases, I would like to have a single graphic with 7 boxplots. A boxplot for all cases, and 6 for each of the subgroups.


Art Kendall
Social Research Consultants


===================== 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: boxplots for total and subgroup in same chart

Art Kendall
In reply to this post by Bruce Weaver
Thanks. 
That makes a lot of sense.

Art

On 5/13/2010 3:47 PM, Bruce Weaver wrote:
Art Kendall wrote:
  

I thought I had seen this topic before on this list but did not find it
in the archives.

If I have 6 groups of cases, I would like to have a single graphic with
7 boxplots. A boxplot for all cases, and 6 for each of the subgroups.


Art Kendall
Social Research Consultants


    
Hi Art.  You could always make a copy of the original dataset, and in the
copy, set the group variable equal to another (constant) value for all
cases.  Then stack the original data and the copy, and add a value label
(e.g., "All cases") for the new value.  Here's an example using the "Cars"
data.

new file.
dataset close all.

get file = "C:\Program Files\SPSSInc\PASWStatistics17\Samples\Cars.sav".
dataset name cars1 .
freq origin. /* where car was manufactured .

dataset copy cars2 .
dataset activate cars2 .
compute origin = 4.
exe.

ADD FILES /FILE=*
  /FILE='cars1'.
exe.

dataset close cars1.

add value labels
 origin 4 'All countries'
.

EXAMINE VARIABLES=weight BY origin
  /PLOT=BOXPLOT
  /STATISTICS=NONE
  /NOTOTAL.

HTH.

Bruce


-----
--
Bruce Weaver
[hidden email]
http://sites.google.com/a/lakeheadu.ca/bweaver/
"When all else fails, RTFM."

NOTE:  My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.
--
View this message in context: http://old.nabble.com/boxplots-for-total-and-subgroup-in-same-chart-tp28549650p28551799.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

  
===================== 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
Art Kendall
Social Research Consultants
Reply | Threaded
Open this post in threaded view
|

Re: boxplots for total and subgroup in same chart

Art Kendall
In reply to this post by Keith McCormick
I'll try using graph instead of EXAMINE AND pasting that ELEMENT spec.

Art

On 5/13/2010 4:07 PM, Keith McCormick wrote:
Hi Art,

This may be a valuable clue found in the GPL reference (examples). I am sure that it can be modified for a box plot. I may try to modify it myself if I get the chance. Note the (jobcat + "All") part. The key will be to imitate that with a pasted boxplot.

HTH, Keith
www.keithmccormick.com

Simple Bar Chart with Bar for All Categories (GPL)

SOURCE: s = userSource(id("Employeedata"))

DATA: jobcat=col(source(s), name("jobcat"), unit.category())
DATA: salary=col(source(s), name("salary"))
SCALE: linear(dim(2), include(0))
GUIDE: axis(dim(2), label("Mean Salary"))

GUIDE: axis(dim(1), label("Job Category"))
ELEMENT: interval(position(summary.mean((jobcat+"All")*salary)))

  


On Thu, May 13, 2010 at 12:24 PM, Art Kendall <[hidden email]> wrote:
I thought I had seen this topic before on this list but did not find it in the archives.

If I have 6 groups of cases, I would like to have a single graphic with 7 boxplots. A boxplot for all cases, and 6 for each of the subgroups.


Art Kendall
Social Research Consultants


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

===================== 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
Art Kendall
Social Research Consultants
Reply | Threaded
Open this post in threaded view
|

Re: boxplots for total and subgroup in same chart

ViAnn Beadle
In reply to this post by Bruce Weaver
This is not necessary. You can use a string constant in GPL blended with the
x variable to get it:

GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=gender salary MISSING=LISTWISE
REPORTMISSING=NO
  /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
  SOURCE: s=userSource(id("graphdataset"))
  DATA: gender=col(source(s), name("gender"), unit.category())
  DATA: salary=col(source(s), name("salary"))
  DATA: id=col(source(s), name("$CASENUM"), unit.category())
  GUIDE: axis(dim(1), label("Gender"))
  GUIDE: axis(dim(2), label("Current Salary"))
  SCALE: linear(dim(2), include(0))
  ELEMENT: schema(position(bin.quantile.letter((gender+"Total")*salary)),
label(id))
END GPL.

I used the string Total so that it would be at the end of the category list.


-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Bruce Weaver
Sent: Thursday, May 13, 2010 1:47 PM
To: [hidden email]
Subject: Re: boxplots for total and subgroup in same chart

Art Kendall wrote:

>
>
> I thought I had seen this topic before on this list but did not find
> it in the archives.
>
> If I have 6 groups of cases, I would like to have a single graphic
> with
> 7 boxplots. A boxplot for all cases, and 6 for each of the subgroups.
>
>
> Art Kendall
> Social Research Consultants
>
>

Hi Art.  You could always make a copy of the original dataset, and in the
copy, set the group variable equal to another (constant) value for all
cases.  Then stack the original data and the copy, and add a value label
(e.g., "All cases") for the new value.  Here's an example using the "Cars"
data.

new file.
dataset close all.

get file = "C:\Program Files\SPSSInc\PASWStatistics17\Samples\Cars.sav".
dataset name cars1 .
freq origin. /* where car was manufactured .

dataset copy cars2 .
dataset activate cars2 .
compute origin = 4.
exe.

ADD FILES /FILE=*
  /FILE='cars1'.
exe.

dataset close cars1.

add value labels
 origin 4 'All countries'
.

EXAMINE VARIABLES=weight BY origin
  /PLOT=BOXPLOT
  /STATISTICS=NONE
  /NOTOTAL.

HTH.

Bruce


-----
--
Bruce Weaver
[hidden email]
http://sites.google.com/a/lakeheadu.ca/bweaver/
"When all else fails, RTFM."

NOTE:  My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.
--
View this message in context:
http://old.nabble.com/boxplots-for-total-and-subgroup-in-same-chart-tp285496
50p28551799.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

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