turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- SAS/GRAPH and ODS Graphics
- /
- Regression Plot Matrix with insets

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

07-17-2014 01:06 PM

Hi,

I'm looking to create a scatter plot matrix with regression lines that also displays the r-squared and p value in an inset for each graph. I have tried using proc template with scatterplotmatrix, but I can only get a pearson correlation in the inset, and no regression line. I also tried proc sgscatter, but cannot get the inset to display the statistical information I need. Does anybody have any suggestions on how I can accomplish this?

Thanks

ods graphics on;

proc sgscatter data=work.query_for_stabsummarytablesfilte;

compare y=(FairnessIdxAvgTotal_Mean EqGiniVisibleTotal ) x=(GES1_SUM GES61_SUM COH4_SUM)

/ Legend=(Position=Bottom) reg=(clm nogroup) ;

Title "Group Variables";

label FairnessIdxAvgTotal_Mean="Group Fairness Idx"

EqGiniVisibleTotal = "Equality Barrier Reveals"

GES1_SUM = "GES:Unity"

GES61_SUM = "GESroud"

COH4_SUM = 'PCQ:Best Anywhere';

WHERE groupName = 'A' OR groupName = 'B' OR groupName = 'C' OR groupName = 'D' OR groupName = 'E';

run;

proc template;

define statgraph spminset;

begingraph;

entrytitle "Group TPT Metrics and Cohesion";

entrytitle 'Concordia 2013';

layout gridded;

scatterplotmatrix GES1_SUM GES61_SUM COH4_SUM/

rowvars=(FairnessIdxAvgTotal_Mean EqGiniVisibleTotal)

inset=(nobs pearson pearsonpval)

insetopts=( border=true opaque = true)

corropts=(nomiss=true vardef=df)

markerattrs=(size=4px)

ellipse=(alpha=.20 type=predicted);

endlayout;

endgraph;

end;

run;

proc sgrender data=work.query_for_stabsummarytablesfilte template=spminset;

WHERE groupName = 'A' OR groupName = 'B' OR groupName = 'C' OR groupName = 'D' OR groupName = 'E';

label FairnessIdxAvgTotal_Mean ="Group Fairness Idx"

EqGiniVisibleTotal = "Equality Barrier Reveals"

GES1_SUM = "GES:Unity"

GES61_SUM = "GESroud"

COH4_SUM = 'PCQ:Best Anywhere' ;

run;

ods graphics off;

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to cyanezIBR

07-17-2014 01:22 PM

Here's an example of the reg line using sgscatter, not sure about the inset part.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Reeza

07-18-2014 12:34 PM

yes, i was able to use SGSCATTER to create the graphs, however I'd like to have p-value and r-squared listed for each plot. It seems that SGSCATTER has no options for this.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to cyanezIBR

07-23-2014 08:14 AM

If the values are calculated outside, put them into macro variable and use a legend. Ive done similar for pvalues using the legend examples below

legenditem type=marker name="PValue" / LABEL="Log rank test: p=&PValue" lineattrs=GraphData1(color=black THICKNESS=10)

labelattrs=(size=8 family="Arial") markerattrs=(size=0);

discretelegend "PValue" / titleattrs=(size=9 family="Arial")

BORDER=false across=1 location=inside

halign=left valign=bottom pad=(bottom=35);

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Adie_efc

07-24-2014 10:01 AM

For a small 3x3 with custom labels using GTL, you could build the matrix yourself. That is what is happening in the background anyway. Use a LAYOUT LATTICE with a 3x3 row-column layout, and insert the necessary scatter, reg and insets into the cells yourself. Quite doable, especially for a small matrix.

If you want ROWVARS, you can create the appropriate combinations. The general idea is shown in this article, but you can see what needs to be done and customize to your needs. Compact Scatter Plot Matrix - Graphically Speaking