Quantcast

plotting 95% bivariate confidence ellipses?

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

plotting 95% bivariate confidence ellipses?

Ian Martin-2
Is there any way to plot the 95% confidence ellipse for the data, or
for the mean, of a bivariate scatterplot in V. 16?

It seems odd that SPSS would buy SYSTAT, which had this capability in
the 1990s, and fail to implement it in SPSS, yet I can find no option
to do so in V. 16. Currently I'm kludging a solution from overlaying
SYSTAT plots or ADE-4 plots with SPSS scatterplots, but it's a lot of
work, especially since SPSS won't export graphs to Adobe Illustrator.

regards,
Ian Martin

Ian D. Martin, Ph.D.

Tsuji Laboratory
University of Waterloo
Dept. of Environment & Resource Studies

=====================
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: plotting 95% bivariate confidence ellipses?

ViAnn Beadle
Check out the region.confi.smooth.linear function in GPL. You'll find it
under Help>Base System>GPL Reference>Functions. Does this do what you want?

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Ian
Martin
Sent: Tuesday, April 29, 2008 7:52 AM
To: [hidden email]
Subject: plotting 95% bivariate confidence ellipses?

Is there any way to plot the 95% confidence ellipse for the data, or
for the mean, of a bivariate scatterplot in V. 16?

It seems odd that SPSS would buy SYSTAT, which had this capability in
the 1990s, and fail to implement it in SPSS, yet I can find no option
to do so in V. 16. Currently I'm kludging a solution from overlaying
SYSTAT plots or ADE-4 plots with SPSS scatterplots, but it's a lot of
work, especially since SPSS won't export graphs to Adobe Illustrator.

regards,
Ian Martin

Ian D. Martin, Ph.D.

Tsuji Laboratory
University of Waterloo
Dept. of Environment & Resource Studies

=====================
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: plotting 95% bivariate confidence ellipses?

Ian Martin-2
ViAnn,

I don't have any experience with GPL, but looking at the syntax and
the Help reference, it doesn't sound like what I need.  It seems to
provide facility to draw confidence limits for slopes -- or am I
misunderstanding?  I need to plot a confidence ellipse, which would
use the variance-covariance matrix to calculate a region enclosing
the data points, as per our paper in:
Bull. Environ. Contam. Toxicol. (2005) 75:903–909

I'll send you off-list a small example graph created in ADE-4 so you
can see what we are trying to do in SPSS. It would greatly simplify
matters if we can do this all in SPSS and avoid having to layer up
graphs of different format from different programmes.

Any feedback appreciated!

best regards,
Ian

Ian D. Martin, Ph.D.

Tsuji Laboratory
University of Waterloo
Dept. of Environment & Resource Studies


On 29 Apr, 2008, at 5:31 PM, ViAnn Beadle wrote:

> Check out the region.confi.smooth.linear function in GPL. You'll
> find it
> under Help>Base System>GPL Reference>Functions. Does this do what
> you want?
>
> -----Original Message-----
> From: SPSSX(r) Discussion [mailto:[hidden email]] On
> Behalf Of Ian
> Martin
> Sent: Tuesday, April 29, 2008 7:52 AM
> To: [hidden email]
> Subject: plotting 95% bivariate confidence ellipses?
>
> Is there any way to plot the 95% confidence ellipse for the data, or
> for the mean, of a bivariate scatterplot in V. 16?
>
> It seems odd that SPSS would buy SYSTAT, which had this capability in
> the 1990s, and fail to implement it in SPSS, yet I can find no option
> to do so in V. 16. Currently I'm kludging a solution from overlaying
> SYSTAT plots or ADE-4 plots with SPSS scatterplots, but it's a lot of
> work, especially since SPSS won't export graphs to Adobe Illustrator.
>
> regards,
> Ian Martin
>
> Ian D. Martin, Ph.D.
>
> Tsuji Laboratory
> University of Waterloo
> Dept. of Environment & Resource Studies
>
> =====================
> 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

=====================
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: plotting 95% bivariate confidence ellipses?

