question about ggraph/gpl

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

question about ggraph/gpl

Wells, Christine
question about ggraph/gpl

Greetings,

I have a question about ggraph and gpl.  I am trying to make several scatterplots (with a panel variable) using ggraph.  I have the code mostly working, except that I can't get rid of the display of R-squareds in the last panel.  In other words, it seems that by default, the R-squareds for each fit line (one for each panel in the graph) are displayed, and they are all displayed in the middle of the final panel of the graph.  I would like to get rid the R-squareds, but I don't know how to do this via the ggraph and/or gpl syntax.  The dataset and an example of what I am trying to do can be found at http://www.ats.ucla.edu/stat/spss/examples/alda/chapter4/aldaspssch4.htm .

I didn't see any mention of display of R-squared values in the gpl guide, much less how to control if or where they would appear.

Here is the syntax that I have been using:

formats alcuse age_14 (f3.0).
GGRAPH
  /GRAPHDATASET NAME="iGraphDataset" VARIABLES= alcuse age_14 id
  /GRAPHSPEC SOURCE=INLINE
      INLINETEMPLATE=["<addFitLine  type='linear' /> " "<setWrapPanels/>"].
BEGIN GPL
SOURCE: s=userSource( id( "iGraphDataset" ) )
DATA: Y_Var=col( source(s), name( "alcuse" ) )
DATA: X1_Var=col( source(s), name( "age_14" ) )
DATA: Panel_Var0=col( source(s), name( "id" ), unit.category() )
COORD: rect( dim( 1, 2 ) )
GUIDE: axis( dim( 1 ), label( "age" ) )
GUIDE: axis( dim( 2 ), label( "alcuse" ) )
GUIDE: axis( dim( 3 ), label( "id" ), opposite() )
SCALE: linear( dim( 1 ) )
SCALE: linear( dim( 2 ) )
SCALE: cat( dim( 3 ) )
ELEMENT: point( position( ( X1_Var * Y_Var * Panel_Var0 * 1  ) ) )
END GPL.

Any suggestions would be appreciated.

Best,

Christine Wells
Statistical Consulting Group
UCLA Academic Technology Services
http://www.ats.ucla.edu/stat/


Reply | Threaded
Open this post in threaded view
|

Re: question about ggraph/gpl

ViAnn Beadle
question about ggraph/gpl

If you want to get rid of all summary stats, create the fit line using an ELEMENT statement with smooth.linear rather than applying it with the inline template with the addFitLine tag.

 

Add this:

ELEMENT: line( position(smooth.linear( X1_Var * Y_Var * Panel_Var0 * 1  ) ) ))

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Wells, Christine
Sent: Monday, June 08, 2009 4:15 PM
To: [hidden email]
Subject: question about ggraph/gpl

 

Greetings,

I have a question about ggraph and gpl.  I am trying to make several scatterplots (with a panel variable) using ggraph.  I have the code mostly working, except that I can't get rid of the display of R-squareds in the last panel.  In other words, it seems that by default, the R-squareds for each fit line (one for each panel in the graph) are displayed, and they are all displayed in the middle of the final panel of the graph.  I would like to get rid the R-squareds, but I don't know how to do this via the ggraph and/or gpl syntax.  The dataset and an example of what I am trying to do can be found at http://www.ats.ucla.edu/stat/spss/examples/alda/chapter4/aldaspssch4.htm .

I didn't see any mention of display of R-squared values in the gpl guide, much less how to control if or where they would appear.

Here is the syntax that I have been using:

formats alcuse age_14 (f3.0).
GGRAPH
  /GRAPHDATASET NAME="iGraphDataset" VARIABLES= alcuse age_14 id
  /GRAPHSPEC SOURCE=INLINE
      INLINETEMPLATE=["<addFitLine  type='linear' /> " "<setWrapPanels/>"].
BEGIN GPL
SOURCE: s=userSource( id( "iGraphDataset" ) )
DATA: Y_Var=col( source(s), name( "alcuse" ) )
DATA: X1_Var=col( source(s), name( "age_14" ) )
DATA: Panel_Var0=col( source(s), name( "id" ), unit.category() )
COORD: rect( dim( 1, 2 ) )
GUIDE: axis( dim( 1 ), label( "age" ) )
GUIDE: axis( dim( 2 ), label( "alcuse" ) )
GUIDE: axis( dim( 3 ), label( "id" ), opposite() )
SCALE: linear( dim( 1 ) )
SCALE: linear( dim( 2 ) )
SCALE: cat( dim( 3 ) )
ELEMENT: point( position( ( X1_Var * Y_Var * Panel_Var0 * 1  ) ) )
END GPL.

Any suggestions would be appreciated.

Best,

Christine Wells
Statistical Consulting Group
UCLA Academic Technology Services
http://www.ats.ucla.edu/stat/

 

Reply | Threaded
Open this post in threaded view
|

Re: question about ggraph/gpl

Wells, Christine
RE: question about ggraph/gpl

Greetings,

Thank you very much for your reply; it worked perfectly!

Best,

Christine Wells
Statistical Consulting Group
UCLA Academic Technology Services
http://www.ats.ucla.edu/stat/

From: ViAnn Beadle [[hidden email]]
Sent: June 08, 2009 6:43 PM
To: Wells, Christine; [hidden email]
Subject: RE: question about ggraph/gpl

