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
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.
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
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.
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 .
Bill Price
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.
Ready to level-up your skills? Choose your own adventure.