Monday, 28 November 2011

Does correlation mean cause and effect?

Most academics who have been associated with elementary statistics teaching have their stories of spurious correlation being linked to causality.  One graduation day, I was chatting to the father of one of my project students about this, and he suggested one from his business, managing a paper mill.

Someone had noticed that the percentage failure rate of their paper fluctuated from day to day and month to month.  The same person had noted that this rate was strongly correlated with the number of soft drinks sold from vending machines in the factory.  Both increased and decreased together (positive correlation).  Does that mean that the workers were neglecting the production to drink more soft drinks?  Or were the workers seeking to cool off their annoyance at the failure rate (which was curling at the edges) by drinking more cold drinks.

As usual there is a simple explanation; while you are thinking about it, here's a drink vending machine to pad out the story.

The usual explanation for spurious correlations is that both sets of observations are linked by causality to a third set of data.  In this case it was temperature.  As the temperature rose, the paper was more liable to curl.  And the workers needed more liquid to cool down.

Last week, the Independent carried a short item on correlated data sets. 

Monday 21st November: news story: 
What's the secret to a contented retirement? One answer, according to a new study, is regular sex. The more often married over-65s have sex the more likely they are to be happy with their lives, researchers found.
The survey of 238 men and women, presented yesterday at the Gerontological Society of America, found 60 per cent of those who had regular sex said they were very happy compared with 40 per cent for whom it was a distant memory.
When it came to their marriages, 80 per cent of those who had regular sex said they were very happy compared with 59 per cent of those who did not.
Adrienne Jackson, from Florida University, said the findings should "spark interest" in helping older people deal with "resolvable issues" which prevent them having sex.
Previous research shows the main factor that limits sexual activity is a man's health, not a woman's. Many illnesses, such as diabetes and prostate cancer, affect a man's capacity to have and maintain an erection.
But therapists warn about the danger of raising expectations so people feel there is something wrong if they are not having sex. There isn't.

Tuesday 22nd November: Letters
Cause and effect
You report that regular sex is one of the secrets of a contented retirement (21 November). Could it be that the correlation is the other way about: those over-65s who are happy with their lives have more sex?
Tony Wood

When I found for the online versions of the story, I was amused that it was tagged with four labels: Biology, Schools, Sex, Higher Education.  I assume that these labels were given by some automatic process which picked up the key word "University" and created the label "Higher Education". 

Six degrees of separation

Last week there was a news item about the connectivity of the Facebook universe. 
"Researchers at Facebook and the University of Milan reckon that the degrees of separation between any two people in the world have been reduced to 4.7 from social psychologist Stanley Milgram's "small world experiment" of six back in the '60s.
The study which measured how many friends people have on Facebook, found that the notion of six degrees of separation had been shrinking over the past three years at the same time as the dominant social network bumped up its userbase.
It also noted, unsurprisingly, that many of those connections are localised."

Graphs and networks are an important component of the mathematics of Operational Research, and it is interesting to see some of the statistics of the Facebook graph.  Newspaper reports have focussed on the statistic that the average separation is 4.7 on Facebook.  Reading the fuller report, two further statistics  have struck me.  The first is that the Facebook graph is almost wholly one component.  Over 99.9% of active Facebook users are connected to one another through friends of (friends of) friends.  (Repeat the (friends of) as many times as needed.)  Such is the dominance of this "super component" that the next largest component has about 2000 Facebook members.  The second is that most Facebook friends are local in both space and age.  It is hardly surprising.  True, my Facebook friends include some people in other countries, but the majority are in the UK, and a significant number are in my home city of Exeter.  And most are of a similar age to me ... a few family members are a generation younger.

Now I am waiting for someone to calculate degrees of separation across time.  If my parents and grandparents were connected by six degrees of separation to the world when they were my age, then it only takes seven degrees to separate me from their world.  Taking this further, each grandparent adds another degree, say sixty years per degree.  William Shakespeare died in 1616, about 400 years ago.  That makes six or seven time steps ... twelve or thirteen degrees of separation between me and the Bard?