If you want to get rid of all summary stats, create the fit line using an ELEMENT statement with smooth.linear rather than applying it with the inline template with the addFitLine tag.

Add this:

ELEMENT: line( position(smooth.linear( X1_Var * Y_Var * Panel_Var0 * 1  ) ) ))

From: SPSSX(r) Discussion [[hidden email]] On Behalf Of Wells, Christine
Sent: Monday, June 08, 2009 4:15 PM
To: [hidden email]
Subject: question about ggraph/gpl

Greetings,

I have a question about ggraph and gpl.  I am trying to make several scatterplots (with a panel variable) using ggraph.  I have the code mostly working, except that I can't get rid of the display of R-squareds in the last panel.  In other words, it seems that by default, the R-squareds for each fit line (one for each panel in the graph) are displayed, and they are all displayed in the middle of the final panel of the graph.  I would like to get rid the R-squareds, but I don't know how to do this via the ggraph and/or gpl syntax.  The dataset and an example of what I am trying to do can be found at http://www.ats.ucla.edu/stat/spss/examples/alda/chapter4/aldaspssch4.htm .

I didn't see any mention of display of R-squared values in the gpl guide, much less how to control if or where they would appear.

Here is the syntax that I have been using:

formats alcuse age_14 (f3.0).
GGRAPH
  /GRAPHDATASET NAME="iGraphDataset" VARIABLES= alcuse age_14 id
  /GRAPHSPEC SOURCE=INLINE
      INLINETEMPLATE=["<addFitLine  type='linear' /> " "<setWrapPanels/>"].
BEGIN GPL
SOURCE: s=userSource( id( "iGraphDataset" ) )
DATA: Y_Var=col( source(s), name( "alcuse" ) )
DATA: X1_Var=col( source(s), name( "age_14" ) )
DATA: Panel_Var0=col( source(s), name( "id" ), unit.category() )
COORD: rect( dim( 1, 2 ) )
GUIDE: axis( dim( 1 ), label( "age" ) )
GUIDE: axis( dim( 2 ), label( "alcuse" ) )
GUIDE: axis( dim( 3 ), label( "id" ), opposite() )
SCALE: linear( dim( 1 ) )
SCALE: linear( dim( 2 ) )
SCALE: cat( dim( 3 ) )
ELEMENT: point( position( ( X1_Var * Y_Var * Panel_Var0 * 1  ) ) )
END GPL.

Any suggestions would be appreciated.

Best,

Christine Wells
Statistical Consulting Group
UCLA Academic Technology Services
http://www.ats.ucla.edu/stat/

Reply | Threaded
Open this post in threaded view
|

Re: reformatting frequency tables

J P-6

Dear List,

 

I believe I found hte answer to my initial question and now have another question.

 

I found two scripts:

http://www.spsstools.net/Scripts/PivotTables/ApplyingAnyScriptToAllPivotTables.txt

 

and

 

http://www.spsstools.net/Scripts/PivotTables/ExchangeRowsAndColumnsOfPivotTable.txt

 

that do what I need. Now my question is how do I combine these two scripts? I'm sure it's simple but still beyond me.

 

Thank you,

John


Reply | Threaded
Open this post in threaded view
|

Re: reformatting frequency tables

Peck, Jon

I'm not sure I understand the structure of the output you want, but you might consider, instead of the scripts below, using OMS to write the tables to a sav file and then using SAVE TRANSLATE to  export that file to Excel.  OMS can restructure the output to put different things in the rows and columns (see the COLUMNS subcommand).

 

If you do want to just transpose all your frequency tables, you could attach an autoscript to the Frequencies table type, but you might be better off doing the tables with CTABLES, which gives you control over the structure and statistics in the tables.

 

HTH,

Jon Peck

 


From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of J P
Sent: Tuesday, June 09, 2009 10:38 AM
To: [hidden email]
Subject: Re: [SPSSX-L] reformatting frequency tables

 

 

Dear List,

 

I believe I found hte answer to my initial question and now have another question.

 

I found two scripts:

http://www.spsstools.net/Scripts/PivotTables/ApplyingAnyScriptToAllPivotTables.txt

 

and

 

http://www.spsstools.net/Scripts/PivotTables/ExchangeRowsAndColumnsOfPivotTable.txt

 

that do what I need. Now my question is how do I combine these two scripts? I'm sure it's simple but still beyond me.

 

Thank you,

John

 

Reply | Threaded
Open this post in threaded view
|

Re: reformatting frequency tables

Heather Corcoran-7
In reply to this post by J P-6

unsubscribe

 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of J P
Sent: Tuesday, June 09, 2009 12:38 PM
To: [hidden email]
Subject: Re: reformatting frequency tables

 

 

Dear List,

 

I believe I found hte answer to my initial question and now have another question.

 

I found two scripts:

http://www.spsstools.net/Scripts/PivotTables/ApplyingAnyScriptToAllPivotTables.txt

 

and

 

http://www.spsstools.net/Scripts/PivotTables/ExchangeRowsAndColumnsOfPivotTable.txt

 

that do what I need. Now my question is how do I combine these two scripts? I'm sure it's simple but still beyond me.

 

Thank you,

John