Here is an example drawing the S curve you ask for. The superimposed points

don't make sense in comparison here (given the random intercept they won't

necessarily line up).

*********************************************************************************************.

*X actually only goes from 2.5 to 10.

*Plotting larger range to illustrate the S curve.

INPUT PROGRAM.

COMPUTE #XMin = -25.

COMPUTE #XMax = 40.

COMPUTE #GridSize = 1000.

COMPUTE #Step = (#XMax - #XMin)/(#GridSize-1).

LOOP #X = 1 TO #GridSize.

COMPUTE X = #XMin + (#X - 1)*#Step.

END CASE.

END LOOP.

END FILE.

END INPUT PROGRAM.

DATASET NAME Logit.

*Inverse logit to go to probability scale.

DEFINE !INVLOGIT (!POSITIONAL !ENCLOSE("(",")") )

1/(1 + EXP(-!1))

!ENDDEFINE.

*If you want a more automated way, either save parameter file.

*Or get these from OMS.

COMPUTE #Int = -2.143.

COMPUTE #X_Eff = 0.196.

COMPUTE #Lin = #Int + X*#X_Eff.

COMPUTE Prob = !INVLOGIT(#Lin).

EXECUTE.

*Now make the graph with just the line.

GGRAPH

/GRAPHDATASET NAME="graphdataset" VARIABLES=X Prob MISSING=LISTWISE

REPORTMISSING=NO

/GRAPHSPEC SOURCE=INLINE.

BEGIN GPL

SOURCE: s=userSource(id("graphdataset"))

DATA: X=col(source(s), name("X"))

DATA: Prob=col(source(s), name("Prob"))

GUIDE: axis(dim(1), label("X"))

GUIDE: axis(dim(2), label("Probability"))

ELEMENT: line(position(X*Prob))

END GPL.

*If you restrict to actual X values the line is pretty straight though.

GGRAPH

/GRAPHDATASET NAME="graphdataset" VARIABLES=X Prob MISSING=LISTWISE

REPORTMISSING=NO

/GRAPHSPEC SOURCE=INLINE.

BEGIN GPL

SOURCE: s=userSource(id("graphdataset"))

DATA: X=col(source(s), name("X"))

DATA: Prob=col(source(s), name("Prob"))

GUIDE: axis(dim(1), label("X"))

GUIDE: axis(dim(2), label("Probability"))

SCALE: linear(dim(1), min(2.5), max(10))

ELEMENT: line(position(X*Prob))

END GPL.

*Might actually want to superimpose points from actual dataset as a rug.

*See

https://andrewpwheeler.wordpress.com/2012/05/20/bean-plots-in-spss/.

*And

https://andrewpwheeler.wordpress.com/2017/02/07/side-by-side-charts-in-spss/.

*********************************************************************************************.

-----

Andy W

[hidden email]
http://andrewpwheeler.wordpress.com/--

Sent from:

http://spssx-discussion.1045642.n5.nabble.com/=====================

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