I started this train of thought because of a coincidence.  In another blog, I wrote about a street in Exeter which was completely destroyed in the Exeter blitz of 1942.  St Leonard's Terrace was never rebuilt.  My late great-aunt's book collection, some of which I have inherited, included her contributions to a trivia column in a newspaper, "The Daily Post".  The column published one or two thoughtful quotations each day ... and one of my great-aunt's appeared alongside one from a resident of St Leonard's Terrace in 1932.  They certainly never met, but had that fleeting moment when they appeared in the same issue of the paper.  And so I have a flimsy link to the street which was blitzed.

Thursday, 24 November 2011

The solution is ... an iron fish!

Every so often, we need to be reminded that Operational Research is not simply about finding a solution to a problem, but that solution needs to be implemented.  So here is such a reminder.
Cambodian village women have high rates of anaemia due to lack of iron in their diets.  This leads to other health problems.  How can you persuade such women to add iron to their diet?  That is the problem ... not a specifically O.R. problem, but one of health management.
In the developed world, the answer would be iron tablets.  In Cambodia, they would be expensive and therefore impractical.  What about introducing iron into cooking water?  Used regularly, enough iron would come into the food to deal with the anaemia.  A little modelling showed the truth of this.  A good idea, but how to make sure that the women would accept the idea?  Here is the problem of implementation.  The solution was based on local traditions and concepts of luck.  So, the Canadian researcher Christopher Charles introduced iron ingots shaped like fish, a symbol of good luck.  And women have started to put these into the cooking water.  For the full story, see here.

Wednesday, 23 November 2011

In omnia paratus (Family mottoes and O.R.)

Some years ago, the Operational Research Society in the UK invited its members to report early occasions in history where O.R. appeared to have been used.  The term O.R. was traced to the 1930s, but there were many earlier instances where models had been used in industry and commerce to answer the traditional O.R. questions of “What’s Best” and “What happens if …?”.  Lanchester’s laws were one such, and so were Erlang’s work on the Danish telephone service and Babbage’s book On the Economy of Machine and Manufacture.  An amusing response cited Shakespeare’s play, Richard III, with its famous line “A horse, a horse, my kingdom for a horse”.  The contributor explained that as the play progressed, the value of a horse remained constant, but the value of the kingdom (to Richard III) decreased until the two were equally valuable – a lesson in utility theory.

Throughout the middle ages, the British developed many proverbs and expressions which encapsulate lessons from O.R.  Thus:
“Many hands make light work” teaches that some tasks are best performed in teams.
“Too many cooks spoil the broth” teaches that there are times when a task is best left to an expert.
“Save some money for a rainy day” teaches that income and expenditure should be treated as an inventory problem, with a smoothing factor to ensure that the amount in hand is never negative.

Families chose mottoes to emphasise the ideas or philosophy of one of their leaders, and many British families and organisations retain their mottoes to this day.  Others have lost them, although there is a thriving business in discovering mottoes and heraldry for those of British ancestry who want something heraldic to hang on their wall at home. 

In my library at home, I have a book dating from the mid-19th century which lists hundreds of family mottoes and many of these have obvious parallels with O.R. lessons.  86 pages are devoted to family mottoes. So from pages 138 and 139 of “A Handbook of Proverbs, Mottoes, Quotations and Phrases” (Edited by James Allan Muir) (Published by George Routledge and Sons) I have chosen to tell the following case study:

The manager needed Instaurator ruinae.  So he called in some experts on O.R..  They claimed that they were In omnia paratus, and they had testimonials to say that they were In multis, in magnis, in bonis expertus.  The O.R. team brought their expertise and Ingenio et veribus, solved the problem.  Once their solution had been implemented, the manager was able to say, “Insperata floruit”.  Later, when the manager had paid the fee for their consultancy, the team were pleased to say “Industria ditat”.

The translations of these six mottoes, and the families to which they belong (according to the book) are:
  • In multis, in magnis, in bonis expertus (Tried in many, in great, and in good exploits) [Bowes]
  • In omnia paratus (Prepared for all things) [Layton and Prittie]
  • Industria ditat (Industry enriches) [Paxton and Wattchop]
  • Ingenio et veribus (By the force of genius) [Huddleston]
  • Insperata floruit (It has flourished beyond expectation) [Cleghorn and Watson]
  • Instaurator ruinae (A repairer of ruins) [Forsyth]
The book is vague about surnames with multiple mottoes; so there are about a dozen mottoes for the surname “Smith”, none of which belongs to my branch of the family.  If I were to adopt one of them, I would select “Tenax et fidelis” (Persevering and faithful)

