Plotting means on both axes

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

Plotting means on both axes

Bree Witteveen
I'm trying to produce what I think should be quite a simple chart. I have
stable isotope values for carbon and nitrogen across three years. All I want
to do is plot the mean carbon value vs. the mean nitrogen value by years.
So, the chart should have three points and dual error bars. I can't imagine
that this is a difficult thing to do, but I can't seem to figure it out.
Any suggestions are welcome.
Thanks!
Reply | Threaded
Open this post in threaded view
|

Re: Plotting means on both axes

ViAnn Beadle
How could the standard error be calculated from a single point? Or do you
mean that you want a bar between the mean value for carbon and the mean
value for nitrogen?

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Bree Witteveen
Sent: Thursday, October 04, 2007 11:38 PM
To: [hidden email]
Subject: Plotting means on both axes

I'm trying to produce what I think should be quite a simple chart. I have
stable isotope values for carbon and nitrogen across three years. All I want
to do is plot the mean carbon value vs. the mean nitrogen value by years.
So, the chart should have three points and dual error bars. I can't imagine
that this is a difficult thing to do, but I can't seem to figure it out.
Any suggestions are welcome.
Thanks!
Reply | Threaded
Open this post in threaded view
|

R: Plotting means on both axes

Luca Meyer
In reply to this post by Bree Witteveen
Hi Bree,

If I got your request right try this code (tested SPSS 15):

/** first some sample data **/
DATA LIST LIST /id substance value year.
BEGIN DATA
1 1 230 2005
2 1 220 2005
3 1 210 2005
4 1 220 2005
5 1 230 2005
6 1 240 2005
7 1 230 2005
8 1 220 2005
9 1 210 2005
10 1 200 2005
11 1 280 2006
12 1 290 2006
13 1 230 2006
14 1 240 2006
15 1 200 2006
16 1 210 2006
17 1 210 2006
18 1 220 2006
19 1 200 2006
20 1 250 2006
21 1 270 2007
22 1 230 2007
23 1 230 2007
24 1 250 2007
25 1 290 2007
26 1 270 2007
27 1 260 2007
28 1 230 2007
29 1 210 2007
30 2 210 2007
31 2 130 2005
32 2 110 2005
33 2 130 2005
34 2 120 2005
35 2 150 2005
36 2 140 2005
37 2 110 2005
38 2 110 2005
39 2 100 2005
40 2 120 2005
41 2 120 2006
42 2 130 2006
43 2 110 2006
44 2 120 2006
45 2 130 2006
46 2 140 2006
47 2 150 2006
48 2 160 2006
49 2 170 2006
50 2 180 2006
51 2 190 2007
52 2 170 2007
53 2 150 2007
54 2 150 2007
55 2 150 2007
56 2 160 2007
57 2 150 2007
58 2 120 2007
59 2 130 2007
60 2 100 2007
END DATA.
EXE.

/** then I assign the variable level and value labels **/
VAR LEVEL VALUE (SCALE).
VAL LABEL SUBSTANCE 1 "carbon" 2 "nitrogen".

/** finally I use the following GGRAPH procedure **/
GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=year MEANCI(value,
95)[name="MEANCI_value_95" LOW="MEANCI_value_95_LOW"
HIGH="MEANCI_value_95_HIGH"]
  substance MISSING=LISTWISE REPORTMISSING=NO
  /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
 SOURCE: s=userSource(id("graphdataset"))
 DATA: year=col(source(s), name("year"), unit.category())
 DATA: MEAN_value=col(source(s), name("MEANCI_value_95"))
 DATA: LOW=col(source(s), name("MEANCI_value_95_LOW"))
 DATA: HIGH=col(source(s), name("MEANCI_value_95_HIGH"))
 DATA: substance=col(source(s), name("substance"), unit.category())
 COORD: rect(dim(1,2), cluster(3,0))
 GUIDE: axis(dim(3), label("year"))
 GUIDE: axis(dim(2), label("Mean value"))
 GUIDE: legend(aesthetic(aesthetic.color.exterior), label("substance"))
 GUIDE: text.footnote(label("Error Bars: 95% CI"))
 SCALE: cat(dim(3))
 SCALE: linear(dim(2), include(0))
 SCALE: cat(aesthetic(aesthetic.color.exterior), include("1.00", "2.00"))
 SCALE: cat(dim(1), include("1.00", "2.00"))
 ELEMENT: point(position(substance*MEAN_value*year),
color.exterior(substance))
 ELEMENT: interval(position(region.spread.range(substance*(LOW+HIGH)*year)),
shape.interior(shape.ibeam), color.interior(substance))
END GPL.

