display fit line in chart

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

display fit line in chart

Brian Moore-3
Hi all-

Is there any way to specify a fit line be included in chart syntax?


GRAPH
  /SCATTERPLOT(BIVAR)=Nresp WITH Overall_Rating BY CID (IDENTIFY)
  /MISSING=LISTWISE .

I'd like to avoid having to edit each chart & also sometimes the option
(under add chart element) is grayed out for reasons I don't understand when
I do approach this task manually.

Thanks,
Brian
Reply | Threaded
Open this post in threaded view
|

Re: display fit line in chart

Maguin, Eugene
Brian,

No. You have to use Igraph. An example follows. Note the 'Fitline Method ...
Subcommand. No doubt you can use GPL; I haven't.

IGRAPH /VIEWNAME='Scatterplot'/X1=VAR(P1CTSM2) TYPE=SCALE/
   Y = VAR(PRP2CTSM2) TYPE=SCALE /STYLE=VAR(GROUP)/
   COORDINATE=VERTICAL/
   FITLINE METHOD=REGRESSION LINEAR LINE=MEFFECT SPIKE=OFF/
   X1LENGTH=3.0/YLENGTH=3.0/X2LENGTH=3.0/CHARTLOOK='NONE'/
   CATORDER VAR(GROUP) (ASCENDING VALUES OMITEMPTY)/
   SCATTER COINCIDENT=NONE.


Gene Maguin
Reply | Threaded
Open this post in threaded view
|

Re: display fit line in chart

Jason Burke
This GPL wiill produce the scatterplot with a fit line at total,
assuming you have SPSS 14 (or higher):

GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=Nresp Overall_Rating CID
    MISSING=LISTWISE REPORTMISSING=NO
  /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
 SOURCE: s=userSource(id("graphdataset"))
 DATA: Nresp=col(source(s), name("Nresp"))
 DATA: Overall_Rating=col(source(s), name("Overall_Rating"))
 DATA: CID=col(source(s), name("CID"), unit.category())
 GUIDE: axis(dim(1), label("Nresp Label"))
 GUIDE: axis(dim(2), label("Overall_Rating Label"))
 GUIDE: legend(aesthetic(aesthetic.color.exterior), label("CID"))
 SCALE: cat(aesthetic(aesthetic.color.exterior))
 ELEMENT: point(position(Nresp*Overall_Rating), color.exterior(CID))
 ELEMENT: line(position(smooth.linear(Nresp*Overall_Rating)))
END GPL.

HTH,


Jason

On 10/21/06, Gene Maguin <[hidden email]> wrote:

> Brian,
>
> No. You have to use Igraph. An example follows. Note the 'Fitline Method ...
> Subcommand. No doubt you can use GPL; I haven't.
>
> IGRAPH /VIEWNAME='Scatterplot'/X1=VAR(P1CTSM2) TYPE=SCALE/
>   Y = VAR(PRP2CTSM2) TYPE=SCALE /STYLE=VAR(GROUP)/
>   COORDINATE=VERTICAL/
>   FITLINE METHOD=REGRESSION LINEAR LINE=MEFFECT SPIKE=OFF/
>   X1LENGTH=3.0/YLENGTH=3.0/X2LENGTH=3.0/CHARTLOOK='NONE'/
>   CATORDER VAR(GROUP) (ASCENDING VALUES OMITEMPTY)/
>   SCATTER COINCIDENT=NONE.
>
>
> Gene Maguin
>