Tuesday, 22 November 2011

How my Ancestors used Operational Research

A few years ago, I taught a course module called “Graphs, Networks and Algorithms”.  It was generally known as GNA.  As part of the module, I created four spoof interviews with people who might have used the mathematical techniques of GNA at four times in history or prehistory.
Therefore, as one contribution to the INFORMS Challenge on OR and the Family, I offer:
How my Ancestors used Operational Research 

Stigina, the Druidess
 We interviewed Stigina on a windy hillside in Wiltshire, which gave us a very good view of the largest civil engineering project in Britain, one that she has been supervising for several years.
Interviewer: Stigina, this project has taken twenty years to complete, and you have been in charge of it for the last ten years.  I believe that you said recently that the project would have taken another ten years except for your use of mathematical models that you learnt at university.  Would you like to tell us about them?
Stigina: As readers will know, this project has involved a large number of people, and it has been necessary to coordinate their labour on a day-to-day basis.  We have also had to move some very heavy construction items and other equipment over considerable distances.  And, like every major project, the accountants have demanded that we do all our work within a tight budget.  So I was very pleased to use some ideas from a course at the university called GNA.
Interviewer: Can you explain as simply as possible what ideas these were?
Stigina: Well, the stone that we used had to be transported to the site.  In the GNA course we used diagrams to show possible routes between places.  My assistant and I drew some diagrams on the walls of the cave that we used as the site managers office.  These showed routes between the quarry and the project site, and I used what the mathematicians called “vertices” to show places where the workmen could obtain food and water.  The same idea was used many years ago in France, at a place called Lascaux; the food vertices were drawn in the shape of different kinds of animals on the walls of a big cave.  Then we worked out how many stones could be moved each month between these places, knowing that our workmen needed to hunt and look after their crops as well as be on the site.  Then we used something that I learnt in GNA called the maximum flow algorithm to plan the routes that the stones would follow to get them here as quickly as possible.

Interviewer: This all sounds very useful.  Are there other items from that university course which might be useful to modern society?
Stigina: I think so.  Another valuable idea was called “assignment”.  It could be useful for some of our ceremonies.  Those who preside at such ceremonies come from many parts of the country.  There are ceremonies in many places, and I am sure that the planners could use the idea of assignment to make sure that each ceremony was presided over and that all the possible presiding officers were employed.  Sometimes, these days, there are druids who travel for weeks simply to attend a ceremony, and others could take their place if the assignment was done properly.
Interviewer: Thank you; one last question.  What is the project going to be called?
Stigina: While we were building, there were several suggestions about what the structure should be called.  But we decided that it should be named in honour of the stones and the university course, so I can reveal that its name will be Stonegna, although I expect that over the next few years that name will change a little.
Interviewer: Thank you, and congratulations on completing this huge project on time and within budget.
Stigina: Don’t thank me, thank the GNA course.

The Brunswig branch of the family
 “No photographs, please!”
Our interviewer was a little startled by this opening remark from our latest interviewee.  So she asked for an explanation.
“Surely you know.  I’m still persona non grata  in one of the towns round here, and I suspect that the Brunswig police might want to ask me some questions.  The whole matter was closed some months ago, but there are people with long memories and short tempers.  As far as I am concerned, there was a misunderstanding, and the press created some sensational stories.  There was one reporter called Browning who made up a particularly fanciful account.  But I have had to change my appearance for my own safety.”
So we asked for his side of the story.
“You can call me PP.  Anyway, after I graduated from the university with my vocational degree, I spent a couple of years working in an established business before starting one on my own.  All went well until I was negotiating a contract with the councillors--the town had such a problem with rodents that they were prepared to pay weekend rates for the job.”
“Wait a moment.  PP, Are you saying that your business--let’s be blunt, you are a rat catcher--is a graduate profession?”
“Of course it is.  But of course we don’t call ourselves by that name.  We remove all kinds of pests, not just rats and mice.  I had to deal with a couple of snakes in the royal apartments last week--nobody would admit to having let them loose, but the king has already taken on extra bodyguards.  Most people in the business have a postgraduate degree in rodent extermination.  There have been courses at several universities for the last twenty years or so.  The degree programme has a mixture of history, biology, management and psychology.  I was very fortunate to get a place on the course.”

