Wednesday, June 18, 2014
It's got to end some time, Kevin
The World Cup continues to excite and surprise, not that I can watch much of it. I did catch some of this morning's game between Brazil and Mexico; the Mexican keeper was in inspired form. I still have my booklet from the 2010 tournament, with all the results filled in. The group games from four years ago look a bit dull now; some teams (um, England?) operated entirely in binary, with every game finishing 0-0, 1-0 or 1-1. I'd written in some notes from my hotel in Bali - "Channel 13 (reception awful) or 8 (not much better)" and names of countries in Indonesian that I'd picked up. Ivory Coast was "Pantai Gading", Greece was "Yunani", New Zealand was "Selandia Baru". Watching the action in a foreign country, and not having complications like work or flatmates to contend with, made the whole thing more interesting.
Warning: if you don't like maths or logic or tennis, or probably all three, please ignore the next paragraph.
Last year I promised to do a hypothetical calculation based on the Wimbledon qualifiers, and post the result here, so twelve months later... Qualifying for the men's singles at Wimbledon (which is going on now) involves winning three matches: two best-of-three-setters and a best-of-five. There's no tie-break in the deciding set of any match. The question was, how dominant do the servers have to be to make a best-of-three, on average, last longer than a best-of-five? The reason why that is even possible, in any situation, is because you're more likely to reach a long third set than a long fifth set. If you make that final set long enough (and you do that by making both players demons on serve), the greater likelihood of reaching the final set in a best-of-three starts to outweigh the fact that you've played two fewer sets to get there. If you assume that both players are equally dominant on serve, and their dominance is constant throughout the match, it turns out that we need the final set to last, on average, 14 times longer than each of the normal (tie-break) sets. That might sound ridiculous, but to achieve this the server "only" needs to win 86% (or more) of points. That's a very high percentage obviously, but you might expect it to be higher. The average length of a no-tie-break set rises steeply once you get above 80% of points won on serve. By the way, if both players are winning less than 14% of service points (and I've certainly played matches where it's felt that way!) that would do the trick too.
A guy at work is due to become a father next month. So at work today they had a baby shower (if that's what they call it when it's the father). I ended up spending over thirty bucks on this event, which is quite a lot when you don't really know the bloke. And it meant you had to talk and mingle and all that tricky stuff. And I realised that there's at least an 86% chance that I'll never have kids.
Sunday, November 10, 2013
It's not working
As I said last time, I am feeling better now, but there's an elephant in the room in the shape of work, or more precisely my boss, and it's sapping me of mental energy. I don't dislike my boss, but I really don't like her being my boss. I think it's pretty obvious that she doesn't care about me nor my colleague doing the same role (my previous boss did care, or at least did a good job of pretending to). I find it almost impossible to concentrate except on the rare occasions that she's away. Some of it is me - I'm really bad at constantly switching between tasks and I don't work well in a team that's so big you can practically see it from space, especially when they're all so outgoing. We've just had our self-appraisals; on Friday I filled in mine and basically hijacked it by giving a critique of the new set-up. I was restrained to begin with, but when I filled in the last box I pulled no punches. Maybe that wasn't my brightest idea, but I saw no other way of communicating my frustration, and on Friday I was well past caring about the consequences. As Christmas approaches, things won't get easier for me in a hurry. The Christmas function, appropriately enough, is on Friday 13th December.
At 5:02 on Friday morning our boss sent us an email. She likes to talk about how busy she is. She pretends to be annoyed by this, but really she's proud of it. I see this from a lot of people. In the 21st century, lack of time has become a status symbol.
Instead of buying a property, and all the angst that has gone with that, I wish I'd bought shares in Xero. If I'd put my entire deposit into Xero shares in December 2011, I'd be a millionaire now. I'll often have lunch near the stock ticker (which is located right beside Xero's head office) and see a half-day increase which would be reasonable in half a year. (I get out of the office every lunchtime whatever the weather, for my own sanity.)
The drink-drive limit is coming down. I don't think it will make much difference (in fact I remember an experiment in the UK which showed an improvement in driving ability under the influence of a glass or two of wine) but the government bowed to public pressure. It's people way over the limit who are the problem, and they're not going to care whatever the limit is. I'm not sure I get the zero limit for drivers under 20 either. It's dangerous to drive with any alcohol up to your 20th birthday, but after that you can have two or three pints and you're fine? This makes no sense to me.
Last night they had the big fireworks display on the harbour. I watched it from the big balcony a few floors up - a good vantage point, even if there was a crane in the way which you can make out from this photo:
Tracy pulled out of our scheduled Risk resumption this weekend - she had better things to do. I was looking forward to it (if nothing else it would have taken my mind off the "elephant"). Hopefully we can still play tomorrow night. I emailed a friend in the UK, a fairly regular board gamer, to ask what he thinks of Risk. "They've since come out with Express Risk - it's a much better game that uses cards instead of a board, and it's done and dusted within half an hour." What? How can that be "much better"? You can't take over the world in half an hour! And if there's no physical board (i.e. map), you might as well play on a computer.
Here's an interesting YouTube video (well I think so anyway) where someone generates random numbers using a radioactive substance. Humans are really bad at understanding probability and randomness. Imagine a NZ Lotto draw, where they draw out seven balls numbered from 1 to 40. Say the first number drawn is 6. That means that 5 and 7 shouldn't come out, and probably not 4 or 8 either. Because 6 is a low number, the other numbers are more likely to be high. Because 6 came out this week, we shouldn't expect to see it next week; in fact the next few weeks should be entirely sixless, until it's 6's "turn" again. And so on. Of course none of that is true (except that if the first number is low, the probability that the next number is high does go up a little, simply because there's now one fewer low number to choose from) but the human mind can't get away from thinking that future outcomes are dependent on the past. I agree with the guy in the video who said it would be fun, for a change, to pick Lotto numbers using radioactive material.
There was more cricket at the Basin yesterday. I noticed three of Wellington's batsmen made joint top scores of 62. Something dodgy is clearly going on - there's no way that can be random. Update: I saw the end of the match today. The green team (Central Districts?) declared, to try and force a result, but Wellington chased down 310 with three overs and four wickets to spare.
Before work tomorrow I'll get my thyroid and cholesterol tested.
Monday, August 13, 2012
Punching above your weight
The Olympics are finally over. To sum them up in two words: bloody great. I wish I could have caught the closing ceremony - I've seen a clip of it involving the Beatles' I Am the Walrus. What a song.
One phrase I hear a lot in New Zealand is "punching above our weight". Which countries did that in the Olympics? Whose performances were the most impressive when you take population into account? It's not as easy to measure as you think. Just dividing medals by population is misleading; it's much easier for a smaller nation to vastly outperform its expected medal quota than a larger nation. To see what I mean, imagine tossing 100 coins. Getting 60 heads is unusual but by no means impossible: you'll get 60 or more heads about 3% of the time. But if you toss 1000 coins, getting 600 or more heads is ridiculously unlikely. In fact getting 530 or more heads from 1000 coins is just as impressive as 60+ from 100 (they both have a probability of about 3%).
I tried to use that principle to obtain a ranking of countries' performances at the Games relative to their expected medal haul given their populations. I also employed the 4-2-1 points system (four points for gold, two for silver, one for bronze). There were 302 gold, 304 silver and 356 bronze medals awarded in total. That works out to be 2172 points. Each country's "expected haul" is their share of the 2172 total as a fraction of the world population. For instance China has 19.16% of the world's population so you could expect it to receive 19.16% of the points, i.e. 416. In fact China "only" received 228 points.
I realise there are all kinds of flaws to my method. I had to tweak the parameters a bit, and at any rate the allocation of medals is hardly random. Then most events limit the number of athletes per country (in some cases to just one) so even a theoretical supreme sporting nation wouldn't take home all the medals.
For all their flaws, these are the two tables I came up with. First, the twenty best performing countries:
1. Grenada
2. Jamaica
3. New Zealand
4. Hungary
5. Bahamas
6. Great Britain
7. Australia
8. Trinidad & Tobago
9. Netherlands
10. Croatia
11. Cuba
12. Denmark
13. Belarus
14. Lithuania
15. Slovenia
16. Czech Republic
17. Kazakhstan
18. Russia
19. Georgia
20. South Korea
And now the ten worst performers:
1. India
2. Pakistan
3. Nigeria
4. Bangladesh
5. Indonesia
6. Philippines
7. Vietnam
8. Congo
9. Myanmar (Burma if you prefer)
10. China (yes, number two on the actual medal table).
Seven of those countries on the "worst" list didn't win a single medal. Obviously they all have substantial populations. India's 1210 million people managed two silver and four bronze, while Indonesia (238 million) got one silver and one bronze. Pakistan (180 million) were the biggest population of those who scored "nul points". At the other end, New Zealand (4.4 million) clearly did punch above their weight; Usain Bolt led the Jamaican charge on the track (their population is 2.7 million); Grenada's solitary medal was gold in the men's 400m and with a population of only 105,000 that was enough for top spot.
Wednesday, May 16, 2012
Mum and Dad: away for over four months
Mum and Dad came up last Thursday and spent three nights here. We got on pretty well. They were very helpful even if they insisted on rearranging my flat when I was out. I’d like to see their reaction if I moved virtually every item of furniture in their house. They’re flying to London the day after tomorrow and won’t be coming back till late September.
On Friday I saw Blackadder III at the Repertory Theatre. I’m glad I did. I never found Blackadder hilarious and I wouldn’t say Friday’s performance was side-splittingly funny either, but it still got enough laughs out of me to make it worthwhile. Getting a Chinese bloke to play Baldrick worked surprisingly well.
On Saturday my cousin and her family came round to my flat for a pizza as I finally made use of the Hell vouchers that Tommy’s gave me in “celebration” of my big purchase. So for a couple of hours my flat’s population had swelled to eight. I only have three seats, or four if you count the one that’s supposed to be outside.
I bought one of those chairs on Trade Me. Picking it up from Newtown last Wednesday was quite an effort involving unscrewing the legs in the pouring rain using the seller’s screwdriver so I could get it in the car. I then had major difficulties driving back: I could hardly change gear or see where I was going. Luckily I didn’t have to go far.
I now see Julie in Hataitai every Tuesday night. She needs someone to talk to. Last Tuesday I was able to make sense of some of my problems during our chat. I don’t need a diagnosis – I know what’s wrong with me, even if I’m unsure of the root causes. What I don’t know is how to fix my problems.
The middle of last week was a struggle for me, particularly at work. Wednesday afternoon was my low point; at least I resisted the temptation to bang my head against the toilet wall. Sometimes my anxiety and depression almost totally dominate my thought processes, to the point where nothing else matters. That’s what Tuesday, Wednesday and most of Thursday were like in the office.
Ten years ago I was in the middle of my final exams (all nine of them) at university. I studied a lot for those - up to twelve hours a day. Looking back I wonder where all that motivation came from. It had nothing to do with graduate jobs (which I thought were mostly crap), I know that much. Really it was the feeling that I hadn’t achieved as much in my academic life as I should have, and here was my one big chance.
We didn’t have our usual facilitator at Monday’s autism group. Because of this, the session turned into an even bigger free-for-all than it usually is. Adam, the rotund chap who likes all things Texan, seemed to think he ran the show. Towards the end of the evening the subject of pi came up. Tracy could remember the first however many digits of pi thanks to a cleverly-crafted poem in which each digit is represented by the number of letters in the corresponding word. But how does it deal with zeros, I asked. Tracy then said that there are no zeros in pi. I was willing to bet her a virtually infinite sum of money that the decimal expansion of pi does in fact contain zeros. It would be quite remarkable if it didn't; there would be huge implications for all kinds of stuff, though exactly what I’m not sure. Plus I would have been on a pretty good wicket with my bet: it’s easy to prove that there are zeros (look, there’s a zero!) but mighty difficult to prove that there aren’t (even if none of the first million digits is a zero, the million-and-first might be). Tracy then used her pi app on her phone (maybe it was just the internet) to find that pi does indeed contain zeros, which are represented in that poem by ten-letter words.
The Premier League football season ended in dramatic fashion last weekend, with Man City scoring twice in injury time to steal the title from United’s grasp. Some of the pictures on TV of supporters of both sides seem almost laughable: how can this be so important?
Birmingham City, in spite of an action-packed 62-game season, missed out in the race to make it into the top flight. The top two teams in the Championship go up automatically with the next four fighting it out for the third promotion place. Birmingham finished the regular season in fourth place and faced Blackpool (who finished fifth) in a two-legged play-off. It sounded like Blues had a bit of a shocker, both in the away fixture (where they were lucky only to lose 1-0) and for most of the home leg. In the second game Blues conceded either side of half-time to go three behind overall. They replied with two goals but couldn’t find the elusive third which would have forced extra time.
Greece might be about to leave the euro and it’s an absolute calamity. How will anybody, in Greece or the rest of the euro zone, possibly cope with this? I lived in France in 2000-01 during the last days of the franc. Posters were put up to tell people which countries would join the single currency, what the new notes and coins would look like, how many francs equal one euro and so on. Some time in 2001 an extra country – Greece – appeared on these posters without anybody batting an eyelid. Since then five more countries have been admitted. If even the idea of leaving the euro is causing such mayhem, perhaps it shouldn’t have been quite so easy to join in the first place.
Thursday, October 14, 2010
The x factor
On Tuesday night I gave an hour's tuition to a 16-year-old Takapuna Grammar boy. He'll be doing the same exam as the girl from Remuera, only he's not quite at her level. His arithmetic was fine but his algebra needed a lot of work. I asked him to solve the equation (x-4)/2 = 7 for x. "Can't I just say it's 18? he said. Well, yes I suppose, although I'm not sure whether you get all the marks in the exam if you just slap down the answer. I then gave him the very similar expression (x-4)/2 = a and asked him to make x the subject, but he was all at sea there. I can understand how he finds the transition difficult. I always found numbers easier to handle than x's and y's. But I think a major reason why a lot of people find algebra difficult is that they just learn a bunch of rules to get them through their next test or exam, without knowing why they're applying those rules. For instance this kid could solve a quadratic equation like x² + 7x + 10 = 0 with no trouble, by finding two numbers that add to give 7 and multiply to give 10, but didn't know why that method worked. Of course he might also like to know why you'd want to solve a quadratic in the first place, and I can't help him there. I hope I can help him get through his exam in mid-November though.
After an icy blast early in the week things have warmed up again. On Saturday I've got the Asperger's group to look forward to.
Friday, June 25, 2010
"The greatest match ever": some analysis
Rule number one of successful blogging is that all content should be of interest to its audience, not just its author. I should warn you now that I may be about to violate this rule. First, here are a few facts and figures surrounding the three-day contest:
- Both players' ace counts hit triple digits, Isner serving 112 aces to Mahut's 103.
- The previous longest match lasted just over 6½ hours. Just the fifth set of this match exceeded eight hours.
- The number of points played in the match nearly reached quadruple figures, Mahut holding up his half of the bargain with 502 points while Isner managed 478. From what I could tell, Mahut made most of the running on the second day's play as those figures would suggest. He unquestionably looked the fitter of the two men, but he just could not find a way to break the Isner serve.
- Mahut had to win three qualifying matches to make the main draw. In the second of these he was pushed to a 24-22 deciding third set by Britain's Alex Bogdanovic, a marathon in itself. He then came from two sets down to win his last qualifying match in five.
- Thiemo de Bakker, Isner's second-round opponent, won his opening round match 16-14 in the fifth set.
- In 2007 Mahut had a match point in his loss to Andy Roddick in the final of Queen's. He had beaten Nadal earlier in the tournament. That would suggest he knows how to play on grass.
- Also in 2007, the six-foot-nine Isner burst onto the tennis scene by winning five successive matches, all of them in a tie-break in the final set. In last year's US Open he beat Roddick on a tie-break in the fifth and final set. Then at the start of this year in my home town of Auckland, he picked up the title by beating Arnaud Clément in the final on, guess what, a tie-break in the final set.
What I keep hearing is, "we'll never see anything like this ever again". Is that true? Well even though this match has obliterated every record in the book, given infinite time and no changes to the rules of tennis (more on that later), and that Wimbledon doesn't fall into the sea due to climate change, we will see something similar again, be it in our lifetime, our great-grandchildren's lifetime or some time after that. So it's really a question of whether tennis continues to be played as it is now, hundreds of years hence. If it does (and that's a really big if) how long will we have to wait to see a 70 in the games column again?
First it would be nice to know the chances that the Isner–Mahut match-up, in particular, should produce such a marathon. What were the odds that we'd get to 68-all? Even to do that I'll have to make a few assumptions:
- Both players have the same chance of winning a point on serve, which I'll call p. As Isner had a far superior ranking (he was the 23rd seed while Mahut was ranked outside the world's top 100) this is a bit unrealistic. But Mahut had proven his ability on grass before and he was coming into the match on the back of considerably more grass-court play than the American. So this assumption, which implies that both players are of equal strength, isn't so far-fetched after all (as the eventual result showed).
- Only this match is used to estimate p. Match-ups are so important in tennis. For instance Mahut's chance of winning a point on the Isner serve is surely smaller than against just about any other player, with the possible exception of Ivo Karlovic. Likewise the surface plays a huge part; even different grass courts play differently. So adding any other opponents or surfaces into the mix will only make my estimate less accurate.
- The outcome of each point is independent of all other points, so p is constant throughout the match. Whether this is a realistic assumption I honestly don't know. My guess is that there are "momentum" and "crisis aversion" effects that come into play, as well as (in a match as long as this) a serious "fatigue" effect. Also, players may have a better chance when serving or receiving from a particular side of the court (left or right). That's for another investigation.
Of the 980 points played, 759 of them went with serve. This gives p = 0.77449, a figure much higher than the corresponding 0.66469 taken from all the matches in the first two rounds of the men's tournament combined.So what's the probability of the server winning a game?
He can win it to love [probability p^4], to fifteen [4*p^4*(1-p): there are four ways of winning a game for the loss of one point], to thirty [10*p^4*(1-p)^2] or in a deuce situation. The "deuce" case is a bit trickier as it involves an infinite series, but it works out to be:
20*p^3*(1-p)^3*p^2/(2p^2-2p+1).
Summing these four terms, the probability that the server wins the game (I'll call this g) is:
0.35980 + 0.32456 + 0.18298 + 0.09823 = 0.96556. Wow. So given how Isner and Mahut were serving, you could only expect a break of serve a little over one time in thirty. It's also pretty amazing that the most likely outcome of a game in this situation is a hold to love.
The probability that the match goes into a fifth set, given the assumptions, is 3/8. I'm sure this is a slight overestimate due to the effect of momentum (between two evenly-matched players, I'd imagine whoever wins the first set has an above 50% chance of also winning the second). Now what's the chance that a set goes to six games all? The probability of this is:
[g^10 + 25*g^8*(1-g)^2 + 100*g^6*(1-g)^4 + 100*g^4*(1-g)^6 + 25*g^2*(1-g)^8 + (1-g)^10] * [g^2 + (1-g)^2].
Plugging in our value of 0.96556 for g, that probability is 0.67854. So with two players serving as well (and returning as badly?) as Isner and Mahut, you could expect two-thirds of sets to reach 6-6. Contrast this with the tournament as a whole, where using the figure from the first two rounds, you'd expect just 28% of sets to reach 6-6 (and I'm sure on clay it would be even lower than this).
So the probability at the start of the Isner–Mahut match that it would reach 6-6 in the fifth, i.e. the no-tie-break "overtime" stage, is 3/8 * 0.67854 = 0.25445.
We can continue by working out the probability that the fifth set will run deeper than this:
12-12..........0.16837
18-18..........0.11141
24-24..........0.07372
30-30..........0.04878
36-36..........0.03228
42-42..........0.02136
48-48..........0.01413
54-54..........0.00935
60-60..........0.00619
66-66..........0.00410
68-68..........0.00357
So there you have it. These two would serve up (literally!) a 70-68 (or longer) fifth set 0.357% of the time, or once every 280 times they step onto the court.
I'm sure most people would think it was far more unlikely than that, somewhere in the thousands or even millions-to-one range. And they're probably (partially, at least) right. When I've watched marathon men's matches in the past, at around 10-all in the decider one man starts to cramp, or loses concentration, or serves a couple of double faults, putting a major dent in
his value of p and opening the door for his opponent. Remarkably, in the Isner–Mahut match, that never happened. If anything, both players' p-values seemed to rise as the match wore on, and it took two out-of-the-blue passing shots from Isner to bring it to an end.
So all I've done here is come up with a figure for one match alone, based on some dodgy assumptions. As for calculating a probability based on all the matches that take place in a tournament, you'd need a whole bunch of p-values for all the possible encounters, many of which are clearly not 50-50 match-ups, and I wouldn't know where to start! Here's someone who has started, and more than that.
This match has inevitably generated some discussion about a possible fifth-set tie-break at Wimbledon (and, for that matter, Melbourne and Paris). Currently the US Open is the only Grand Slam to use a tie-break in the final set. Personally I'm a fan of the "no tie-break" rule in the last set, at least not at 6-6. The Wimbledon finals of 2001 and 2008, as well as the Australian Open semi between Federer and Safin in 2005, are examples of classic matches that were taken "up a notch" by the lack of a deciding tie-break. The same can be said of some great women's Grand Slam finals, particularly at the French Open. But I wouldn't be totally averse to a tie-break coming in later, at least in the early rounds. There are three problems I see in a gargantuan battle like this. Most obviously the winner of the match, in this case Isner, is completely shot when he comes to play his next match. As it happened, Isner won just five games against De Bakker, and incredibly did not serve a single ace. Had Mahut won, I think he would have done better. Secondly it becomes almost irrelevant who wins, partly because the winner is unlikely to advance further. Finally so much attention is given to the match as to almost overshadow the rest of the tournament; in twenty years' time people may well remember this match but have no clue as to who won the final. I reckon a tie-break at 12-all would make sense (it's like an extra set) and as for the final, well that should definitely stay no-limit.
