I didn't see any replies to this so here's one using GPL. The
region.confi.smooth.linear function is used to provide the confidence
intervals as lines.
input program.
loop #i = 1 to 100.
compute x = #i.
compute y =RV.NORMAL(0,9) + x.
end case.
end loop.
end file.
end input program.
list.
* Chart Builder with added ELEMENT statement to get the confidence interval.
GGRAPH
/GRAPHDATASET NAME="graphdataset" VARIABLES=x y MISSING=LISTWISE
REPORTMISSING=NO
/GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
SOURCE: s=userSource(id("graphdataset"))
DATA: x=col(source(s), name("x"))
DATA: y=col(source(s), name("y"))
GUIDE: axis(dim(1), label("x"))
GUIDE: axis(dim(2), label("y"))
ELEMENT: point(position(x*y))
ELEMENT: line(position(region.confi.smooth.linear(x*y, alpha(0.99))))
END GPL.
-----Original Message-----
From: SPSSX(r) Discussion [mailto:
[hidden email]] On Behalf Of
Brad
Sent: Thursday, June 27, 2013 2:56 AM
To:
[hidden email]
Subject: twoway scatter lfit ci equivalent in SPSS
Hi,
How do I fit 95% CI's running parallel alongside the line of best fit in a
scatter plot?
The equivalent STATA syntax is:
Stata syntax
clear
* generate random dataset
set obs 100
gen x = _n
gen y = rnormal(0,9) + x
* scatter
scatter y x
* scatter with 95% CIs
twoway lfitci y x
* you can also have both on the same graph - twoway scatter y x || lfitci y
x
Thanks,
Brad
=====================
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