Simulate discrete variables by using the "Table" distribution

1

I wanted to write a blog post about the "Table distribution" in SAS. The Table distribution, which is supported by the RAND and the RANDGEN function, enables you to specify the probability of selecting each of k items. Therefore you can use the Table distribution to sample, with replacement, from a finite set. The power of the Table distribution is its flexibility: you can specify whatever probabilities you want, so it a general-purpose mechanism for simulating categorical data.

I knew that I had written posts that used the Table distribution before. Most recently, I used it to generate fractals in SAS, such as Barnsley's fern and my fractal Christmas tree. I have also used it to simulate data from a mixture distribution. However, I didn't remember actually dedicating an entire post to the Table distribution.

But the more I wrote, the more my words seemed familiar. Finally I wrote, "When I first started using SAS, I thought that the Table distribution was named after 'Dr. Table,' similar to the monikers of the Poisson, Gumbel, and Weibull distributions."

Hey, wait a minute! I definitely have used this humorous anecdote before!

Well, turns out that I was right. I have written about how to use the Table distribution to simulate categorical data in SAS.

But you know what? That's okay because the Table distribution is very useful, and deserves to be blogged about multiple times. So if you haven't read my 2011 article on the Table distribution yet, read it now.

As for me, well, they say that the memory is the second thing that fails as you get older. Unfortunately, I can't remember the first thing!

Share

About Author

Rick Wicklin

Distinguished Researcher in Computational Statistics

Rick Wicklin, PhD, is a distinguished researcher in computational statistics at SAS and is a principal developer of SAS/IML software. His areas of expertise include computational statistics, simulation, statistical graphics, and modern methods in statistical data analysis. Rick is author of the books Statistical Programming with SAS/IML Software and Simulating Data with SAS.

1 Comment

  1. Pingback: What happens if you misspecify the parameters for the “Table” distribution? - The DO Loop

Leave A Reply

Back to Top