Clustered means plot and/or multiple variable frequency table

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

Clustered means plot and/or multiple variable frequency table

Ruben Geert van den Berg
Dear all,

I'd like to create a clustered means plot like this. (In case the link gets stripped out: https://dl.dropbox.com/u/39492899/segmentscores.jpg)

Also, I'd like to have a frequency table with variables as column headers, percentages as cells and values as row like this(In case the link gets stripped out: https://dl.dropbox.com/u/39492899/mult_freqs.jpg)

Are these two formats available in SPSS and if so, how? They don't have to look pretty, just for internal use.

Any help appreciated!

Ruben
Reply | Threaded
Open this post in threaded view
|

Automatic reply: Clustered means plot and/or multiple variable frequency table

Lemon, John S.

I'm not in the office until 08:00 Thursday 18th October 2012 - I will try and respond on my return.





The University of Aberdeen is a charity registered in Scotland, No SC013683.
Reply | Threaded
Open this post in threaded view
|

Re: Clustered means plot and/or multiple variable frequency table

Maguin, Eugene
In reply to this post by Ruben Geert van den Berg

Ruben,

You can do the clustered means plot in GPL. Look at example 3-14 specifically and then on through 3-20 to see variations and combinations that may be relevant. Syntax examples are given. You should also be able to do this from the graph procedures on the drop down.

 

The best method for getting the frequency table is by using custom tables (ctables), which you may or may not have. If you don’t have it, then you can embed a frequencies command inside an OMS command to save a frequencies output data file. You then ‘work over’ the output date file to get the structure you want but you can’t output that structure to an spss table—I don’t think. I think you’ll wind up saving a text file after you work over the output data file and then importing that text file into word to make a table. The whole operation is detailed but pretty trivial if you’ve done it before but not so trivial if you haven’t.

 

Gene Maguin

 

 

 

 

 

 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Ruben van den Berg
Sent: Monday, October 15, 2012 1:41 PM
To: [hidden email]
Subject: Clustered means plot and/or multiple variable frequency table

 

Dear all,

 

I'd like to create a clustered means plot like this. (In case the link gets stripped out: https://dl.dropbox.com/u/39492899/segmentscores.jpg)

 

Also, I'd like to have a frequency table with variables as column headers, percentages as cells and values as row like this. (In case the link gets stripped out: https://dl.dropbox.com/u/39492899/mult_freqs.jpg)

 

Are these two formats available in SPSS and if so, how? They don't have to look pretty, just for internal use.

 

Any help appreciated!

 

Ruben

Reply | Threaded
Open this post in threaded view
|

Re: Clustered means plot and/or multiple variable frequency table

Andy W
In reply to this post by Ruben Geert van den Berg

Here to make the desired tables and charts I would suggest you reshape the data for all of the questions of interest are in the same column. Below is an example with fake data that is not already aggregated.


***********************************************************.
*making fake cases data.
set seed = 10.
input program.
loop #i = 1 to 4.
loop #j = 1 to 100.
compute segment = #i.
end case.
end loop.
end loop.
end file.
end input program.
dataset name sim.
execute.

vector q(4,F1.0).
do repeat q = q1 to q4.
    compute q = TRUNC(RV.UNIFORM(1,6)).
end repeat.

*reshaping wide to long.
varstocases
/make q from q1 to q4
/index q_orig (q).

*for the table, use crosstabs.
crosstabs table q by q_orig /cells = column.

*Now for the charts.
*Clustered Bar.
GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=segment[LEVEL=NOMINAL] MEAN(
  q)[name="MEAN_q"] q_orig MISSING=LISTWISE REPORTMISSING=NO
  /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
 SOURCE: s=userSource(id("graphdataset"))
 DATA: segment=col(source(s), name("segment"), unit.category())
 DATA: MEAN_q=col(source(s), name("MEAN_q"))
 DATA: q_orig=col(source(s), name("q_orig"), unit.category())
 COORD: rect(dim(1,2), cluster(3,0))
 GUIDE: axis(dim(3), label("segment"))
 GUIDE: axis(dim(2), label("Mean q"))
 GUIDE: legend(aesthetic(aesthetic.color.interior), label("q_orig"))
 SCALE: cat(dim(3))
 SCALE: linear(dim(2), include(0))
 SCALE: cat(aesthetic(aesthetic.color.interior))
 SCALE: cat(dim(1))
 ELEMENT: interval(position(q_orig*MEAN_q*segment), color.interior(q_orig)
  , shape.interior(shape.square))
