Posts Tagged ‘ SAS macro ’

Example 9.16: Small multiples

November 29, 2011
By
Example 9.16: Small multiples

Small multiples are one of the great ideas of graphics visionary Edward Tufte (e.g., in Envisioning Information). Briefly, the idea is that if many variations on a theme are presented, differences quickly become apparent. Today we offer general guida...

Read more »

Example 8.35: Grab true (not pseudo) random numbers; passing API URLs to functions or macros

April 19, 2011
By
Example 8.35: Grab true (not pseudo) random numbers; passing API URLs to functions or macros

Usually, we're content to use a pseudo-random number generator. But sometimes we may want numbers that are actually random-- an example might be for randomizing treatment status in a randomized controlled trial.The site Random.org provides truly rando...

Read more »

Example 8.34: lack of robustness of t test with small n

April 12, 2011
By
Example 8.34: lack of robustness of t test with small n

Tim Hesterberg has effectively argued for a larger role for resampling based inference in introductory statistics courses (and statistical practice more generally). While the Central Limit Theorem is a glorious result, and the Student t-test remarkabl...

Read more »

Example 8.30: Compare Poisson and negative binomial count models

March 15, 2011
By
Example 8.30:  Compare Poisson and negative binomial count models

How similar can a negative binomial distribution get to a Poisson distribution?When confronted with modeling count data, our first instinct is to use Poisson regression. But in practice, count data is often overdispersed. We can fit the overdispersio...

Read more »

Example 8.4: Including subsetting conditions in output

September 7, 2010
By
Example 8.4: Including subsetting conditions in output

A number of analyses perform operations on subsets. Making it clear what observations have been excluded or included is helpful to include in the output.SASThe where statement (section A.6.3) is a powerful and useful tool for subsetting on the fly. (...

Read more »

Example 7.12: Calculate and plot a running average

September 17, 2009
By
Example 7.12: Calculate and plot a running average

The Law of Large Numbers concerns the stability of the mean, as sample sizes increase. This is an important topic in mathematical statistics. The convergence (or lack thereof, for certain distributions) can easily be visualized in SAS and R (see also Horton, Qian and Brown, 2004).Assume that X1, X2, ..., Xn are independent and identically distributed realizations...

Read more »

Example 7.5: Replicating a prettier jittered scatterplot

July 15, 2009
By
Example 7.5: Replicating a prettier jittered scatterplot

The scatterplot in section 7.4 is a plot we could use repeatedly. We demonstrate how to create a macro (SAS, section A.8) and a function (R, section B.5) to do it more easily.SAS%macro logiplot(x=x, y=y, data=, jitterwidth=.05, smooth=50);data lp1;set...

Read more »