Lucky 8?

My state government’s lottery administration, SA Lotteries, makes the results from its various games available online, including tables of how frequently the various lottery numbers were drawn.

For example, you can see here how frequently the numbers 1 through 45 have been drawn in the Saturday X Lotto. At the time of writing this, Number 8 was the most frequently drawn, recorded as occurring a total of 289 times between Draw Number 351 to 3265. Note that the Saturday X Lotto Draws are odd-numbered, so Draw 351 to 3265 actually consists of 1458 (i.e. (3265-351)/2+1) weekly games.

Of course there will be random variation in how frequently balls are drawn over time, just as there’s random variation in heads and tails in the toss of a coin. But is it particularly unusual for the Number 8 Ball being drawn 289 times in 1458 games of Saturday X Lotto?

Is South Australia’s Saturday X Lotto biased towards the number 8?

Now before we can determine if the Number 8 being drawn 289 times in 1458 games of X Lotto is an extraordinary event, it helps if we first work out how many times we expected it to happen. In X Lotto, a total of eight balls (6 balls for the main prize and then 2 supplementary balls) are selected without replacement from a spinning barrel of 45 balls. The probability of any single number of interest being selected in eight attempts without replacement from a pool of 45 can be calculated using a Hypergeometric Calculator as P(X=1)=0.17778 (i.e. just under 18%). Therefore we expect the Number 8 (or any other number for that matter) to be drawn 0.17778 x 1458 = 259 times in 1458 games.

So observing 289 occurrences when we were only expecting 259 certainly seems unusual, but is it extraordinary?

To answer this, I’ll employ the Binomial test to evaluate the null hypothesis, H0:

H0: Observed frequency of the Number 8 being drawn in SA Lotteries’ Saturday X Lotto is within the expected limits attributable to chance (i.e. the lotto is a fair draw)

vs. the alternative hypothesis, H1:

H1: Observed frequency is higher than would be expected from chance alone (i.e. the lotto is not a fair draw)

The statistics package, R, can be used to run the Binomial test:

> binom.test(289,1458,0.17778,alternative=”greater”)

> Exact binomial test
> data: 289 and 1458
> number of successes = 289, number of trials = 1458, p-value = 0.02353
> alternative hypothesis: true probability of success is greater than 0.17778

So we can reject the null hypothesis of a fair draw at the alpha=0.05 level of significance.  The p-value is small enough to conclude that the true probability of Number 8 being drawn is higher than expected based on chance alone.

However, please note that I am definitely not suggesting that anything untoward is going on at SA Lotteries, or that you’ll improve the odds of winning the lottery by including the number 8 in your selection. For a start, rejection of the null hypothesis of a fair system occurs at the standard, but fairly conservative, alpha=0.05 level. What if I had decided to use alpha=0.01 instead? The null hypothesis of a fair system would be retained. Things are all rather arbitrary in the world of statistics.

Still, a curious result that utilised several statistical concepts that I thought would be interesting to blog about.



South Australian Election Time

The South Australian state government election campaign for 2010 is now officially underway…

Two households, both alike in dignity,
In fair South Australia, where we lay our scene,
From ancient grudge broke new mutiny,
Where civil blood made civil hands unclean,

But the voters, no longer the shy mouses,
Awaking the fateful Sunday-after, said
“A plague upon both of your houses!,
We voted for the Greens instead!”

My apologies to The Bard.  It should be an interesting campaign, certainly the most interesting for many years, what with the Outlaw Bikies, Michelle Chantelois, Gamers’ Party et al all vying for our attention along with the main parties.


A thank you to my readers…

I was looking through my blog’s referrer stats the other day, and noticed an incoming link from the Open Laboratory 2009.  It seems someone has voted my post on How to Talk Back to a Statistic as being some of “the best writing on science blogs” during 2009; and it looks like the post will be immortalised in print.

I’m very flattered.  So whoever it was, and to everyone else who enjoys this blog, thank you!


A viable micropayment system for the internet

There’s an interesting opinion piece by Alan Kohler in the Business Spectator, linking the lack of an online micropayment system with the imminent demise of traditional media.  The basic problem, and I agree with Alan’s point, is that it is currently inconvenient to make small purchases over the internet.  As a result owners/sellers are under pressure to simply give their content away for free, or rely on a rapidly diminishing advertising revenue stream.

The incredible blooming of iPhone applications and the creation, from nowhere in just a couple of years, of a booming global “iPhone app” cottage industry, has demonstrated the biggest tragedy of the internet: the failure to find a viable micropayments system.

In fact I would go as far as to say this failure is the reason journalism as we know it and traditional media companies are in danger of dying.

Newspapers and magazines in print are sold for ‘micropayments’ at newsstands and newsagents – $1 to $10 – but you can’t do that online. Therefore publishers are stuck with expensive, long-term credit card subscriptions or giving the content away.

Alan Kohler, Size matters, Business Spectator, 17 June 2009

