Diff for "FAQ/points" - CBU statistics Wiki
location: Diff for "FAQ/points"
Differences between revisions 2 and 5 (spanning 3 versions)
Revision 2 as of 2007-06-08 10:27:45
Size: 685
Editor: PeterWatson
Comment:
Revision 5 as of 2007-06-08 10:45:05
Size: 916
Editor: PeterWatson
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:

 
= How do I scatterplot observations which have the same set of co-ordinates? =
= How do I scatterplot observations which have the same set of co-ordinates? =
Line 6: Line 5:
One way of disentangling this is to add a proportionately small amount to the observed values of one of the variables, say, y. The below syntax uses the rv.uniform function in SPSS to add a small random amount to the y values. The new values which are now all unique (ynew) can then be plotted against x. One way of disentangling this is to add a proportionately small amount to the observed values of one of the variables, say, y. The below syntax uses the rv.uniform function in SPSS to add a small random amount to the y values when an x,y combination has previously occurred. The new values which are now all unique (ynew) can then be plotted against x.
Line 9: Line 8:
COMPUTE YNEW = Y + RV.UNIFORM(Y*0.01,Y*0.015). sort cases by x.
exe.
sort cases by y.
exe.
COMPUTE copy=0.
DO IF ($CASENUM NE 1).
IF (x EQ LAG(x) AND y EQ LAG(y)) copy = 1.
END IF.
EXECUTE.

compute ynew = y.
if (copy eq 1) YNEW = Y + RV.UNIFORM(Y*0.01,Y*0.015).

How do I scatterplot observations which have the same set of co-ordinates?

Sometimes the same co-ordinates are shared by more than one observation. A scatterplot will only, however, show one point for each unique x,y combination regardless of the number of observations that share this combination.

One way of disentangling this is to add a proportionately small amount to the observed values of one of the variables, say, y. The below syntax uses the rv.uniform function in SPSS to add a small random amount to the y values when an x,y combination has previously occurred. The new values which are now all unique (ynew) can then be plotted against x.

sort cases by x.
exe.
sort cases by y.
exe.
COMPUTE copy=0. 
DO IF ($CASENUM NE 1). 
IF (x EQ LAG(x) AND y EQ LAG(y)) copy = 1. 
END IF. 
EXECUTE. 

compute ynew = y.
if (copy eq 1) YNEW = Y + RV.UNIFORM(Y*0.01,Y*0.015). 
EXE.

None: FAQ/points (last edited 2013-03-08 10:17:37 by localhost)