2
$\begingroup$

Borrowing from this post on SAS and R: http://sas-and-r.blogspot.com/2011/07/example-92-transparency-and-bivariate.html

I've got a large collection of data that's best approached (or at least well approached) using some sort of scatter plot with smoothing or binning. R's smoothScatter function works marvelously, but it has a large number of bins (128 is the default I believe).

The problem is the contour plot in SAS 9.2. There appears to only be 10 levels possible in the SAS contour plot. The data itself has tons of values around zero, and then a spread of more positive values that are all getting lumped together in one category, and thus hidden in the plot.

Does anyone know how to increase the number of contours SAS will plot, or is it fixed at 10? For example, the plot in R showing where I want to be roughly, and the closest I have gotten in SAS:

Smoothed R Plot

SAS

$\endgroup$
2
$\begingroup$

The BWM = option to the BIVAR statement specifies the bandwidth multiplier. The default is 1. To get a "bumpier" graph (which would correspond to more bins) set BWM to less than 1.

I believe this will get you what you want, but you may have to play around with the choice.

$\endgroup$
  • 1
    $\begingroup$ BWM was something I had tried when I was attempting this. It's weird data (its actually a scatter plot of many, many runs of a simulation). The problem is there is one point that very simulation has to go through, so its a very dark point. In SAS, all ten bands just get dominated by that point. Tried varying BWM from 0.01 to 3.0 by steps of 0.05 with no real success. $\endgroup$ – Fomite Aug 31 '11 at 22:15
  • $\begingroup$ If your data are weird enough (tons of 0's, points things HAVE to go through) then no method is going to get rid of all the weirdness, nor would you want it to. You could try separating the non 0 values, I guess. It's hard to know what to recommend because I don't really know what you want to get. $\endgroup$ – Peter Flom Sep 2 '11 at 11:15
  • $\begingroup$ I added some pictures above of the closest I've gotten with SAS, and what I'm trying to duplicate (the R) plot. $\endgroup$ – Fomite Sep 2 '11 at 20:44
1
$\begingroup$

Unfortunately, I think the only way to do this is to edit the underlying Stat.KDE.Graphics.Contour template, which is not for the faint of heart. See the PROC TEMPLATE example at http://support.sas.com/documentation/cdl/en/statug/63962/HTML/default/viewer.htm#statug_ods_sect016.htm

$\endgroup$
  • $\begingroup$ Not for the faint of heart indeed. I'll take a look at that as a possible solution, but that starts to lose out to pointing people to "just use R for this one". $\endgroup$ – Fomite Sep 2 '11 at 21:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.