A couple of short stats animations

Conference season is over, and I have a lot of cool stuff to catch up on blogging. Here’s part 1.

Two animations of optimisation processes, one made with Yihui Xie’s R package and the other by an eerily Grantoid nuts-n-bolts approach where a lot of png files are saved and then turned into a stop frame animation using (apparently) ImageMagick (aka ffmpeg for wimps).

First, an OR kind of problem. 8 balls are scattered about in 2 dimensions. They then have to be moved to be equidistant. This is done with the R optim function and the old BFGS algorithm. I fondly recall my undergraduate studies where I had to program it in a calculator which I still have rusting in a drawer somewhere. I can’t believe looking back that I managed to do that. I must have learnt a lot, but one thing that didn’t stay with me was all those strange BFGS names. I think there was a Goldfarb and a Shanno, but the others are lost to me.


Read the code here.

Next, one I think is more fun. A Metropolis algorithm with three chains seeks out the mean and variance parameters for some data. This is a 3-D-style wireframe plot, and the three chains appear like kittens moving around under a quilt, until they converge on the target distribution like a quivering mouse. Code here.



As testament to the fact that gifs are a really bad way of providing animations, one of them works on this blog, and one doesn’t. No idea why, nor is it worth any effort to find out! I think if you click you’ll see those crawling kittens of likelihood.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s