BookmarkSubscribeRSS Feed
pdiff
Obsidian | Level 7

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

4 REPLIES 4
Jay54
Meteorite | Level 14

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.

pdiff
Obsidian | Level 7

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

Rick_SAS
SAS Super FREQ

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.

pdiff
Obsidian | Level 7

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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 1086 views
  • 2 likes
  • 3 in conversation