END GPL.
*Or you can do paneling.
* Chart Builder.
GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=segment[LEVEL=NOMINAL] MEAN(
  q)[name="MEAN_q"] q_orig MISSING=LISTWISE REPORTMISSING=NO
  /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
 SOURCE: s=userSource(id("graphdataset"))
 DATA: segment=col(source(s), name("segment"), unit.category())
 DATA: MEAN_q=col(source(s), name("MEAN_q"))
 DATA: q_orig=col(source(s), name("q_orig"), unit.category())
 COORD: rect(dim(1,2),wrap())
 GUIDE: axis(dim(1), label("segment"))
 GUIDE: axis(dim(2), label("Mean q"))
 GUIDE: axis(dim(4), label("q_orig"), opposite())
 SCALE: cat(dim(1))
 SCALE: linear(dim(2), include(0))
 SCALE: cat(dim(4))
 ELEMENT: interval(position(segment*MEAN_q*1*q_orig), shape.interior(
  shape.square))
END GPL.
*********************************************************.

Andy W

Andy W
apwheele@gmail.com
http://andrewpwheeler.wordpress.com/
Reply | Threaded
Open this post in threaded view
|

Re: Clustered means plot and/or multiple variable frequency table

Jon K Peck
In reply to this post by Ruben Geert van den Berg
Ruben,

Although it is a different graph from the means plot you requested, you might be interested in the plots produced by Graphs > Compare Subgroups using the cluster assignment to define the groups.  This extension command is included in the Python Essentials as of V21, or it can be downloaded from the SPSS Community.  It is STATS SUBGROUP PLOTS in the Extension Commands collection.

It plots the distributions in each subgroup of selected variables against the overall distributions taking into account the measurement levels of the variables.  It creates these by generating the GPL and submitting a GGRAPH command.

Regards,

Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
[hidden email]
new phone: 720-342-5621




From:        Ruben van den Berg <[hidden email]>
To:        [hidden email],
Date:        10/15/2012 11:44 AM
Subject:        [SPSSX-L] Clustered means plot and/or multiple variable frequency              table
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




Dear all,

I'd like to create a clustered means plot like this. (In case the link gets stripped out: https://dl.dropbox.com/u/39492899/segmentscores.jpg)

Also, I'd like to have a frequency table with variables as column headers, percentages as cells and values as row like this. (In case the link gets stripped out: https://dl.dropbox.com/u/39492899/mult_freqs.jpg)

Are these two formats available in SPSS and if so, how? They don't have to look pretty, just for internal use.

Any help appreciated!

Ruben
Reply | Threaded
Open this post in threaded view
|

Re: Clustered means plot and/or multiple variable frequency table

Ruben Geert van den Berg
Thanks a lot everyone!

I was hoping for a simpler solution but I think I'll go with the reshape by Andrew.

@Andrew: thanks for your very complete and detailed solution!

@Eugene: yes, I was thinking about building the table myself with OMS -> new DataSet -> edit but then I still don't have the charts...

@Jon: I'd love to go with Python but I don't have V21 and then I'll still need to cook up something for the tables...

Kind regards,

Ruben


Date: Tue, 16 Oct 2012 07:26:28 -0600
From: [hidden email]
Subject: Re: Clustered means plot and/or multiple variable frequency table
To: [hidden email]

Ruben,

Although it is a different graph from the means plot you requested, you might be interested in the plots produced by Graphs > Compare Subgroups using the cluster assignment to define the groups.  This extension command is included in the Python Essentials as of V21, or it can be downloaded from the SPSS Community.  It is STATS SUBGROUP PLOTS in the Extension Commands collection.

It plots the distributions in each subgroup of selected variables against the overall distributions taking into account the measurement levels of the variables.  It creates these by generating the GPL and submitting a GGRAPH command.

Regards,

Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
[hidden email]
new phone: 720-342-5621




From:        Ruben van den Berg <[hidden email]>
To:        [hidden email],
Date:        10/15/2012 11:44 AM
Subject:        [SPSSX-L] Clustered means plot and/or multiple variable frequency              table
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




Dear all,

I'd like to create a clustered means plot like this. (In case the link gets stripped out: https://dl.dropbox.com/u/39492899/segmentscores.jpg)

Also, I'd like to have a frequency table with variables as column headers, percentages as cells and values as row like this. (In case the link gets stripped out: https://dl.dropbox.com/u/39492899/mult_freqs.jpg)

Are these two formats available in SPSS and if so, how? They don't have to look pretty, just for internal use.

Any help appreciated!

Ruben