Plotting question

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

Plotting question

Maguin, Eugene
I started with pre-post student scores along with school, grade and
classroom ids. I've aggregated and then worked the data over so that the
resulting file has a total sample record for each school, a school total
record, and as many records as classrooms-grades.

I'm interested in making one plot for each school showing, from left to
right,
the total sample mean and high and low value as composite plot element 1,
the school mean and high and low value as composite plot element 2,
the classroom mean and high and low value as composite plot elements 3 to n
(n being a reasonable number).

What I am calling a 'composite plot element' might be a filled circle for
the mean and an 'I' element or a filled bar for the high-low or a filled bar
for the mean and an 'I' element for the high-low. Other than being clear and
understandable, I don't care about those specifics at this point. Needless
to say the mean may be positive or negative.

I figure this calls for 'GraphPlot' <stirring music up and fade>. But can
graphplot construct the composite plot elements I've described using
aggregated data?

Second (stupid) question. If aggregated can be used, will my data need to be
restructured to that all data that will appear on a single plot resides on a
single record?

Thanks, Gene Maguin

=====================
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: Plotting question

ViAnn Beadle
I'm not sure what GraphPlot is, but the composite plot element is just two
elements: interval (bar) and point when using GPL. The region.spread.range
function can be used to create a floating bar defined by two variables.

The simplest data structure is to get the data into n types of records with
the aggregated values for min, max, and total. The variable defining the
type then becomes the x axis and the three variables defining the values
become the composite variable. I assume that the a school id would be used
to split the schools creating a chart for each school.

Here's a really simple example using GPL without many bells and whistles:
data list list / type (a8) min max mean schoolid.
begin data
sample 2 9 3 1
total 3 7 3.5 1
class1 4 6 4.2 1
class2 3 7 3.8 1
class3 1 5 2.0 1
end data.
GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=type mean min max
  /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
  SOURCE: s=userSource(id("graphdataset"))
  DATA: type=col(source(s), name("type"), unit.category())
  DATA: mean=col(source(s), name("mean"))
  DATA: min=col(source(s), name("min"))
  DATA: max=col(source(s), name("max"))
  GUIDE: axis(dim(1), label("type"))
  GUIDE: axis(dim(2), label("scores"))
  SCALE: linear(dim(2))
  SCALE: cat(dim(1), sort.values("total", "sample", "class1", "class2",
"class3"))
  ELEMENT: interval(position(region.spread.range(type*(min+max))))
  ELEMENT: point(position(type*mean))
END GPL.


Note that sort.values on the SCALE command orders the bars so that total and
sample come first.

The big trick here is to get the data into this structure.


-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Gene Maguin
Sent: Thursday, May 27, 2010 3:59 PM
To: [hidden email]
Subject: Plotting question

I started with pre-post student scores along with school, grade and
classroom ids. I've aggregated and then worked the data over so that the
resulting file has a total sample record for each school, a school total
record, and as many records as classrooms-grades.

I'm interested in making one plot for each school showing, from left to
right, the total sample mean and high and low value as composite plot
element 1, the school mean and high and low value as composite plot element
2, the classroom mean and high and low value as composite plot elements 3 to
n (n being a reasonable number).

What I am calling a 'composite plot element' might be a filled circle for
the mean and an 'I' element or a filled bar for the high-low or a filled bar
for the mean and an 'I' element for the high-low. Other than being clear and
understandable, I don't care about those specifics at this point. Needless
to say the mean may be positive or negative.

I figure this calls for 'GraphPlot' <stirring music up and fade>. But can
graphplot construct the composite plot elements I've described using
aggregated data?

Second (stupid) question. If aggregated can be used, will my data need to be
restructured to that all data that will appear on a single plot resides on a
single record?

Thanks, Gene Maguin

=====================
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
Reply | Threaded
Open this post in threaded view
|

Re: Plotting question

Maguin, Eugene
ViAnn, thank you for your reply.

>>I'm not sure what GraphPlot is, but the composite plot element is just two
elements: interval (bar) and point when using GPL. The region.spread.range
function can be used to create a floating bar defined by two variables.

Plotgraph is my unintentional botchup of GPL. I was working on a snarky but
floppy joke.

Before I posted my question I had a look thru of the GPL pdf so I knew that
I could combine plot elements because there are examples in the book.