HTH,
Luca

Mr. Luca MEYER
Market research, data analysis & more
www.lucameyer.com - Tel: +39.339.495.00.21


-----Messaggio originale-----
Da: SPSSX(r) Discussion [mailto:[hidden email]] Per conto di Bree
Witteveen
Inviato: venerdì 5 ottobre 2007 7.38
A: [hidden email]
Oggetto: Plotting means on both axes

I'm trying to produce what I think should be quite a simple chart. I have
stable isotope values for carbon and nitrogen across three years. All I want
to do is plot the mean carbon value vs. the mean nitrogen value by years.
So, the chart should have three points and dual error bars. I can't imagine
that this is a difficult thing to do, but I can't seem to figure it out.
Any suggestions are welcome.
Thanks!

No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.488 / Virus Database: 269.14.1/1050 - Release Date: 04/10/2007
17.03


No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.488 / Virus Database: 269.14.1/1050 - Release Date: 04/10/2007
17.03
Reply | Threaded
Open this post in threaded view
|

Re: Plotting means on both axes

ViAnn Beadle
In reply to this post by ViAnn Beadle
This plot is called a biplot. Here's an example that Kim Peck posted to the
list about six months ago. It requires 3 variables: the grouping variable
(YEAR in your case), the x variable and the y variable (your isotope
variables). You won't need the VALUE LABEL command since year is
self-explanatory and your DATA LIST command will be different (using FREE
he's put more than group*x-y pairs on a line.

The GGRAPH does the aggregation to obtain the mean and standard deviations
for each of your x and y vars by year.

Have a go at this and good luck.

DATA LIST FREE/Group Gluc Triglic.
BEGIN DATA
1 5.17 1.51 1 5.25 1.64 1 5.31 1.59 1 4.58 1.52 1 5.56 1.64
1 5.15 1.35 1 5.33 1.68 1 5.29 1.30 1 5.01 1.91 1 5.88 1.30
2 4.92 1.32 2 4.71 1.41 2 4.79 1.24 2 4.04 1.24 2 4.82 1.39
2 4.41 1.32 2 4.89 1.36 2 4.60 1.33 2 4.75 1.20 2 5.33 1.41
2 4.67 1.18 2 4.08 1.37 2 5.19 1.28 2 4.77 1.05 2 4.94 0.99
2 4.65 1.31 2 4.76 1.29 2 5.33 1.20 2 4.70 1.18 2 5.02 1.13
END DATA.

VALUE LABEL Group 1 'Control' 2' Treated'.
GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=MEANSD(Gluc)[NAME="MEAN_Gluc"
LOW="MEAN_Gluc_LOW" HIGH="MEAN_Gluc_HIGH"]
    MEANSD(Triglic)[NAME="MEAN_Triglic" LOW="MEAN_Triglic_LOW"
HIGH="MEAN_Triglic_HIGH"]
    Group MISSING=LISTWISE REPORTMISSING=NO
  /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
  SOURCE: s=userSource(id("graphdataset"))
  DATA: MEAN_Gluc=col(source(s), name("MEAN_Gluc"))
  DATA: LOW_Gluc=col(source(s), name("MEAN_Gluc_LOW"))
  DATA: HIGH_Gluc=col(source(s), name("MEAN_Gluc_HIGH"))
  DATA: MEAN_Triglic=col(source(s), name("MEAN_Triglic"))
  DATA: LOW_Triglic=col(source(s), name("MEAN_Triglic_LOW"))
  DATA: HIGH_Triglic=col(source(s), name("MEAN_Triglic_HIGH"))
  DATA: Group=col(source(s), name("Group"), unit.category())
  GUIDE: axis(dim(1), label("Glucose levels"))
  GUIDE: axis(dim(2), label("Triglic"))
  GUIDE: legend(aesthetic(aesthetic.color.interior), null())
  ELEMENT: point(position(MEAN_Gluc*MEAN_Triglic), color.exterior(Group))
  ELEMENT: edge(position(MEAN_Gluc*(LOW_Triglic+HIGH_Triglic)),
color.interior(Group))
  ELEMENT: edge(position((LOW_Gluc+HIGH_Gluc)*MEAN_Triglic),
color.interior(Group))
END GPL.

-----Original Message-----
From: Briana H. Witteveen [mailto:[hidden email]]
<snip/>

Here is an example of my data
Sample ID        Year        d13C           d15N
UAFK 04         2004      -18.35           12.17
UAFK 05         2004      -18.47           11.58
UAFK 06         2005      -17.58           12.52
UAFK 07         2006      -17.99           12.63
UAFK 08         2006      -18.01           12.43

All told, I have 24 values for 2004, 50 values for 2005, and 25 values
for 2006.


ViAnn Beadle wrote:
[Vi sez:] <snip/>

> I think I can do this plot using SPSS 15 with GGRAPH (assuming I get some
> idea of your data) but all bets are off for 14.
>
> -----Original Message-----
> From: Briana H. Witteveen [mailto:[hidden email]]
> Sent: Friday, October 05, 2007 11:03 AM
> To: ViAnn Beadle
> Subject: Re: Plotting means on both axes
>
> I've attached a jpeg of what I would like the chart to look like. I made
> this one in SigmaPlot (which I no longer have access to).
> I am running SPSS 14.0 Grad Pack.
>
> ViAnn Beadle wrote:
>
>> What do you want on the y axis and what do you want on the x axis? Do
>> you want a standard deviation for both your oxygen and your nitrogen
>> value. Does this look like a dot with a horizontal and vertical bar?
>>
>> I having a very hard time visualizing this plot. Perhaps you could
>> draw this plot on paper and scan it to send to me.
>>
>> I also need to know what version of SPSS you are running.
>>
>> -----Original Message-----
>> From: Briana H. Witteveen [mailto:[hidden email]]
>> Sent: Friday, October 05, 2007 10:27 AM
>> To: ViAnn Beadle
>> Subject: Re: Plotting means on both axes
>>
>> Thanks for your reply. The single point represents the mean carbon
>> value vs. the mean nitrogen value for each of three years. Does that
>> make more sense? So, there should be a standard deviation for both axes.
>>
>> Thanks,
>> Bree
>>
>> ViAnn Beadle wrote:
>>
>>
>>> How could the standard error be calculated from a single point? Or do
>>> you mean that you want a bar between the mean value for carbon and
>>> the mean value for nitrogen?
>>>
>>> -----Original Message-----
>>> From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf
>>> Of Bree Witteveen
>>> Sent: Thursday, October 04, 2007 11:38 PM
>>> To: [hidden email]
>>> Subject: Plotting means on both axes
>>>
>>> I'm trying to produce what I think should be quite a simple chart. I
>>> have stable isotope values for carbon and nitrogen across three
>>> years. All I
>>>
>>>
>> want
>>
>>
>>> to do is plot the mean carbon value vs. the mean nitrogen value by
years.

>>> So, the chart should have three points and dual error bars. I can't
>>>
>>>
>> imagine
>>
>>
>>> that this is a difficult thing to do, but I can't seem to figure it out.
>>> Any suggestions are welcome.
>>> Thanks!
>>>
>>>
>>>
>>
>>
>
>
> --
> Briana H. Witteveen
> Doctoral Candidate
>
> University of Alaska Fairbanks
> University of Central Florida
> Physiological Ecology and Bioenergetics Lab
> 118 Trident Way
> Kodiak, AK 99615
> Office: (907) 486-1514
> Mobile: (907) 942-2733
>
>


--
Briana H. Witteveen
Doctoral Candidate

University of Alaska Fairbanks
University of Central Florida
Physiological Ecology and Bioenergetics Lab
118 Trident Way
Kodiak, AK 99615
Office: (907) 486-1514
Mobile: (907) 942-2733