“And you took options in mathematics and engineering?”
“Yes.  I had studied mathematics and physics to A-level, and I wanted to use that background.  In the psychology module, the lecturer had spoken of the effect of particular sounds on rodents, and that encouraged me to look at ways of generating and amplifying music as a method for clearing premises.  I took out a patent on one invention.  Here’s an example--called a Portable Interactive Eradication Device (PIED for short).  And in mathematics, I studied that module called GNA, which I have found extremely useful.”
“Could you explain?  There doesn’t seem to be much of a connection between graphs and rat catching--sorry, rodent extermination.”
“Well, one of the important parts of my job is deciding where to place traps. So I often draw plans of the building and try to find optimal locations for deterrents.  GNA helped on that.  And I need to patrol them, and I use a method called the travelling salesman algorithm for that.  And often, when I have a really big job, I need to go round all the streets and alleys of a town to look for the signs that vermin have been there.  For that, I used to use an algorithm that was devised for helping postmen--unfortunately, the postal service will not disclose their routes to me, saying that they are commercial secrets, so I need to find the optimal tours for myself.  But the PIED has changed some of my processes--and that led to my problems in you-know-where.”
“Can you explain?”
“Using PIED, I don’t need to go along every alley-way.  The sound that it generates attracts vermin within a radius of about twenty metres.  Thus, if I go past the end of a short alley, I don’t need to go into it; I blow into the device and it saves me time.  But the problem of finding an optimal route around a town is changed--I had to devise a new mathematical model and algorithm to solve it, using general principles from GNA.  The trouble is that I complete contracts much more quickly than before.  The councillors didn’t believe that I had actually dealt with the problem when I reported that the job was done within the weekend and they refused to pay me.  And then they accused me of bewitching their children with PIED.  I had to leave--but thanks to the publicity in the media, I have been offered a role in a TV commercial.  You’ll see me advertising a men’s spray on deodorant.”
“Thank you for this interview.”

Charles, who went to sea with Sir Francis Drake
We sent our interviewer to see the recently retired Lord Mayor of Plymouth at his newly purchased mansion, known as Buckland Abbey.  As is well known to all, the former Lord Mayor has had a brilliant career as a sea-farer, military strategist and civic leader.  Already, there are many legends associated with his exploits.  History will be the judge of how many of these are true.

We wanted to talk about his association with mathematics and this is an edited account of what he told us.
Of course, our sailing expeditions always included skilled navigators.  Otherwise we would have been much less successful, both financially and in matters of new discoveries.  Some of our navigators were trained as seamen, but on the important expeditions we employed the best possible men, and on my round-the-world journey, fifteen years ago, our chief navigator was an exceptional person.  His name was Charles, and he had studied at the university of Cambridge, and then had traveled in Europe, studying in Denmark with an astronomer called Brahe and in Italy with a university professor called Galileo.  His calculations and observations were always scrupulously correct.  I could rely on his skill, day and night, all the time.  But he also made me think about the business of sea-faring in a new way.  Besides his charts, he often would show me diagrams--he called them “graphs and networks”-to explain what had happened, and what was going to happen according to his calculations.  On his “graph” he would draw a small circle, and say that it represented a Spanish man-of-war; another circle would represent my ship, the Golden Hinde.  Then he would draw more circles, representing places that we could reach between our ship and where the Spaniards were going.  Together we would plan our route, and he would talk about the difference between taking the shortest route and the quickest route, and how these might be quite different.  He would talk about the difference between the route that one ship might take and the best route for a fleet--and that was really useful.  His greatest moment came, of course, when we had the invasion scare in ‘88.  As you know, we were playing bowls on the Hoe at Plymouth when the first reports of the fleet reached England.  Immediately, I sent for Charles, and to help calm my nerves and those of my fellow captains, we continued the game until he came.  We made up a story to explain why the game went on--I didn’t want anyone to know that the secret weapon was going to be a mathematician and his ideas of graphs and networks!  Charles used the bowling green and the bowls we had been playing with, and created diagrams so that we could plan the whole endeavour.  We followed his instructions, sent the ships along the best routes according to his calculations, used the quickest routes which the enemy didn’t know about, and we were successful. 
I even found employment for Charles on land; when I was planning the new water supply for Plymouth--the one that they now call “Drake’s leat” from the moor, Charles used his paper and quill pen to plan with graphs and networks and decide on the routes for the water.  It really should be called “Charles’ leat” because of all the work that he did. 
And after that, Charles went back to his books.  He said that on our great voyage he had been able to disprove the idea that the sun went round the earth, and he wrote to his friend Galileo about it.  And he told me that he had some revolutionary ideas called the “Laws of Motion” and “Calculus”-I didn’t understand them at all.  He wrote to his old college in Cambridge about them just before he died; I hope that someone can use his ideas--but perhaps Charles will not get the credit that is due to him.  I wonder ....
Interviewer: Thank you, Sir Francis