The solution to this micropayment problem has been chirping away in our pockets and handbags the whole time.  I’m talking about mobile phones.  The notion of a mobile phone as virtual wallet/purse is not a new one.  Advocates of a cashless society have been predicting the usurping of coin by the mobile phone as a transaction instrument ever since, well, ever since the invention of the mobile phone.  And every day millions of people all over the world use their mobile phones to make small transactions whenever they purchase ringtones and/or text services from their telco carriers.  In fact I understand it’s a multi-billion dollar industry.  Why anyone would want to pay for Crazy Frog is a mystery to me, but there you go.

So can this model ever extend to other micropayments, such as buying on online edition of a newspaper or magazine?

Well the answer is yes, and in fact Coca Cola tried this some years ago with their vending machines.  You’d text a message to a special number, some electronic shenanigans would go on behind the scenes, the can of Coke would be dispensed, and the cost of the Coke (+additional charges) would appear on your next mobile phone bill.  At some point I expect you’d want to drink the can of Coke.  Simple.  Effective.  The same principle could be applied to an online newspaper.  You’d text a message (e.g. “issue”) to a special number (e.g. 133-news).  A unique, random password or electronic token would be messaged back to your handset, and you would use this token to log into the site.  The cost of the token would be minimal (say $1) but you could only use it to view that particular day’s issue of the newspaper.  If you wanted to read tomorrow’s edition that would require a whole new token (and another $1).  And all your transactions would be neatly itemised on your next monthly mobile phone bill.  (Naturally you could choose to buy an ongoing subscription using standard current credit card methods if you wanted multiple issues.  I’m only talking about very small, one-off type purchases here.)

All this seems rather obvious.  Many people much smarter than me have thought of all this before.  So the question really becomes, why hasn’t this taken off in a big way?  Where are my mobile phone micropayment options?  The issue, surely, cannot be technical.  Indeed, a glimpse of a possible reason can be found over at Mobile Industry Review

The biggest hurdle is getting the business relationships in place with companies like ours, the mobile carriers, the operators and the financial services. We are working hard to find the right business construct.

– Tim Attinger, Head of Product Innovation at Visa.

Or, as Mobile Industry Review says, “who gets what split of the revenue”.  Pie.  It’s always about who gets how much pie.

The mobile-phone-as-a-virtual-wallet paradigm needs a big push from a powerful sponsor.  And I think it’s the old print media companies desperately fighting for survival, and desperately searching for a viable business model in today’s “Web 2.0” world, that can really put this thing into gear.  Would people purchase online newspapers this way?  I don’t know.  I certainly would, as long as the price is right and the content is good and the convenience is there.  For $1 I would expect access to a full edition (i.e. identical content to the dead-tree version) of the newspaper, and I would expect the company to make access to that day’s edition I paid for perpetual (i.e. I get to keep that copy forever – again, just like a paper copy).  But discussion of long term archiving of online records is perhaps a topic for another day.

I wonder if Rupert Murdoch reads my blog.  That’ll be $1, thanks.


Want to be on the cover of a magazine?

… or how about be a comic book hero?

MagMyPic is a little gem of a website that lets you create magazine and comic book covers using your own uploaded photos.  Options and customisation is limited (at the moment), but it’s a fun idea and the site is very straightforward to use.  Below is the “May edition” of “Graduate” magazine (N.B. not to be confused with the real Graduate Magazine!) that I created using a purloined photo of Sir Ronald Aylmer Fisher, arguably the founder of modern statistics.  Of course you don’t have to be so nerdy.  It’s more fun when you use pictures of yourself, family and friends.



Euler’s Identity

In my previous blog I mentioned that “if there’s one mathematical constant that reigns supreme in the heady world of statistics, it’s Pi”.  But what about that other mathematical constant, Euler’s Number, e?  I don’t think statistics would have advanced very far without e.  Well in fact Pi, e and the square root of -1, denoted by i, share a special bond, known as Euler’s Identity:

e^{i \pi} = -1

Many mathematicians consider Euler’s Identity to be the most beautiful equation of all time.  And I have to admit it sends tingles down my spine too.  I also get the same sensation when I see fractals, or Einstein’s famous proof of the equivalence of mass and energy, E=mc2.

I must be some nerd.

Approximating Pi with a fraction

π = 3.1415926535 8979323846 2643383279 5028841971 6939937510 5820974944 5923078164 0628620899 8628034825 3421170679…
A million digits of Pi

A little while ago my blogging thoughts turned to (Monte Carlo) biscuits.  Now I’m thinking about pie.  Or, to be more precise, Pi.  If there’s one mathematical constant that reigns supreme in the heady world of statistics, it’s Pi.  And of all the approximations of Pi my favourite is the Milü, derived by the Chinese mathematician and astronomer Zu Chongzhi.

π ≈ \frac{355}{113} = 3.14159292035…

What I love about the Milü is that from just 3 digits in the numerator and denominator, you get an approximation of Pi that is accurate to six decimal places (after rounding).  And I’d argue that this is close enough for most practical purposes.  As an added bonus the denominator is a prime.

The common π ≈ 22/7 = 3.14285714286… isn’t bad, but only accurate to two decimal places.  The next best approximation is π ≈ 52163/16604 = 3.14159238738… But this is unwieldy and doesn’t offer any practical improvement in accuracy.

Neither of these approximations is as useful, or as elegant, as the Milü.

\frac{355}{113}.  A good idea for a tattoo perhaps?