Kooij, A.J. van der
Below is syntax to plot 95% confidence ellipses for CORRESPONDENCE row and column scores. I gues (no time to check now, I'm in a hurry) it can be used generally by replacing the files tmpvar and tmpsc (in first 2 lines following MATRIX) by your  variance-covar matrix and variables.
 
Regards,
Anita van der Kooij
Data Theory Group
Leiden University
 
 

data list free/ rowcat_ sprof sexec shsup slsup sskil ssemi sunsk.

begin data.

1 50 19 26  8 18  6  2

2 16 40 34 18 31  8  3

3 12 35 65 66 123 23 21

4 11 20 58 110 223 64 32

5 14 36 114 185 714 258 189

6  0  6 19 40 179 143 71

7  0  3 14 32 141 91 106

end data.

 

value labels rowcat_ 1 'fprof' 2 'fexec' 3 'fhsup' 4 'flsup' 5 'fskil' 6 'fsemi' 7 'funsk'.

CORRESP

 /table = all (7,7)

 /print table rpoint cpoint

 /plot biplot

 /norm sym

 /outfile score('tmpsc.sav') var('tmpvar.sav').

 

** Compute 95% Confidence Ellipses (2 dim) **.

SET MXLOOP=2000.

MATRIX.

get varcovar /file= 'tmpvar.sav' /var = dim1 dim2.

get scores /file= 'tmpsc.sav' /var = dim1 dim2.

compute min=CMIN(scores).

compute max=CMAX(scores).

compute vxmax = sqrt(5.99*(max(1)-min(1))**2).

compute vymax = sqrt(5.99*(max(2)-min(2))**2).

compute h1=max(1)+vxmax-(min(1)-vxmax).

compute h2=max(2)+vymax-(min(2)-vymax).

compute v=h2/1000.

DO IF (h1>h2).

compute v=h1/1000.

END IF.

compute np=NROW(scores).

compute elp=MAKE(1+(2000*np),3,0).

compute c=1.

compute rowv=2.

compute rows=0.

compute tmp=MAKE(np,1,0).

LOOP n = 1 TO np.

compute vc=MAKE(2,2,0).

compute rowv=rowv+1.

compute vc(1,1)=varcovar(rowv,1) .

compute vc(1,2)=varcovar(rowv,2) .

compute rowv=rowv+1.

compute vc(2,1)=vc(1,2).

compute vc(2,2)=varcovar(rowv,2).

compute point=make(1,2,0).

compute rows=rows+1.

compute point(1,1)=scores(rows,1).

compute point(1,2)=scores(rows,2).

CALL EIGEN (vc, eigvec , eigval) .

compute hl=(sqrt(11.98*2*eigval))/2 .

compute q=hl(1) * eigvec(1,1).

compute r= hl(1) * eigvec(2,1).

compute s= hl(2) * eigvec(1,1).

compute tt= hl(2) * eigvec(2,1).

compute elp(1,1)=point(1) + q.

compute elp(1,2)=point(2) + r.

compute elp(1,3)=1.

compute f=v/hl(1).

**f is step size: f*x, x>1 -> less points **.

compute pi=4*artan(1).

compute nrelp=trunc((2*pi)/f).

compute tmp(n)=nrelp.

compute a=0.

LOOP i = 1 TO nrelp.

compute a=a+f.

compute elp(i+c,1)=point(1) + q*cos(a) - tt*sin(a).

compute elp(i+c,2)=point(2) + r*cos(a) + s*sin(a).

compute elp(i+c,3)=1.

END LOOP.

compute c=c+nrelp.

END LOOP.

save elp /outfile='elp.sav'  /var=dim1 dim2 pid.

END MATRIX.

 

get file= 'tmpsc.sav'.

compute pid=2.

save outfile='tmp.sav' /keep dim1 dim2 pid.

get file= 'tmp.sav'.

add files /file=*

 /file='elp.sav'.

execute.

select if(pid ~= 0).

 

graph /scatterplot(bivar)= dim1 with dim2 .

 

*compute id=$casenum.

*graph /scatterplot(bivar)= dim1 with dim2 by pid by id(identify).

 

________________________________

From: SPSSX(r) Discussion on behalf of Ian Martin
Sent: Wed 30/04/2008 17:22
To: [hidden email]
Subject: Re: plotting 95% bivariate confidence ellipses?



ViAnn,

I don't have any experience with GPL, but looking at the syntax and
the Help reference, it doesn't sound like what I need.  It seems to
provide facility to draw confidence limits for slopes -- or am I
misunderstanding?  I need to plot a confidence ellipse, which would
use the variance-covariance matrix to calculate a region enclosing
the data points, as per our paper in:
Bull. Environ. Contam. Toxicol. (2005) 75:903-909

I'll send you off-list a small example graph created in ADE-4 so you
can see what we are trying to do in SPSS. It would greatly simplify
matters if we can do this all in SPSS and avoid having to layer up
graphs of different format from different programmes.

Any feedback appreciated!

best regards,
Ian

Ian D. Martin, Ph.D.

Tsuji Laboratory
University of Waterloo
Dept. of Environment & Resource Studies


On 29 Apr, 2008, at 5:31 PM, ViAnn Beadle wrote:

> Check out the region.confi.smooth.linear function in GPL. You'll
> find it
> under Help>Base System>GPL Reference>Functions. Does this do what
> you want?
>
> -----Original Message-----
> From: SPSSX(r) Discussion [mailto:[hidden email]] On
> Behalf Of Ian
> Martin
> Sent: Tuesday, April 29, 2008 7:52 AM
> To: [hidden email]
> Subject: plotting 95% bivariate confidence ellipses?
>
> Is there any way to plot the 95% confidence ellipse for the data, or
> for the mean, of a bivariate scatterplot in V. 16?
>
> It seems odd that SPSS would buy SYSTAT, which had this capability in
> the 1990s, and fail to implement it in SPSS, yet I can find no option
> to do so in V. 16. Currently I'm kludging a solution from overlaying
> SYSTAT plots or ADE-4 plots with SPSS scatterplots, but it's a lot of
> work, especially since SPSS won't export graphs to Adobe Illustrator.
>
> regards,
> Ian Martin
>
> Ian D. Martin, Ph.D.
>
> Tsuji Laboratory
> University of Waterloo
> Dept. of Environment & Resource Studies
>
> =====================
> 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

=====================
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



**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
**********************************************************************

====================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
Loading...