How to graph repeated measures by case

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

How to graph repeated measures by case

D.R. Wahlgren
Gang,
I'm having trouble figuring out (via the menus in v16-Mac), how to
graph something that seems like it should be exceedingly simple.

I want to create a line graph in which each line contains data from
just one participant at 4 time points.  The data are arranged similar
to this:

ID TIME1 TIME2 TIME3 TIME4
1 4 5 7 8
2 7 7 9 10
3 0 1 3 4
4 2 2 5 8

Is there a way to create a graph with 4 lines, one for each
participant, with the x-axis being Time and y-axis being the value
for the participant at the timepoint?  In this example, each line
would have a roughly upward trend from time 1 to time 4.

thanks,
Dennis

=====================
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: How to graph repeated measures by case

Kylie
Hi Dennis,

I am not in front of SPSS at the moment, but I used to always create these
graphs using the old Interactive Graphs procedure (IGRAPH). I can't remember
the syntax, but in the dialogue box you could select and drag all four TIME
variables into the x-axis box, and set ID as the legend variable. I'm sure
someone else will reply with a GPL solution too.

Cheers,
Kylie.


-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
D.R. Wahlgren
Sent: Tuesday, 4 August 2009 10:03 AM
To: [hidden email]
Subject: How to graph repeated measures by case

Gang,
I'm having trouble figuring out (via the menus in v16-Mac), how to
graph something that seems like it should be exceedingly simple.

I want to create a line graph in which each line contains data from
just one participant at 4 time points.  The data are arranged similar
to this:

ID TIME1 TIME2 TIME3 TIME4
1 4 5 7 8
2 7 7 9 10
3 0 1 3 4
4 2 2 5 8

Is there a way to create a graph with 4 lines, one for each
participant, with the x-axis being Time and y-axis being the value
for the participant at the timepoint?  In this example, each line
would have a roughly upward trend from time 1 to time 4.

thanks,
Dennis

=====================
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: How to graph repeated measures by case

ViAnn Beadle
In reply to this post by D.R. Wahlgren
It's unclear to me from your description whether you want the X axis to
contain values 1 to 4 or values 0 to 10.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
D.R. Wahlgren
Sent: Monday, August 03, 2009 6:33 PM
To: [hidden email]
Subject: How to graph repeated measures by case

Gang,
I'm having trouble figuring out (via the menus in v16-Mac), how to
graph something that seems like it should be exceedingly simple.

I want to create a line graph in which each line contains data from
just one participant at 4 time points.  The data are arranged similar
to this:

ID TIME1 TIME2 TIME3 TIME4
1 4 5 7 8
2 7 7 9 10
3 0 1 3 4
4 2 2 5 8

Is there a way to create a graph with 4 lines, one for each
participant, with the x-axis being Time and y-axis being the value
for the participant at the timepoint?  In this example, each line
would have a roughly upward trend from time 1 to time 4.

thanks,
Dennis

=====================
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: How to graph repeated measures by case

D.R. Wahlgren
At 8:59 PM -0600 8/3/09, ViAnn Beadle wrote:
>It's unclear to me from your description whether you want the X axis to
>contain values 1 to 4 or values 0 to 10.

X axis would be 1 to 4, corresponding to Time Point.  Y axis would be
0 to 10.  There would be 4 lines on the graph, one for ID=1 (with Y
values going from 4 to 5 to 7 to 8), one for ID=2 (7 to 7 to 9 to 10)
etc.

Dennis



>-----Original Message-----
>From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
>D.R. Wahlgren
>Sent: Monday, August 03, 2009 6:33 PM
>To: [hidden email]
>Subject: How to graph repeated measures by case
>
>Gang,
>I'm having trouble figuring out (via the menus in v16-Mac), how to
>graph something that seems like it should be exceedingly simple.
>
>I want to create a line graph in which each line contains data from
>just one participant at 4 time points.  The data are arranged similar
>to this:
>
>ID TIME1 TIME2 TIME3 TIME4
>1 4 5 7 8
>2 7 7 9 10
>3 0 1 3 4
>4 2 2 5 8
>
>Is there a way to create a graph with 4 lines, one for each
>participant, with the x-axis being Time and y-axis being the value
>for the participant at the timepoint?  In this example, each line
>would have a roughly upward trend from time 1 to time 4.
>
>thanks,
>Dennis
>
>=====================
>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: How to graph repeated measures by case

