Articles by Matt Asher

Queueing up in R, continued

October 20, 2011 | Matt Asher

Shown above is a queueing simulation. Each diamond represents a person. The vertical line up is the queue; at the bottom are 5 slots where the people are attended. The size of each diamond is proportional to the log of the time it will take them to be attended. Color is ... [Read more...]

Waiting in line, waiting on R

October 13, 2011 | Matt Asher

I should state right away that I know almost nothing about queuing theory. That’s one of the reasons I wanted to do some queuing simulations. Another reason: when I’m waiting in line at the bank, I tend to do mental calculations for how long it should take me ... [Read more...]

R: Attack of the hair-trigger bees?

January 12, 2011 | Matt Asher

In their book “Complex Adaptive Systems”, authors Miller and Page create a theoretic model for bee attacks, based on the real, flying, honey-making, photogenic stingers. Suppose the hive is threatened by some external creature. Some initial group of guard bees sense the danger and fly off to attack. As they ... [Read more...]

Livin’ la Vida Poisson

November 5, 2010 | Matt Asher

Yes, I did just mix English, Spanish and French. And no, I living the “fishy” life, popular opinion to the contrary. Here’s the story. As someone who spends the majority of his time working online, with no oversight, I notice that I tend to drift a lot. I don’... [Read more...]

Weekend art in R (Part 4)

September 4, 2010 | Matt Asher

Computer creations are perfect by design. We put in numbers, and if all goes well we get out an exact result. If we want a line, we want it perfectly straight. If we want a circle, it should conform to the platonic ideal of a circle. From a mathematical standpoint, ... [Read more...]

The Chosen One

August 30, 2010 | Matt Asher

Toss one hundred different balls into your basket. Shuffle them up and select one with equal probability amongst the balls. That ball you just selected, it’s special. Before you put it back, increase its weight by 1/100th. Then put it back, mix up the balls and pick again. If ... [Read more...]

Weekend art in R (Part 3)

August 21, 2010 | Matt Asher

I have a few posts nearing completion, but meanwhile a weekend break for art. Big thanks to Simon Urbanek and Jeffrey Horner, creators of Cairo, a library for the programming language R. Have you noticed how R can’t anti-alias (fancy way for saying smooth out lines and curves when ... [Read more...]

R: Clash of the cannon cycles

July 19, 2010 | Matt Asher

Imagine a unit square. Every side has length 1, perfectly square. Now imagine this square was really a fence, and you picked two spots at random along the fence, with uniform probability over the length of the fence. At each of these two locations, set down a special kind of cannon. ... [Read more...]

100 Prisoners, 100 lines of code

July 9, 2010 | Matt Asher

In math and economics, there is a long, proud history of placing imaginary prisoners into nasty, complicated scenarios. We have, of course, the classic Prisoner’s Dilemma, as well as 100 prisoners and a light bulb. Add to that list the focus of this post, 100 prisoners and 100 boxes. In this game, ...
[Read more...]

Entropy augmentation the modulo way

June 29, 2010 | Matt Asher

Long before I had heard about the connection between entropy and probability theory, I knew about it from the physical sciences. This is most likely how you met it, too. You heard that entropy in the universe is always increasing, and, if you’re like me, that made very little ... [Read more...]

Weekend art in R (Part 2)

June 26, 2010 | Matt Asher

I put together four of the best looking images generated by the code shown here: # More aRt par(bg="white") par(mar=c(0,0,0,0)) plot(c(0,1),c(0,1),col="white",pch=".",xlim=c(0,1),ylim=c(0,1)) iters = 500 for(i in 1:iters) { center = runif(2) size = 1/rbeta(2,1,3)   # Let's create random HTML-style colors color = sample(c(0:9,"... [Read more...]

Reaching escape velocity

June 22, 2010 | Matt Asher

Sample once from the Uniform(0,1) distribution. Call the resulting value . Multiply this result by some constant . Repeat the process, this time sampling from Uniform(0, ). What happens when the multiplier is 2? How big does the multiplier have to be to force divergence. Try it and see: iters = 200 locations = rep(0,iters) [...] [Read more...]

The perfect fake

June 19, 2010 | Matt Asher

Usually when you are doing Monte Carlo testing, you want fake data that’s good, but not too good. You may want a sample taken from the Uniform distribution, but you don’t want your values to be uniformly distributed. In other words, if you were to order your sample ... [Read more...]

Those dice aren’t loaded, they’re just strange

June 18, 2010 | Matt Asher

I must confess to feeling an almost obsessive fascination with intransitive games, dice, and other artifacts. The most famous intransitive game is rock, scissors, paper. Rock beats scissors.  Scissors beats paper. Paper beats rock. Everyone older than 7 seems to know this, but very few people are aware that dice can ... [Read more...]

A different way to view probability densities

June 12, 2010 | Matt Asher

The standard, textbook way to represent a density function looks like this: Perhaps you have seen this before? (Plot created in R, all source code from this post is included at the end). Not only will you find this plot in statistics books, you’ll also see it in medical ... [Read more...]

A logo for R?

May 31, 2010 | Matt Asher

In light of my recent attempt at aRt, Tal from R bloggers suggested I submit a T-shirt design for this contest. That got me thinking that R needs a logo freshining in general, so I dusted off my technical pens and drafted something. I’ll explain why I think this ... [Read more...]

Betting on Pi

May 31, 2010 | Matt Asher

I was reading over at math-blog.com about a concept called numeri ritardatari. This sounds a lot like “retarded numbers” in Italian, but apparently “retarded” here is used in the sense of “late” or “behind” and not in the short bus sense. I barely scanned the page, but I think ... [Read more...]

Weekend art in R (part 1?)

May 29, 2010 | Matt Asher

As usual click on the image for a full-size version. Code: par(bg="black") par(mar=c(0,0,0,0)) plot(c(0,1),c(0,1),col="white",pch=".",xlim=c(0,1),ylim=c(0,1)) iters = 500 for(i in 1:iters) { center = runif(2) size = rbeta(2,1,50)   # Let's create random HTML-style colors color = sample(c(0:9,"A","B","C","D","E","F"),12,... [Read more...]
1 2 3

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)