Using IGRAPH to show results of a piecewise regression

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

Using IGRAPH to show results of a piecewise regression

Moshe Marko
Hi all,

I am conducting a piecewise regression and am trying to create a graph to
show the differences in the slopes. Im am using the following syntax and it
tells me that there is an error - am I missing something? I copied the
syntax from http://www.ats.ucla.edu/stat/Spss/faq/piecewise.htm

compute Dependency = 0.
if HKAKIN60total ge 3 Dependency = 1.
exe.
igraph
 /x1 = var(HKAKIN60total) type = scale(min= -1 max = 6)
 /y = var(TotalMod) type = scale (min = 0 max = 42)
 /size var(Dependency) type = categorical
 /fitline method = regression linear line = meffect
 /catorder var(Dependency) (ascending values omitempty)
 /scatter coincident = none.

Moshe Marko, PT, DPT, MHS, OCS, CSCS
Assistant Professor
Department of Physical Therapy Education
College of Health Professions
SUNY Upstate Medical University
Room 2232  Silverman Hall
750 Adams Street
Syracuse, NY 13210-1834
315 464 6577
FAX 315 464 6887
[hidden email]

=====================
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: Using IGRAPH to show results of a piecewise regression

ViAnn Beadle
So what is the error message?

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Moshe Marko
Sent: Tuesday, February 16, 2010 11:31 AM
To: [hidden email]
Subject: Using IGRAPH to show results of a piecewise regression

Hi all,

I am conducting a piecewise regression and am trying to create a graph to
show the differences in the slopes. Im am using the following syntax and it
tells me that there is an error - am I missing something? I copied the
syntax from http://www.ats.ucla.edu/stat/Spss/faq/piecewise.htm

compute Dependency = 0.
if HKAKIN60total ge 3 Dependency = 1.
exe.
igraph
 /x1 = var(HKAKIN60total) type = scale(min= -1 max = 6)  /y = var(TotalMod)
type = scale (min = 0 max = 42)  /size var(Dependency) type = categorical
/fitline method = regression linear line = meffect  /catorder
var(Dependency) (ascending values omitempty)  /scatter coincident = none.

Moshe Marko, PT, DPT, MHS, OCS, CSCS
Assistant Professor
Department of Physical Therapy Education College of Health Professions SUNY
Upstate Medical University Room 2232  Silverman Hall
750 Adams Street
Syracuse, NY 13210-1834
315 464 6577
FAX 315 464 6887
[hidden email]

=====================
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: Using IGRAPH to show results of a piecewise regression

Moshe Marko
The message i get is:

"Image rendering error"

Moshe

Moshe Marko, PT, DPT, MHS, OCS, CSCS
Assistant Professor
Department of Physical Therapy Education
College of Health Professions
SUNY Upstate Medical University
Room 2232  Silverman Hall
750 Adams Street
Syracuse, NY 13210-1834
315 464 6577
FAX 315 464 6887
[hidden email]


>>> "ViAnn Beadle" <[hidden email]> 2/16/2010 6:21 PM >>>
So what is the error message?

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Moshe Marko
Sent: Tuesday, February 16, 2010 11:31 AM
To: [hidden email]
Subject: Using IGRAPH to show results of a piecewise regression

Hi all,

I am conducting a piecewise regression and am trying to create a graph to
show the differences in the slopes. Im am using the following syntax and
it
tells me that there is an error - am I missing something? I copied the
syntax from http://www.ats.ucla.edu/stat/Spss/faq/piecewise.htm

compute Dependency = 0.
if HKAKIN60total ge 3 Dependency = 1.
exe.
igraph
 /x1 = var(HKAKIN60total) type = scale(min= -1 max = 6)  /y =
var(TotalMod)
type = scale (min = 0 max = 42)  /size var(Dependency) type = categorical
/fitline method = regression linear line = meffect  /catorder
var(Dependency) (ascending values omitempty)  /scatter coincident = none.

Moshe Marko, PT, DPT, MHS, OCS, CSCS
Assistant Professor
Department of Physical Therapy Education College of Health Professions
SUNY
Upstate Medical University Room 2232  Silverman Hall
750 Adams Street
Syracuse, NY 13210-1834
315 464 6577
FAX 315 464 6887
[hidden email]

=====================
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: Using IGRAPH to show results of a piecewise regression

ViAnn Beadle
This means that the results cannot be drawn--this might occur if there is no
data (perhaps due to missing values), totally different scales are blended
together, etc. As far as I can tell, the chart you want is a scatterplot
with two regression lines corresponding to two categories of another
variable. I don't have your data nor do I recommend using IGRAPH since
GGRAPH and GPL are much more flexible. Here's my version:

GET
  FILE='C:\Users\Vi\Documents\spss17 testing\Employee data.sav'.
DATASET NAME DataSet1 WINDOW=FRONT.
RECODE educ (LOWEST THRU 12=0)(13 THRU HIGHEST=1) INTO highered.
VARIABLE LABELS highered "Post high school education".
VALUE LABELS highered 0 "No" 1 "Yes".