The 1920’s “Flapper Girl” and businesswoman
We interviewed Marion in her fashionable South Kensington flat, just round the corner from Harrods Department store.  

Interviewer: Marion, if you will pardon us saying so, you look like a typical “flapper girl” of the 1920’s.  Very few of your generation went to university, and even fewer studied mathematics.  Can you tell us about your experience?
Marion: Well, my mother was one of the campaigners for “Votes for Women” a few years ago, and it seemed natural to want to use my brain and go to the university.  And I enjoyed mathematics at school, and wanted to continue to learn.  So that is how it came about.
Interviewer: Did you enjoy university life?
Marion: Of course I did.  There were a lot of rules to protect us girls, but somehow we managed to have a really good time; I learnt the latest dances, such as the Charleston, and I remember the first talking picture to come to the cinema.
Interviewer: And now you have started your own business; can you tell us a little about it?
Marion: While I was at the university, the first crossword puzzles came into the newspapers, and some friends and I wasted a lot of time trying to solve them.  But they have become extremely popular and we have decided to set up a business which employs people to create crossword puzzles and we sell them to magazines and newspapers, and organise competitions as well.
Interviewer: And how is mathematics connected to word puzzles like that?
Marion: You know the author Lewis Carroll was a pseudonym for an Oxford mathematics don, who created word puzzles called acrostics.  There have always been links between mathematics and games.  But my friends and I saw that we could use our university studies, and particularly a course called GNA, to help us make better puzzles and do create them more quickly.  Let me explain, as simply as possible.
First of all, crossword puzzles need to have a grid of words, and then we need to set clues for those words.  Usually we have one or two words that we would like to include in the grid.  The simplest puzzle we use has six words, each of five letters.  Suppose that the first two words that we want are “VOTES” and “WOMEN”, just like the little puzzle that I have drawn here.  (I haven't managed to post the example ... sorry.  It was a 5 by 5 grid, with five letter words in rows 1,3 and 5 and also in columns 1, 3 and 5.  Row 1 read VOTES, Row 3 read WOMEN.)  Now in the GNA course, we studied the mathematical concept of trees, and we use that here.  Just like your family tree, an incomplete grid can have descendants, and we make the descendants of one grid have the same words, and one more.  In this example, we need a word which starts with a V and has a W in the third place.  There are only two or three words like that, so it restricts the choice of further words.  Because the GNA course taught us to think about trees and branches, our business can make puzzles much more rapidly than our rivals who don’t know about such useful ideas.  In fact, it doesn’t take very long to complete that grid with the words VOWEL, LODGE, TIMID and SINGE.
Interviewer: And has that university course helped you in other ways in the business?
Marion: More and more newspapers want what we call “cryptic crossword puzzles”.  Instead of giving a clue to the word by a definition, the clue is in two parts, a definition and cryptic hints about the letters in the word.  We are using the same idea of trees to help us with the cryptic hints.  Take the word “VOTES” as an example.  One descendant of the word in the tree would say that it was an anagram of “STOVE”.  So our clue writer might write: “Selects broken stove” as the clue.  Another descendant might say that it was made up of the letter V followed by OT, followed by E and S, so the clue writer might write “Elects five with warm Cockney players” Because you see, E and S are players in the game of bridge and OT is the way a Cockney might say “hot”.  For longer words than “VOTES” we sometime have several possible descendants and it helps the clue writer a lot to know them.

Interviewer: So you are really grateful for the GNA course at university.  What next for your business?
Marion: We’ve just heard about a Japanese puzzle to fill in numbers in a square, but I don’t think it will ever catch on.
Interviewer: Thank you very much.
(For the record, the picture is of my grandmother, who really did go to university in Liverpool and graduated in 1912 in classics.  All the rest is fiction.)

Saturday, 19 November 2011

Seventy-one point four percent of statistics are made up

There are many times when I am amused or amazed by the use of statistics (and mathematics) in newspapers and magazines, sometimes because the writer has not understood what he or she is writing about, or because a sub-editor has allowed a numerical error or anomaly through to print, or because some number is just plain silly.

The claim in the title of this piece is one such.

My latest toe-curling experience has come from the magazine of a very large supermarket chain in the UK.  In the pages devoted to preparing for Christmas, there are the following statistics, with my comments in []:
  • 8:39am - the time when the average family takes its first bite of chocolate on Christmas Day.  [Not 8:38 or 8:40, please note]
  • 38 - the number of days women spend on average preparing for Christmas [how do you decide if a day is spent preparing for Christmas or dealing with daily living?]
  • 27 - the number of mince pies we each consume over the festive season [not the average, but "the number"]
  • 83 - square kilometres of wrapping paper will end up in UK bins this Christmas, enough to cover an area larger than Guernsey [It sounds an impressive figure, but that amounts to just over one square metre of wrapping paper per person in the UK.  That's about three sheets; how many sheets do you need for each large present?]
Now let's think how the first statistic might have been calculated.  Somebody wants to know how early in the morning people start eating chocolate on Christmas Day.  It's not a survey that they want to spend a great deal of money on, so they will interview a hundred or so people, probably not chosen in any well-designed sample.  And how will those people answer?  Nobody will answer to the nearest second, or even the nearest minute.  Answers will be "About nine am", "round about 11am", "when we finish breakfast, say 8:15am", "Whenever the kids open their stockings - last year at 6:15am". And of course those figures are not precise, and certainly not the result of a minute-by-minute analysis of the family's programme for Christ's Birthday.  Then the analyst takes the mean (or median, but probably not the mode!) and presents it as a scientific result.  So what might be a more convincing way of presenting such an earth-shattering statistic?  Perhaps: "Half the population of the UK have eaten some chocolate by 9am on Christmas Day" taking the median as the summary statistic that is most appropriate for such vague data.

The second and third statistic are probably derived in the same way; their analysis and derivation are left to the reader to consider.  And I have reinterpreted the fourth one for you.

Just remember - you will eat this number of mince pies:

Wednesday, 2 November 2011

Operational Research in the Gutter

Some papers concerned with finding optimal parameters are extraordinary. When asked what I do, or what I did, I talk about simple decision problems where the answer is one number. And once the problem is posed, my regular comment is "Since the answer is a number, then there ought to be some mathematics in it, shouldn't there?" And so we can start to talk about some of the mathematics of Operational Research and about the process from a problem through to implementation ... including persuading the client to use the solution.

Although I have retired as editor-in-chief of the International Abstracts in O.R., I still help with the selection of abstracts, and came across a problem of design that was new to me. In:

Magd M. Abdel-Wahab, Chong Wang, Libardo V. Vanegas-Useche, Graham A. Parker,
Experimental determination of optimum gutter brush parameters and road sweeping criteria for different types of waste, Waste Management, Volume 31, Issue 6, June 2011, Pages 1109-1120, ISSN 0956-053X, 10.1016/j.wasman.2010.12.014. (

the authors describe problems of street cleaning. What is the best design of a brush to be used for cleaning the gutter?  The wrong design, the wrong angles of bristles to the head and the wrong angle of the brush axle could all make a cleaning vehicle ineffective.

I hope that the authors spent some time observing from the cab!

Tuesday, 1 November 2011

More about OR and Cricket

There is a great deal of decision-making in some sports, and cricket has been the subject of several research papers (mainly, for obvious reasons, in UK journals).  The most well-known is the paper which led to the Duckworth-Lewis scheme for limited over matches which were cut short part way through.

The latest Journal of the OR Society (vol 62 (issue 11), November 2011) has two further papers to add to this literature.  From Canada, Bhattacharya, Gill and Swartz write about: "Duckworth-Lewis and Twenty20 Cricket" (pp1951-1957 (doi:10.1057/jors.2010.175)).  From the UK, Scarf and Akhtar write about "An analysis of strategy in the first three innings in test cricket; declaration and follow-on" (p1931-1940 (doi:10.1057/jors.2010.169))