Marta Garcia-Granero
In reply to this post by D.R. Wahlgren
Hi Dennis:

Just in case you can't find out how to use IGRAPH (Kylie's solution,
BTW, Kylie, I tried and couldn't get the expected result), here's what I
use for the same task:

DATA LIST LIST/ID TIME1 TIME2 TIME3 TIME4 (5 F8).
BEGIN DATA
1 4 5 7 8
2 7 7 9 10
3 0 1 3 4
4 2 2 5 8
END DATA.

VARSTOCASES
 /MAKE DepVar 'Insert your label here' FROM TIME1 TIME2 TIME3 TIME4
 /INDEX = Time(4)
 /KEEP =  ID.
VALUE LABEL Time 1 'Time1' 2 'Time2' 3 'Time3' 4 'Time4'.

GRAPH
  /LINE(MULTIPLE)MEAN(DepVar) BY Time BY ID .

Of course, GPL can also be used, because it is more flexible and allows
tweaking the graph.

GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=Time DepVar ID MISSING=
  LISTWISE REPORTMISSING=NO
  /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
 SOURCE: s=userSource(id("graphdataset"))
 DATA: Time=col(source(s), name("Time"), unit.category())
 DATA: DepVar=col(source(s), name("DepVar"), unit.category())
 DATA: ID=col(source(s), name("ID"), unit.category())
 GUIDE: axis(dim(1), label("Time"))
 GUIDE: axis(dim(2), label("Insert your label here"))
 GUIDE: legend(aesthetic(aesthetic.color.interior), label("ID"))
 SCALE: cat(dim(1), include("1", "2", "3", "4"))
 SCALE: cat(dim(2))
 SCALE: cat(aesthetic(aesthetic.color.interior))
 ELEMENT: line(position(Time*DepVar), color.interior(ID), missing.wings())
END GPL.

HTH,
Marta GG

D.R. Wahlgren wrote:

> I'm having trouble figuring out (via the menus in v16-Mac), how to
> graph something that seems like it should be exceedingly simple.
>
> I want to create a line graph in which each line contains data from
> just one participant at 4 time points.  The data are arranged similar
> to this:
>
> ID TIME1 TIME2 TIME3 TIME4
> 1 4 5 7 8
> 2 7 7 9 10
> 3 0 1 3 4
> 4 2 2 5 8
>
> Is there a way to create a graph with 4 lines, one for each
> participant, with the x-axis being Time and y-axis being the value
> for the participant at the timepoint?  In this example, each line
> would have a roughly upward trend from time 1 to time 4.
>
> thanks,
> Dennis
--

For miscellaneous SPSS related statistical stuff, visit:
http://gjyp.nl/marta/

=====================
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: How to graph repeated measures by case

Kylie
I am now in front of SPSS, so here is the syntax for the IGRAPH version of
Dennis' graph. This includes all the defaults from the dialogue box, so it
can obviously be cleaned up substantially. (I've always liked the IGRAPH
feature for combining multiple variables like this - so handy for quick
plots of wide data sets).

IGRAPH
  /VIEWNAME='Line Chart'
  /X1=VAR(category_set0) TYPE=CATEGORICAL
  /Y=VAR(value_set0) TYPE=SCALE
  /COLOR=VAR(ID) TYPE=CATEGORICAL
  /COORDINATE=VERTICAL
  /COMBINE GROUP=VAR(category_set0) TYPE=CATEGORICAL 'Category'
RESPONSE=VAR(value_set0) TYPE=SCALE 'Value'  VAR(TIME1) 'TIME1' VAR(TIME2)
'TIME2' VAR(TIME3) 'TIME3' VAR(TIME4) 'TIME4'
  /YLENGTH=5.2
  /X1LENGTH=6.5
  /CHARTLOOK='NONE'
  /CATORDER VAR(ID) (ASCENDING VALUES OMITEMPTY)
  /CATORDER VAR(category_set0) (ASCENDING VALUES OMITEMPTY)
  /LINE(MEAN) KEY=ON STYLE=LINE DROPLINE=OFF INTERPOLATE=STRAIGHT