* Chart Builder.
GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=educ salary highered
    MISSING=LISTWISE REPORTMISSING=NO
  /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
  SOURCE: s=userSource(id("graphdataset"))
  DATA: educ=col(source(s), name("educ"))
  DATA: salary=col(source(s), name("salary"))
  DATA: highered=col(source(s), name("highered"), unit.category())
  GUIDE: axis(dim(1), label("Educational Level (years)"))
  GUIDE: axis(dim(2), label("Current Salary"))
  GUIDE: legend(aesthetic(aesthetic.color), label("Post high school
education"))
  SCALE: cat(aesthetic(aesthetic.color), include(".0", "1.00"))
  ELEMENT: point(position(educ*salary))
  ELEMENT: line(position(smooth.linear(educ*salary)), color(highered))
 END GPL.


Notes:
I split the employees into two groups using the RECODE command to create
variable highered.
The point ELEMENT creates the scatterplot for all cases.
The line ELEMENT creates the two regression lines. The color(highered)
function splits the groups and differentiates the lines by color.



-----Original Message-----
From: Moshe Marko [mailto:[hidden email]]
Sent: Wednesday, February 17, 2010 6:58 AM
To: ViAnn Beadle; [hidden email]
Subject: RE: Using IGRAPH to show results of a piecewise regression

The message i get is:

"Image rendering error"

Moshe

Moshe Marko, PT, DPT, MHS, OCS, CSCS
Assistant Professor
Department of Physical Therapy Education
College of Health Professions
SUNY Upstate Medical University
Room 2232  Silverman Hall
750 Adams Street
Syracuse, NY 13210-1834
315 464 6577
FAX 315 464 6887
[hidden email]


>>> "ViAnn Beadle" <[hidden email]> 2/16/2010 6:21 PM >>>
So what is the error message?

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Moshe Marko
Sent: Tuesday, February 16, 2010 11:31 AM
To: [hidden email]
Subject: Using IGRAPH to show results of a piecewise regression

Hi all,

I am conducting a piecewise regression and am trying to create a graph to
show the differences in the slopes. Im am using the following syntax and
it
tells me that there is an error - am I missing something? I copied the
syntax from http://www.ats.ucla.edu/stat/Spss/faq/piecewise.htm

compute Dependency = 0.
if HKAKIN60total ge 3 Dependency = 1.
exe.
igraph
 /x1 = var(HKAKIN60total) type = scale(min= -1 max = 6)  /y =
var(TotalMod)
type = scale (min = 0 max = 42)  /size var(Dependency) type = categorical
/fitline method = regression linear line = meffect  /catorder
var(Dependency) (ascending values omitempty)  /scatter coincident = none.

Moshe Marko, PT, DPT, MHS, OCS, CSCS
Assistant Professor
Department of Physical Therapy Education College of Health Professions
SUNY
Upstate Medical University Room 2232  Silverman Hall
750 Adams Street
Syracuse, NY 13210-1834
315 464 6577
FAX 315 464 6887
[hidden email]

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

GPL questions

Robert L
Now that I have got a reasonably good grip on GPL, there still are some issues I don't understand, and suggestions would be very welcome.

*My attempts to achieve a pattern in a boxplot do not work, nor do use of colors. The code used is
ELEMENT: schema(position(bin.quantile.letter(gender*exp_life)),texture.pattern(texture.pattern.grid))

It works in the sense that I get the boxplots, but there is not any pattern. Am I missing something here?

*Is there any way to specify the size of the plot? I would like to use a height smaller than the default since the plots are intended to be used in a report where space is fairly limited. I have been able to specify the width when exporting the graph to a eps-file, but that is not all I would like to change.

Suggestions anyone?

Robert

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

Re: GPL questions

ViAnn Beadle
It's curious that texture.pattern doesn't work here but you can get around
it with a chart template. I've created one that seems to work by editing the
chart in the editor and then checking off the Non-data element checkbox and
the Boxplot fill checkbox. I'll send that separately to Robert.

Size can be controlled via the PAGE statement wrapper, as in this example:

GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=minority salary
MISSING=LISTWISE REPORTMISSING=NO
  /GRAPHSPEC SOURCE=INLINE
   TEMPLATE=[
    "C:\Users\Vi\Desktop\boxfill.sgt"].
BEGIN GPL
  PAGE: begin(scale(400px,300px))
  SOURCE: s=userSource(id("graphdataset"))
  DATA: minority=col(source(s), name("minority"), unit.category())
  DATA: salary=col(source(s), name("salary"))
  GUIDE: axis(dim(1), label("Minority Classification"))
  GUIDE: axis(dim(2), label("Current Salary"))
  SCALE: cat(dim(1), include("0", "1"))
  SCALE: linear(dim(2), include(0))
  ELEMENT: schema(position(bin.quantile.letter(minority*salary)))
  PAGE: end()
END GPL.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Robert Lundqvist
Sent: Monday, March 08, 2010 3:32 AM
To: [hidden email]
Subject: GPL questions

Now that I have got a reasonably good grip on GPL, there still are some
issues I don't understand, and suggestions would be very welcome.

*My attempts to achieve a pattern in a boxplot do not work, nor do use of
colors. The code used is
ELEMENT:
schema(position(bin.quantile.letter(gender*exp_life)),texture.pattern(textur
e.pattern.grid))

It works in the sense that I get the boxplots, but there is not any pattern.
Am I missing something here?

*Is there any way to specify the size of the plot? I would like to use a
height smaller than the default since the plots are intended to be used in a
report where space is fairly limited. I have been able to specify the width
when exporting the graph to a eps-file, but that is not all I would like to
change.

Suggestions anyone?

Robert

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