Data visualization with SAS programming

Does anyone know the details of what PROC SGPLOT - ELLIPSE does?

Reply
Occasional Contributor
Posts: 15

Does anyone know the details of what PROC SGPLOT - ELLIPSE does?

I am updating an older ellipse routine (below) that uses IML with GPLOT to generate scatter plots with ellipses (this was shamelessly lifted off the web some time ago, so my apologies if I am referencing your code without citing you).  I have written some code to replicate this with SGPLOT and the ELLIPSE statement (also below).  Both should be 95% prediction regions, however, the SGPLOT versions appear quite a bit larger than the older IML ones.  From what I can tell, the IML routine is doing things correctly with the right values, but the SAS documentation on SGPLOT is pretty sparse. Playing around with this by eyeball, the IML version appears to be approximately equivalent to an 85% region from SGPLOT.  Does anyone have some ideas here?  Thank you for any thoughts on this.

Bill Price

Attachment
Attachment
SAS Super FREQ
Posts: 1,141

Re: Does anyone know the details of what PROC SGPLOT - ELLIPSE does?

The SGPLOT ELLIPSE statement is essentially a wrapper on the GTL ELLIPSE statement.  For full details on the computation of the Confidence and Prediction Ellipse, see the doc for GTL ELLIPSE statement under the "Graph Template Language Reference Guide" in the Help->SAS Help and Documentation menu entry at the top.

Occasional Contributor
Posts: 15

Re: Does anyone know the details of what PROC SGPLOT - ELLIPSE does?

Sanjay,

          Thank you.  This answers the question for me. The IML routine is based on an assumption that the quadratic form is distributed as chi-square(2df), while the GTL routine is based on an F distribution (2, n-2 df).  Hence the difference is sample size.  IML makes a large sample size assumption, while GTL does not.  My small sample size in the example is demonstrating the difference. Indeed, increasing the sample size to 1000 in my examples gives essentially identical results.  Thank you very much for your help on this!

Bill Price

SAS Super FREQ
Posts: 3,630

Re: Does anyone know the details of what PROC SGPLOT - ELLIPSE does?

I did a careful analysis of the computations behind the ELLIPSE statement and show how to get the same results by using SAS/IML.

The GTL article is here http://blogs.sas.com/content/iml/2014/07/21/add-prediction-ellipse/

but the details of the computation (with IML code) is here: http://blogs.sas.com/content/iml/2014/07/23/prediction-ellipses-from-covariance/

The details and assumptions of prediction ellipses are included in the doc for PROC CORR.

Occasional Contributor
Posts: 15

Re: Does anyone know the details of what PROC SGPLOT - ELLIPSE does?

Thank you Rick, those explain things well.  I believe your sgplot page was the basis of my code, so thank you for that as well Smiley Happy.

Bill Price

Ask a Question
Discussion stats
  • 4 replies
  • 423 views
  • 2 likes
  • 3 in conversation