BREAK=MISSING.

So it looks like you now have your choice of GRAPH, IGRAPH and GLP versions
to play with Dennis - happy plotting!

Cheers,
Kylie.


-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Marta García-Granero
Sent: Tuesday, 4 August 2009 4:20 PM
To: [hidden email]
Subject: Re: How to graph repeated measures by case

Hi Dennis:

Just in case you can't find out how to use IGRAPH (Kylie's solution,
BTW, Kylie, I tried and couldn't get the expected result), here's what I
use for the same task:

DATA LIST LIST/ID TIME1 TIME2 TIME3 TIME4 (5 F8).
BEGIN DATA
1 4 5 7 8
2 7 7 9 10
3 0 1 3 4
4 2 2 5 8
END DATA.

VARSTOCASES
 /MAKE DepVar 'Insert your label here' FROM TIME1 TIME2 TIME3 TIME4
 /INDEX = Time(4)
 /KEEP =  ID.
VALUE LABEL Time 1 'Time1' 2 'Time2' 3 'Time3' 4 'Time4'.

GRAPH
  /LINE(MULTIPLE)MEAN(DepVar) BY Time BY ID .

Of course, GPL can also be used, because it is more flexible and allows
tweaking the graph.

GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=Time DepVar ID MISSING=
  LISTWISE REPORTMISSING=NO
  /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
 SOURCE: s=userSource(id("graphdataset"))
 DATA: Time=col(source(s), name("Time"), unit.category())
 DATA: DepVar=col(source(s), name("DepVar"), unit.category())
 DATA: ID=col(source(s), name("ID"), unit.category())
 GUIDE: axis(dim(1), label("Time"))
 GUIDE: axis(dim(2), label("Insert your label here"))
 GUIDE: legend(aesthetic(aesthetic.color.interior), label("ID"))
 SCALE: cat(dim(1), include("1", "2", "3", "4"))
 SCALE: cat(dim(2))
 SCALE: cat(aesthetic(aesthetic.color.interior))
 ELEMENT: line(position(Time*DepVar), color.interior(ID), missing.wings())
END GPL.

HTH,
Marta GG

D.R. Wahlgren wrote:

> I'm having trouble figuring out (via the menus in v16-Mac), how to
> graph something that seems like it should be exceedingly simple.
>
> I want to create a line graph in which each line contains data from
> just one participant at 4 time points.  The data are arranged similar
> to this:
>
> ID TIME1 TIME2 TIME3 TIME4
> 1 4 5 7 8
> 2 7 7 9 10
> 3 0 1 3 4
> 4 2 2 5 8
>
> Is there a way to create a graph with 4 lines, one for each
> participant, with the x-axis being Time and y-axis being the value
> for the participant at the timepoint?  In this example, each line
> would have a roughly upward trend from time 1 to time 4.
>
> thanks,
> Dennis
--

For miscellaneous SPSS related statistical stuff, visit:
http://gjyp.nl/marta/

=====================
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: How to graph repeated measures by case

Richard Rivera-2
In reply to this post by D.R. Wahlgren
Dennis,



In essence, you want to have separate trajectories (growth curves) for each individual, such as spaghetti plots.  Correct?



There is a method.  I believe it is a two-step process (restructuring data and creating graphs)



First, you restructure the multivariate wide data (example you provided) into a stacked form, such as:



ID TIME Y

1 1 4

1 2 5

1 3 7

1 4 8
2 1 7

2 2 7

2 3 9

2 4 10
3 1 0

3 2 1

3 3 3

3 4 4

4 1 2

4 2 2

4 3 5

4 4 8



There is an article that may have the syntax on restructuring.



J Peugh, Craig Enders (2005). Using the SPSS Mixed procedure to fit hierarchical linear and growth trajectory models. Educational and Psychological Measurement.



You can just pull down menus to get the restructuring syntax.  Look for restructure option in submenu. I believe there are instructions on using pop down menus in the Ender's web page: https://webapp4.asu.edu/directory/person/839490 <https://webapp4.asu.edu/directory/person/839490>



