03-10-2015 10:31 PM
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.
03-11-2015 08:42 AM
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.
03-11-2015 11:25 AM
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!
03-11-2015 12:58 PM
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.
03-11-2015 01:35 PM
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 .