Re: Putting thumb wheels and (smoothing or regression surface) on a 3-D scatterplot using GPL

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

Re: Putting thumb wheels and (smoothing or regression surface) on a 3-D scatterplot using GPL

Mike P-5
Hi Art,

As per the Dev central forum

INPUT PROGRAM.
LOOP id=0 TO 2499.
END CASE.
END LOOP.
END FILE.
END INPUT PROGRAM.
EXE.
FORMATS id (F8.0).
compute #tmp1 = trunc(id/50).
compute x = -10 +(20/49)* #tmp1.
compute #tmp2 = mod(id, 50).
compute y = -10 +(20/49)* (#tmp2).
compute #tmp3 = (x**2+y**2)**0.5.
compute z =10* sin(#tmp3)/#tmp3.
exe.
GGRAPH
 /GRAPHDATASET NAME="graphdataset" VARIABLES=x z y MISSING=LISTWISE
  REPORTMISSING=NO
 /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
 SOURCE: s=userSource(id("graphdataset"))
 DATA: x=col(source(s), name("x"))
 DATA: z=col(source(s), name("z"))
 DATA: y=col(source(s), name("y"))
 COORD: rect(dim(1,2,3))
 GUIDE: axis(dim(1), label("y"))
 GUIDE: axis(dim(2), label("x"))
 GUIDE: axis(dim(3), label("z"))
 ELEMENT: line(position(y*x*z), color(z))
END GPL.

This will give you a surface chart, as for the thumb wheels, I'm not to
sure?  Perhaps there is the possibility of writing some variety of hack
using WXpython and the programmability... though I doubt this is
possible

Mike

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Art Kendall
Sent: 24 May 2007 23:31
To: [hidden email]
Subject: Putting thumb wheels and (smoothing or regression surface) on a
3-D scatterplot using GPL

In *GPL* how do I get  thumb wheels to rotate 3-d charts?

In GPL how do I get a smoothed regression surface?


This IGRAPH shows how to do it, but I was curious how to do it in GPL.

GET
  FILE='C:\Program Files\SPSS15\Cars.sav'.
IGRAPH /VIEWNAME='Scatterplot' /X1 = VAR(weight) TYPE = SCALE /Y =
VAR(mpg) TYPE = SCALE /X2 = VAR(engine) TYPE = SCALE
 /COORDINATE = THREE  /FITLINE METHOD = LLR NORMAL BANDWIDTH = FAST
X1MULTIPLIER = 1.00  X2MULTIPLIER = 1.00 LINE = TOTAL
  SPIKE=OFF /X1LENGTH=3.0 /YLENGTH=3.0 /X2LENGTH=3.0 /CHARTLOOK='NONE'
/SCATTER COINCIDENT = NONE.
EXE.

Art Kendall
Social Research Consultants

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________
Reply | Threaded
Open this post in threaded view
|

Re: Putting thumb wheels and (smoothing or regression surface) on a 3-D scatterplot using GPL

Beadle, ViAnn
Here are some changes required to produce this chart in SPSS 15:
GGRAPH
 /GRAPHDATASET NAME="graphdataset" VARIABLES=x z y MISSING=LISTWISE
  REPORTMISSING=NO
 /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
 SOURCE: s=userSource(id("graphdataset"))
 DATA: x=col(source(s), name("x"))
 DATA: z=col(source(s), name("z"))
 DATA: y=col(source(s), name("y"))
 COORD: rect(dim(1,2,3))
 GUIDE: axis(dim(1), label("y"))
 GUIDE: axis(dim(2), label("x"))
 GUIDE: axis(dim(3), label("z"))
 GUIDE: legend(aesthetic(aesthetic.color), null())
 ELEMENT: line(position(y*x*z), color(summary.max(z)))
 END GPL.

GPL now requires a summary function for the line element and the algebra for the color function satisfies that plus nicely colors the plot.

In the next release of SPSS, GPL will contain a new surface element that will fill in the vertices so that the surface is solid and continuous.


-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Michael Pearmain
Sent: Friday, May 25, 2007 2:32 AM
To: [hidden email]
Subject: Re: Putting thumb wheels and (smoothing or regression surface) on a 3-D scatterplot using GPL

Hi Art,

As per the Dev central forum

INPUT PROGRAM.
LOOP id=0 TO 2499.
END CASE.
END LOOP.
END FILE.
END INPUT PROGRAM.
EXE.
FORMATS id (F8.0).
compute #tmp1 = trunc(id/50).
compute x = -10 +(20/49)* #tmp1.
compute #tmp2 = mod(id, 50).
compute y = -10 +(20/49)* (#tmp2).
compute #tmp3 = (x**2+y**2)**0.5.
compute z =10* sin(#tmp3)/#tmp3.
exe.
GGRAPH
 /GRAPHDATASET NAME="graphdataset" VARIABLES=x z y MISSING=LISTWISE
  REPORTMISSING=NO
 /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
 SOURCE: s=userSource(id("graphdataset"))
 DATA: x=col(source(s), name("x"))
 DATA: z=col(source(s), name("z"))
 DATA: y=col(source(s), name("y"))
 COORD: rect(dim(1,2,3))
 GUIDE: axis(dim(1), label("y"))
 GUIDE: axis(dim(2), label("x"))
 GUIDE: axis(dim(3), label("z"))
 ELEMENT: line(position(y*x*z), color(z))
END GPL.

This will give you a surface chart, as for the thumb wheels, I'm not to
sure?  Perhaps there is the possibility of writing some variety of hack
using WXpython and the programmability... though I doubt this is
possible

Mike

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Art Kendall
Sent: 24 May 2007 23:31
To: [hidden email]
Subject: Putting thumb wheels and (smoothing or regression surface) on a
3-D scatterplot using GPL

In *GPL* how do I get  thumb wheels to rotate 3-d charts?

In GPL how do I get a smoothed regression surface?


This IGRAPH shows how to do it, but I was curious how to do it in GPL.

GET
  FILE='C:\Program Files\SPSS15\Cars.sav'.
IGRAPH /VIEWNAME='Scatterplot' /X1 = VAR(weight) TYPE = SCALE /Y =
VAR(mpg) TYPE = SCALE /X2 = VAR(engine) TYPE = SCALE
 /COORDINATE = THREE  /FITLINE METHOD = LLR NORMAL BANDWIDTH = FAST
X1MULTIPLIER = 1.00  X2MULTIPLIER = 1.00 LINE = TOTAL
  SPIKE=OFF /X1LENGTH=3.0 /YLENGTH=3.0 /X2LENGTH=3.0 /CHARTLOOK='NONE'
/SCATTER COINCIDENT = NONE.
EXE.

Art Kendall
Social Research Consultants

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________
Reply | Threaded
Open this post in threaded view
|

Converting date (not spss date) to number

Jeff-125
I have an spss string variable with a date entered from another
program in a format like below. Notice that the month is "5" and not
"05". I need to covert this date/string and time into a number so
that I can subtract the survey finish time from the survey start time
to get the time needed for survey completion.

If I fought with this long enough, I'm sure that I could get it
right, but figured that someone out there could point me to already
written code that will do the trick. I couldn't find what I was
looking for the normal way.

5/25/2007 5:34:23 PM

Thanks



Jeff
Reply | Threaded
Open this post in threaded view
|

Re: Converting date (not spss date) to number

Raynald Levesque-2
Hi Jeff,

The following assumes the survey is completed in the same day it is started
(so the date is ignored),

DATA LIST /datestr 1-25(A).
BEGIN DATA
5/25/2007 5:34:23 PM
5/25/2007 5:34:23 AM
5/25/2007 00:00:00 AM
5/25/2007 12:00:00 PM
5/25/2007 12:15:00 PM
5/25/2007 1:15:00 PM
END DATA.

STRING time1(A13).
COMPUTE time1=SUBSTR(datestr,INDEX(datestr,' ')).
COMPUTE time2=NUMBER(time1,TIME8).
FORMATS time2(TIME8).
IF (INDEX(time1,'PM')>0 AND XDATE.HOUR(time2)<>12) time2 = time2 + 12*60*60.
EXE.

Cheers!

Raynald Levesque [hidden email]
SPSS site:  www.spsstools.net


On 5/25/07, Jeff <[hidden email]> wrote:

>
> I have an spss string variable with a date entered from another
> program in a format like below. Notice that the month is "5" and not
> "05". I need to covert this date/string and time into a number so
> that I can subtract the survey finish time from the survey start time
> to get the time needed for survey completion.
>
> If I fought with this long enough, I'm sure that I could get it
> right, but figured that someone out there could point me to already
> written code that will do the trick. I couldn't find what I was
> looking for the normal way.
>
> 5/25/2007 5:34:23 PM
>
> Thanks
>
>
>
> Jeff
>