Second, you create the growth curves for each individual.  You can use Igraph command.  There are SPSS examples in UCLA web page (see SPSS example for Singer & Willett's chapter 2: Exploring longitudinal data on change): http://www.ats.ucla.edu/stat/spss/examples/alda/ <http://www.ats.ucla.edu/stat/spss/examples/alda/>



Because you have 4 time points, you can also have nonlinear trajectories (quadratic) for each individual.



Hopes this helps.



~Rico


________________________________

From: SPSSX(r) Discussion on behalf of D.R. Wahlgren
Sent: Mon 8/3/2009 10:27 PM
To: [hidden email]
Subject: Re: How to graph repeated measures by case



At 8:59 PM -0600 8/3/09, ViAnn Beadle wrote:
>It's unclear to me from your description whether you want the X axis to
>contain values 1 to 4 or values 0 to 10.

X axis would be 1 to 4, corresponding to Time Point.  Y axis would be
0 to 10.  There would be 4 lines on the graph, one for ID=1 (with Y
values going from 4 to 5 to 7 to 8), one for ID=2 (7 to 7 to 9 to 10)
etc.

Dennis



>-----Original Message-----
>From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
>D.R. Wahlgren
>Sent: Monday, August 03, 2009 6:33 PM
>To: [hidden email]
>Subject: How to graph repeated measures by case
>
>Gang,
>I'm having trouble figuring out (via the menus in v16-Mac), how to
>graph something that seems like it should be exceedingly simple.
>
>I want to create a line graph in which each line contains data from
>just one participant at 4 time points.  The data are arranged similar
>to this:
>
>ID TIME1 TIME2 TIME3 TIME4
>1 4 5 7 8
>2 7 7 9 10
>3 0 1 3 4
>4 2 2 5 8
>
>Is there a way to create a graph with 4 lines, one for each
>participant, with the x-axis being Time and y-axis being the value
>for the participant at the timepoint?  In this example, each line
>would have a roughly upward trend from time 1 to time 4.
>
>thanks,
>Dennis
>
>=====================
>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

=====================
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: How to graph repeated measures by case

Kornbrot, Diana
Re: How to graph repeated measures by case It will be MUCH quicker to do it in EXCEL!
SPSS is dire for this kind of thing  - see dennis’s advice below
Life is shortDiana


On 04/08/2009 08:06, "Richard Rivera" <RICHARD.RIVERA@...> wrote:

Dennis,



In essence, you want to have separate trajectories (growth curves) for each individual, such as spaghetti plots.  Correct?



There is a method.  I believe it is a two-step process (restructuring data and creating graphs)



First, you restructure the multivariate wide data (example you provided) into a stacked form, such as:



ID TIME Y

1 1 4

1 2 5

1 3 7

1 4 8
2 1 7

2 2 7

2 3 9

2 4 10
3 1 0

3 2 1

3 3 3

3 4 4

4 1 2

4 2 2

4 3 5

4 4 8



There is an article that may have the syntax on restructuring.



J Peugh, Craig Enders (2005). Using the SPSS Mixed procedure to fit hierarchical linear and growth trajectory models. Educational and Psychological Measurement.



You can just pull down menus to get the restructuring syntax.  Look for restructure option in submenu. I believe there are instructions on using pop down menus in the Ender's web page: https://webapp4.asu.edu/directory/person/839490 <https://webapp4.asu.edu/directory/person/839490>



Second, you create the growth curves for each individual.  You can use Igraph command.  There are SPSS examples in UCLA web page (see SPSS example for Singer & Willett's chapter 2: Exploring longitudinal data on change): http://www.ats.ucla.edu/stat/spss/examples/alda/ <http://www.ats.ucla.edu/stat/spss/examples/alda/>



Because you have 4 time points, you can also have nonlinear trajectories (quadratic) for each individual.



Hopes this helps.



~Rico


________________________________

From: SPSSX(r) Discussion on behalf of D.R. Wahlgren
Sent: Mon 8/3/2009 10:27 PM
To: SPSSX-L@...
Subject: Re: How to graph repeated measures by case



At 8:59 PM -0600 8/3/09, ViAnn Beadle wrote:
>It's unclear to me from your description whether you want the X axis to
>contain values 1 to 4 or values 0 to 10.

X axis would be 1 to 4, corresponding to Time Point.  Y axis would be
0 to 10.  There would be 4 lines on the graph, one for ID=1 (with Y
values going from 4 to 5 to 7 to 8), one for ID=2 (7 to 7 to 9 to 10)
etc.

Dennis



>-----Original Message-----
>From: SPSSX(r) Discussion [[hidden email]] On Behalf Of
>D.R. Wahlgren
>Sent: Monday, August 03, 2009 6:33 PM
>To: SPSSX-L@...
>Subject: How to graph repeated measures by case
>
>Gang,
>I'm having trouble figuring out (via the menus in v16-Mac), how to
>graph something that seems like it should be exceedingly simple.
>
>I want to create a line graph in which each line contains data from
>just one participant at 4 time points.  The data are arranged similar
>to this:
>
>ID TIME1 TIME2 TIME3 TIME4
>1 4 5 7 8
>2 7 7 9 10
>3 0 1 3 4
>4 2 2 5 8
>
>Is there a way to create a graph with 4 lines, one for each
>participant, with the x-axis being Time and y-axis being the value
>for the participant at the timepoint?  In this example, each line
>would have a roughly upward trend from time 1 to time 4.
>
>thanks,
>Dennis
>
>=====================
>To manage your subscription to SPSSX-L, send a message to
>LISTSERV@... (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
LISTSERV@... (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
LISTSERV@... (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

Professor Diana Kornbrot
email: 
d.e.kornbrot@...    
web:    http://web.me.com/kornbrot/KornbrotHome.html
Work
School of Psychology
 University of Hertfordshire
 College Lane, Hatfield, Hertfordshire AL10 9AB, UK
 voice:   +44 (0) 170 728 4626
   fax:     +44 (0) 170 728 5073
Home
 
19 Elmhurst Avenue
 London N2 0LT, UK
    voice:   +44 (0) 208 883  3657
    mobile: +44 (0)
796 890 2102
   fax:      +44 (0) 870 706 4997





Reply | Threaded
Open this post in threaded view
|

Re: How to graph repeated measures by case

William Dudley WNDUDLEY
In reply to this post by D.R. Wahlgren

Dennis,
You may want to look at the SPSS code at the UCLA text stats text book site related the Singer and Willet  Applied Longitudinal  text.
I think chapter two might have what you need.


http://www.ats.ucla.edu/stat/spss/examples/alda/chapter2/aldaspssch2.htm




William N. Dudley, PhD
Associate Dean for Research
The School of Health and Human Performance Office of Research
The University of North Carolina at Greensboro
126 HHP Building, PO Box 26170
Greensboro, NC 27402-6170
VOICE 336.2562475
FAX 336.334.3238



"D.R. Wahlgren" <[hidden email]>
Sent by: "SPSSX(r) Discussion" <[hidden email]>

08/04/2009 01:29 AM

Please respond to
"D.R. Wahlgren" <[hidden email]>

To
[hidden email]
cc
Subject
Re: How to graph repeated measures by case





At 8:59 PM -0600 8/3/09, ViAnn Beadle wrote:
>It's unclear to me from your description whether you want the X axis to
>contain values 1 to 4 or values 0 to 10.

X axis would be 1 to 4, corresponding to Time Point.  Y axis would be
0 to 10.  There would be 4 lines on the graph, one for ID=1 (with Y
values going from 4 to 5 to 7 to 8), one for ID=2 (7 to 7 to 9 to 10)
etc.

Dennis



>-----Original Message-----
>From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
>D.R. Wahlgren
>Sent: Monday, August 03, 2009 6:33 PM
>To: [hidden email]
>Subject: How to graph repeated measures by case
>
>Gang,
>I'm having trouble figuring out (via the menus in v16-Mac), how to
>graph something that seems like it should be exceedingly simple.
>
>I want to create a line graph in which each line contains data from
>just one participant at 4 time points.  The data are arranged similar
>to this:
>
>ID TIME1 TIME2 TIME3 TIME4
>1 4 5 7 8
>2 7 7 9 10
>3 0 1 3 4
>4 2 2 5 8
>
>Is there a way to create a graph with 4 lines, one for each
>participant, with the x-axis being Time and y-axis being the value
>for the participant at the timepoint?  In this example, each line
>would have a roughly upward trend from time 1 to time 4.
>
>thanks,
>Dennis
>
>=====================
>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: How to graph repeated measures by case

ViAnn Beadle
In reply to this post by D.R. Wahlgren
OK. Your data structure doesn't match what the graphing procedures expect.
SPSS and other programs like Excel assume that a time series is in rows and
not columns.

You need to use VARSTOCASES to go from a wide to long format in which each
row contains the ID variable, a Time variable with values 1 to 4 and the
value of the time variable.

data list list /
ID TIME1 TIME2 TIME3 TIME4.
begin data
1 4 5 7 8
2 7 7 9 10
3 0 1 3 4
4 2 2 5 8
end data.
formats ID TIME1 TIME2 TIME3 TIME4(f1.0).
*restructure the file.
VARSTOCASES
  /MAKE Value FROM TIME1 TIME2 TIME3 TIME4
  /INDEX=Time(4)
  /KEEP=ID
  /NULL=KEEP.

You can then use Chart Builder to create the chart. Select the multiple line
choice from the gallery. Drag ID to the color box, Time to the X axis and
Value to the Y axis. Set the statistic to Value in the Properties window and
hit apply. If you paste, the syntax should look something like this:

GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=Time Value[LEVEL=SCALE] ID
MISSING=LISTWISE
    REPORTMISSING=NO
  /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
  SOURCE: s=userSource(id("graphdataset"))
  DATA: Time=col(source(s), name("Time"), unit.category())
  DATA: Value=col(source(s), name("Value"))
  DATA: ID=col(source(s), name("ID"), unit.category())
  GUIDE: axis(dim(1), label("Time"))
  GUIDE: axis(dim(2), label("Value"))
  GUIDE: legend(aesthetic(aesthetic.color.interior), label("ID"))
  SCALE: linear(dim(2), include(0))
  ELEMENT: line(position(Time*Value), color.interior(ID), missing.wings())
END GPL.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
D.R. Wahlgren
Sent: Monday, August 03, 2009 11:27 PM
To: [hidden email]
Subject: Re: How to graph repeated measures by case

At 8:59 PM -0600 8/3/09, ViAnn Beadle wrote:
>It's unclear to me from your description whether you want the X axis to
>contain values 1 to 4 or values 0 to 10.

X axis would be 1 to 4, corresponding to Time Point.  Y axis would be
0 to 10.  There would be 4 lines on the graph, one for ID=1 (with Y
values going from 4 to 5 to 7 to 8), one for ID=2 (7 to 7 to 9 to 10)
etc.

Dennis



>-----Original Message-----
>From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
>D.R. Wahlgren
>Sent: Monday, August 03, 2009 6:33 PM
>To: [hidden email]
>Subject: How to graph repeated measures by case
>
>Gang,
>I'm having trouble figuring out (via the menus in v16-Mac), how to
>graph something that seems like it should be exceedingly simple.
>
>I want to create a line graph in which each line contains data from
>just one participant at 4 time points.  The data are arranged similar
>to this:
>
>ID TIME1 TIME2 TIME3 TIME4
>1 4 5 7 8
>2 7 7 9 10
>3 0 1 3 4
>4 2 2 5 8
>
>Is there a way to create a graph with 4 lines, one for each
>participant, with the x-axis being Time and y-axis being the value
>for the participant at the timepoint?  In this example, each line
>would have a roughly upward trend from time 1 to time 4.
>
>thanks,
>Dennis
>
>=====================
>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

=====================
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: How to graph repeated measures by case

D.R. Wahlgren
Thanks to everyone who replied both on and off list.  I suspected
that this may require a restructuring, but never saw any prompts to
that effect by poking around the menu-driven interface.  And, yes,
"spaghetti plots"...I've heard that term before and I think that's
exactly what I was looking for.

Given that I literally only have about a dozen cases in my data file,
I could have had this long since done by just copying my data into
Excel and futzing around with it there, but it pays to learn how to
do it in the stats apps, for when the data files are much larger.

Dennis

=====================
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: How to graph repeated measures by case

ViAnn Beadle
Unfortunately, the menu interface assumes that your data are in a different
shape for the kind of chart you are trying to get.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
D.R. Wahlgren
Sent: Wednesday, August 05, 2009 12:40 AM
To: [hidden email]
Subject: Re: How to graph repeated measures by case

Thanks to everyone who replied both on and off list.  I suspected
that this may require a restructuring, but never saw any prompts to
that effect by poking around the menu-driven interface.  And, yes,
"spaghetti plots"...I've heard that term before and I think that's
exactly what I was looking for.

Given that I literally only have about a dozen cases in my data file,
I could have had this long since done by just copying my data into
Excel and futzing around with it there, but it pays to learn how to
do it in the stats apps, for when the data files are much larger.

Dennis

=====================
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: How to graph repeated measures by case

Kylie
Except, of course, for the interactive line plot as we were discussing the other
day, which doesn't require restructuring the data at all.


Quoting ViAnn Beadle <[hidden email]>:

> Unfortunately, the menu interface assumes that your data are in a different
> shape for the kind of chart you are trying to get.
>
> -----Original Message-----
> From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
> D.R. Wahlgren
> Sent: Wednesday, August 05, 2009 12:40 AM
> To: [hidden email]
> Subject: Re: How to graph repeated measures by case
>
> Thanks to everyone who replied both on and off list.  I suspected
> that this may require a restructuring, but never saw any prompts to
> that effect by poking around the menu-driven interface.  And, yes,
> "spaghetti plots"...I've heard that term before and I think that's
> exactly what I was looking for.
>
> Given that I literally only have about a dozen cases in my data file,
> I could have had this long since done by just copying my data into
> Excel and futzing around with it there, but it pays to learn how to
> do it in the stats apps, for when the data files are much larger.
>
> Dennis
>
> =====================
> 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
>

=====================
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: How to graph repeated measures by case

D.R. Wahlgren
In reply to this post by D.R. Wahlgren
>Date:    Thu, 6 Aug 2009 09:50:14 +0930
>From:    Kylie Lange <[hidden email]>
>Subject: Re: How to graph repeated measures by case
>
>Except, of course, for the interactive line plot as we were
>discussing the other
>day, which doesn't require restructuring the data at all.
>

Hi Kylie,
I believe I tried this method and was unable to add more than one
variable to the X axis box, whereas I needed it to incorporate 4
variables.  I may have misconfigure something, but for lack of time,
I ended up using the restructuring and GGRAPH method.  It produced
quite a mess of syntax for such simple output, but it did work.

Dennis



>Quoting ViAnn Beadle <[hidden email]>:
>
>>  Unfortunately, the menu interface assumes that your data are in a different
>>  shape for the kind of chart you are trying to get.
>>
>>  -----Original Message-----
>>  From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
>>  D.R. Wahlgren
>>  Sent: Wednesday, August 05, 2009 12:40 AM
>>  To: [hidden email]
>>  Subject: Re: How to graph repeated measures by case
>  >
>>  Thanks to everyone who replied both on and off list.  I suspected
>>  that this may require a restructuring, but never saw any prompts to
>>  that effect by poking around the menu-driven interface.  And, yes,
>>  "spaghetti plots"...I've heard that term before and I think that's
>>  exactly what I was looking for.
>>
>>  Given that I literally only have about a dozen cases in my data file,
>>  I could have had this long since done by just copying my data into
>>  Excel and futzing around with it there, but it pays to learn how to
>>  do it in the stats apps, for when the data files are much larger.
>>
>  > Dennis
>>

=====================
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: How to graph repeated measures by case

Kylie
Hi Dennis,

By holding down control while selecting the four TIME variables, you can
highlight all four variables simultaneously. Once they are all highlighted
they can be dragged as a set into the x-axis box. This will bring up a
secondary window that defines these four variables as a set - there are
options to change the labels etc given to the set, but otherwise you can
just accept all the defaults and proceed back to the main window. The rest
of the graph setup is as per normal, and... voila!

Hope this might help in the future.

Cheers,
Kylie.


-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
D.R. Wahlgren
Sent: Friday, 7 August 2009 3:32 AM
To: [hidden email]
Subject: Re: How to graph repeated measures by case

>Date:    Thu, 6 Aug 2009 09:50:14 +0930
>From:    Kylie Lange <[hidden email]>
>Subject: Re: How to graph repeated measures by case
>
>Except, of course, for the interactive line plot as we were
>discussing the other
>day, which doesn't require restructuring the data at all.
>

Hi Kylie,
I believe I tried this method and was unable to add more than one
variable to the X axis box, whereas I needed it to incorporate 4
variables.  I may have misconfigure something, but for lack of time,
I ended up using the restructuring and GGRAPH method.  It produced
quite a mess of syntax for such simple output, but it did work.

Dennis



>Quoting ViAnn Beadle <[hidden email]>:
>
>>  Unfortunately, the menu interface assumes that your data are in a
different

>>  shape for the kind of chart you are trying to get.
>>
>>  -----Original Message-----
>>  From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
>>  D.R. Wahlgren
>>  Sent: Wednesday, August 05, 2009 12:40 AM
>>  To: [hidden email]
>>  Subject: Re: How to graph repeated measures by case
>  >
>>  Thanks to everyone who replied both on and off list.  I suspected
>>  that this may require a restructuring, but never saw any prompts to
>>  that effect by poking around the menu-driven interface.  And, yes,
>>  "spaghetti plots"...I've heard that term before and I think that's
>>  exactly what I was looking for.
>>
>>  Given that I literally only have about a dozen cases in my data file,
>>  I could have had this long since done by just copying my data into
>>  Excel and futzing around with it there, but it pays to learn how to
>>  do it in the stats apps, for when the data files are much larger.
>>
>  > Dennis
>>

=====================
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: How to graph repeated measures by case

D.R. Wahlgren
At 9:03 AM +0930 8/7/09, Kylie Lange wrote:

>Hi Dennis,
>
>By holding down control while selecting the four TIME variables, you can
>highlight all four variables simultaneously. Once they are all highlighted
>they can be dragged as a set into the x-axis box. This will bring up a
>secondary window that defines these four variables as a set - there are
>options to change the labels etc given to the set, but otherwise you can
>just accept all the defaults and proceed back to the main window. The rest
>of the graph setup is as per normal, and... voila!
>
>Hope this might help in the future.

Thanks, Kylie!  Hmm, I did highlight all 4 vars, but if memory serves
me correctly, the icon when I drug them over the x-axis box was a
circle with a line through it, and would not let me drop them in.  I
then tried dragging them one by one but I believe that it simply
replaced the previously dragged one with the new one.  I'll have to
try it again.  Maybe this is a Mac vs Win version difference (I'm
using Mac)?

Dennis

=====================
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: How to graph repeated measures by case

Kylie
Hmmm... yes, maybe it is a Mac/Win thing as I have only ever used Win
versions.


-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
D.R. Wahlgren
Sent: Friday, 7 August 2009 9:17 AM
To: [hidden email]
Subject: Re: How to graph repeated measures by case

At 9:03 AM +0930 8/7/09, Kylie Lange wrote:

>Hi Dennis,
>
>By holding down control while selecting the four TIME variables, you can
>highlight all four variables simultaneously. Once they are all highlighted
>they can be dragged as a set into the x-axis box. This will bring up a
>secondary window that defines these four variables as a set - there are
>options to change the labels etc given to the set, but otherwise you can
>just accept all the defaults and proceed back to the main window. The rest
>of the graph setup is as per normal, and... voila!
>
>Hope this might help in the future.

Thanks, Kylie!  Hmm, I did highlight all 4 vars, but if memory serves
me correctly, the icon when I drug them over the x-axis box was a
circle with a line through it, and would not let me drop them in.  I
then tried dragging them one by one but I believe that it simply
replaced the previously dragged one with the new one.  I'll have to
try it again.  Maybe this is a Mac vs Win version difference (I'm
using Mac)?

Dennis

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