Simulate discrete variables by using the "Table" distribution

February 4, 2013
By

(This article was originally published at The DO Loop, and syndicated at StatsBlogs.)

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!

tags: Getting Started, Sampling and Simulation



Please comment on the article here: The DO Loop

Tags: , ,


Subscribe

Email:

  Subscribe