I'll look at that region... Function and the floating bar business as I
don't know what it is. I was thinking that I could control the placement of
the 0.0 point on the y axis by specifying the range of the y axis (assuming
that is possible, which I'll bet it is).


>>So your data format is hierarchical and some cases are schools and some
cases are classrooms?

>>The simplest data structure is to get the data into n types of records
with
the aggregated values for min, max, and total. The variable defining the
type then becomes the x axis and the three variables defining the values
become the composite variable. I assume that the a school id would be used
to split the schools creating a chart for each school.

The actual current data structure (with example data for one school) and
simplified as it would pertain to the plot dataset is

School grade  class  change  high    low
234     -2   Sample    -1.2  18.8  -15.9
234     -1   School     3.4   9.1   -1.1
234      0   Room 27   -1.0  10.8   -5.9
234      0   Room 10    0.4  10.8   -5.9
234      1   Room A3    2.2  10.8   -5.9
234      1   Room 13    3.9  10.8   -5.9
234      2   Room 31    5.4  10.8   -5.9
234      3   Room B7    6.0  10.8   -5.9
234      4   Room 12    3.3  10.8   -5.9
234      5   Room 24    1.9  10.8   -5.9
313     -2   Sample    -1.2  18.8  -15.9


I've looked at but have not tried your example data and syntax. But let me
ask a question or two. On this command:

  SCALE: cat(dim(1), sort.values("total", "sample", "class1", "class2",
"class3"))

Does the number of values need to be prespecified? The number of classrooms
(and the number of grades) will vary from school to school. In my example
(and real) data I used grade to control the sorting of the sample and school
records relative to the grade-class records. In the plot, I want grades to
be ordered from K to 6 or what ever the upper limit is. Within grade, I
don't think I care about the sort order. But, if I do, i can easily control
that by making a grade+class composite variable.


>>Here's a really simple example using GPL without many bells and whistles:
data list list / type (a8) min max mean schoolid.
begin data
sample 2 9 3 1
total 3 7 3.5 1
class1 4 6 4.2 1
class2 3 7 3.8 1
class3 1 5 2.0 1
end data.
GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=type mean min max
  /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
  SOURCE: s=userSource(id("graphdataset"))
  DATA: type=col(source(s), name("type"), unit.category())
  DATA: mean=col(source(s), name("mean"))
  DATA: min=col(source(s), name("min"))
  DATA: max=col(source(s), name("max"))
  GUIDE: axis(dim(1), label("type"))
  GUIDE: axis(dim(2), label("scores"))
  SCALE: linear(dim(2))
  SCALE: cat(dim(1), sort.values("total", "sample", "class1", "class2",
"class3"))
  ELEMENT: interval(position(region.spread.range(type*(min+max))))
  ELEMENT: point(position(type*mean))
END GPL.


>>Note that sort.values on the SCALE command orders the bars so that total
and
sample come first.


Gene Maguin

=====================
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: Plotting question

ViAnn Beadle
I think that sort.values can be used with a partial list and that the named
values come first and others are then sorted alphabetically or numerically
depending upon the variable type.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Gene Maguin
Sent: Thursday, May 27, 2010 8:16 PM
To: [hidden email]
Subject: Re: Plotting question

ViAnn, thank you for your reply.

>>I'm not sure what GraphPlot is, but the composite plot element is just
>>two
elements: interval (bar) and point when using GPL. The region.spread.range
function can be used to create a floating bar defined by two variables.

Plotgraph is my unintentional botchup of GPL. I was working on a snarky but
floppy joke.

Before I posted my question I had a look thru of the GPL pdf so I knew that
I could combine plot elements because there are examples in the book.

I'll look at that region... Function and the floating bar business as I
don't know what it is. I was thinking that I could control the placement of
the 0.0 point on the y axis by specifying the range of the y axis (assuming
that is possible, which I'll bet it is).


>>So your data format is hierarchical and some cases are schools and
>>some
cases are classrooms?

>>The simplest data structure is to get the data into n types of records
with
the aggregated values for min, max, and total. The variable defining the
type then becomes the x axis and the three variables defining the values
become the composite variable. I assume that the a school id would be used
to split the schools creating a chart for each school.

The actual current data structure (with example data for one school) and
simplified as it would pertain to the plot dataset is

School grade  class  change  high    low
234     -2   Sample    -1.2  18.8  -15.9
234     -1   School     3.4   9.1   -1.1
234      0   Room 27   -1.0  10.8   -5.9
234      0   Room 10    0.4  10.8   -5.9
234      1   Room A3    2.2  10.8   -5.9
234      1   Room 13    3.9  10.8   -5.9
234      2   Room 31    5.4  10.8   -5.9
234      3   Room B7    6.0  10.8   -5.9
234      4   Room 12    3.3  10.8   -5.9
234      5   Room 24    1.9  10.8   -5.9
313     -2   Sample    -1.2  18.8  -15.9


I've looked at but have not tried your example data and syntax. But let me
ask a question or two. On this command:

  SCALE: cat(dim(1), sort.values("total", "sample", "class1", "class2",
"class3"))

Does the number of values need to be prespecified? The number of classrooms
(and the number of grades) will vary from school to school. In my example
(and real) data I used grade to control the sorting of the sample and school
records relative to the grade-class records. In the plot, I want grades to
be ordered from K to 6 or what ever the upper limit is. Within grade, I
don't think I care about the sort order. But, if I do, i can easily control
that by making a grade+class composite variable.


>>Here's a really simple example using GPL without many bells and whistles:
data list list / type (a8) min max mean schoolid.
begin data
sample 2 9 3 1
total 3 7 3.5 1
class1 4 6 4.2 1
class2 3 7 3.8 1
class3 1 5 2.0 1
end data.
GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=type mean min max
  /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
  SOURCE: s=userSource(id("graphdataset"))
  DATA: type=col(source(s), name("type"), unit.category())
  DATA: mean=col(source(s), name("mean"))
  DATA: min=col(source(s), name("min"))
  DATA: max=col(source(s), name("max"))
  GUIDE: axis(dim(1), label("type"))
  GUIDE: axis(dim(2), label("scores"))
  SCALE: linear(dim(2))
  SCALE: cat(dim(1), sort.values("total", "sample", "class1", "class2",
"class3"))
  ELEMENT: interval(position(region.spread.range(type*(min+max))))
  ELEMENT: point(position(type*mean))
END GPL.


>>Note that sort.values on the SCALE command orders the bars so that
>>total
and
sample come first.


Gene Maguin

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