sasmultivariate-testingsas-studio

What is the ellipse’s centroid written as a numerical vector?


I used proc corr to find pearson and plot scatter with ellipses of 70% and 90%. to finde ellipses's centroid is it the mean value of variables that were use in this process?

i tried proc corr in sas studio and it provide me pearson Im expect to find elllipses's centroid but not sure if it mean value


Solution

  • From the documentation, the ellipses is calculated based on a bivariate normal distribution. The distribution is centered on (mu_x, mu_y).

    Suppose we use the traditional Iris dataset to plot petal width vs. petal length. We'll add a marker for the point (mean_PetalWidth, mean_PetalLength) and see where it is on the graph.

    proc sql;
        create table PetalMean as
            select mean(PetalWidth) as mean_PetalWidth 
                 , mean(PetalLength) as mean_PetalLength
            from sashelp.iris
            where species='Versicolor'
        ;
    quit;
    
    data iris;
        set sashelp.iris(where=(species='Versicolor'))
            PetalMean 
        ;
        
        keep PetalWidth PetalLength mean:;
    run;
    
    proc sgplot data=iris;
        scatter x=PetalWidth y=PetalLength / legendlabel='PetalWidth vs. PetalLength';
        ellipse x=PetalWidth y=PetalLength;
        scatter x=mean_PetalWidth y=mean_PetalLength / markerattrs=(symbol=x size=25) 
                                                       legendlabel='Ellipse Centroid'
        ;
    run;
    

    enter image description here

    We can see that it is clearly centered exactly around (13.26, 42.6), or the mean values of X and Y.

    One other way to see this is by looking at the data itself. Let's create an ellipse with SGPlot and output the ellipse data SAS is using in the background.

    proc sgplot data=iris;
        ellipse x=PetalWidth y=PetalLength;
        ods output SGPlot;
    run;
    

    The two variables ELLIPSE(PetalWidth,PetalLeng__XO and ELLIPSE(PetalWidth,PetalLeng__YO hold the centroid of the ellipse.

    ELLIPSE(PetalWidth,PetalLeng__XO    ELLIPSE(PetalWidth,PetalLeng__YO
    13.26                                42.6