Saturday, May 11, 2013

A reaction on "On a First-name Basis with Success? Your Mom Chose Your Name Wisely."

Earlier this week, the Business section of the Flemish quality newspaper 'De Standaard' reported that the shorter the first name, the higher the income (see here). The article showed a pricture of Bill Gates, with the caption: "Was using the nickname 'Bill' the key to the success of William Henry Gates?". The newspaper was refering to research carried out by TheLadders, a "job-matching service for career-driven professionals" and reported here. Basically, they analyzed data around first names from TheLadders’ nearly 6 million members and salary level.
The blog is more tongue in cheek than De Standaard article led us to believe, but the blog has found its way in social media, being liked and tweeted more than thousand times, and was caught up by the popular (and sometimes serious) press. There are, however, a few concerns with this research. Let me mention them one by one:

  • The first concern is an obvious one: "Correlation is not causation". It's been said many times before, so  I don't need to do much explaining here, but it remains surprising to see that a lot of the reactions on the research really focused on the causal consequences. The Bill Gates example mentioned above is a case in point. The author's conclusion "to all prospective mothers, our advice is to keep Baby’s name short and sweet – your child will thank you when they’re raking in the money one day" was meant as humor, I suppose.
  • The second concern is related to the first one, and that's spurious correlation: The observed relationship might be caused by a third, unseen factor (sometimes referred to as a "confounding factor" or "lurking variable"). To the rearcher's credit the fact that he did a separate analysis for women and for men already eliminates gender as such a confounding factor. But nonetheless it is perefectly imaginable that length of first name is related to age or ethnicity, two factors that have been reported to influence salary in previous research.  I don't have the data available right here, but I'm sure that it wouldn't be hard to figure out whether certain age cohorts of people were given longer names than other cohorts, for instance because long names might become fashionable or out of fashion again. Likewise, it can't be hard to show that certain enhnicities have in general longer or shorter names than others. 
  • Another concern is the poor and confusing scientific language that is used. One example is "We wanted to prove the null hypothesis that what your mother names you makes a difference.". Null is misplaced here. I would rather say that we attempt to disprove the null that there is no difference. Sentences like "The definitive proof for this theory can be seen in Sara vs. Sarah, Michele vs. Michelle, or Philip vs. Phillip –  one letter less positively correlates with increased salary." should be avoided as well.
  • Another statistical concern is that  if you use 6 million observation almost everything will become significant, but that does not mean the reported effect is substantial as well.
  • While 6 million observations is huge, it does not mean that they are representative for the global population.
  • And if you consider the 6 million  people as your population (to avoid the problem in the previous bullet), the is no real need to use inductive statistics in the first place.
  • The graph with the average salaries by length of first name is somewhat misleading because the y-axis is not given and it is not exactly clear what scale is being used. 
  • While the regression coefficient is given, it would have been good to report the $R^2$ as well. 
To illustrate how easy it is to report effects like these, while they're (likely) not there or very weak, let me get back to the election data I used in a pevious post in this blog. It's data on the results of the municipal elections in Flanders in 2012.
For each of the about 37000 candidates from more than 300 municipalities I calculated the number of characters in their first name and related that to the number of votes they received relative to the result of their party in their municipality. Below I tried to mimic the graph produced by TheLadders (and shown above). It is a histogram of frequencies superimposed with the average percentage of votes.


As you can see, the two graphs look pretty similar both in terms of pattern of frequencies and in terms of the decreasing red line. This graph (wrongly) suggests that there is a tendency that longer first names have a lower (relative) number of votes. Before you jump to conclusions, please read further.
I used a couple of tricks to exagerate the effect. Many of these tricks were applied by the TheLadder author as well:

  1. By omitting labels on the y-axis, it is difficult to judge the scale.
  2. There are names with only two letters and with more than 9. In my example I used the same buckets as TheLadder. If I had allowed names with 2 characters as well, the line would have looked different. In Flanders the majority of those names are "An", which is a female name. I don't know how that works in the US, but there are names like 'Al' that must come up frequently in the huge database TheLadder has used
  3. The red line really hides the enormous variation in percentage of votes within each class of 'number of characters of the first name'.
  4. By not reporting the $R^2$ of the model, I deny the reader to evaluate the strength of the model themelves. In this case here, while the regression coefficient is significant, the $R^2$ of the regression model explains less than 1% of the variance, so the effect is clearly not substantial. Notice that the opposite is not true. Having a high $R^2$ does not always indicate a strong relationship either, but that is a different story.
  5. I've scaled my graph such that the decrease in the red line looks more dramatic (in all fairness I have to say that TheLadder author didn't do that).  


One more thing: Here's a list of candidates with names of length 11 with the frequency below each name:
Jean-Pierre Marie-Paule Jean-Claude Christianne Marie-Josée Anne-Sophie Christopher Marie-Elise 
         62          13           8           7           6           5           3           3 
Jean-Michel Ann-Pascale Anne-Claire Bernhardien Cemil-Jimmy Christianna Christoffer Danny-Spock 
          2           1           1           1           1           1           1           1 
Gust-Julien Guy-Maurice Hanne-Loren Hendrik-Jan Jan-Laurens Jean-Hubert Liese-Lotte Luigia-Gina 
          1           1           1           1           1           1           1           1 
Marie-Berte Marie-Josee Marie-Laure MarieJeanne Maximiliaan Pieter-Paul Salah-Edine Sebiha-Abla 
          1           1           1           1           1           1           1           1 
 
If you are familiar with names in Flanders you will agree that a lot of the higher frequency names are probably from older people, illustrating that behind "length of first name" lies a lurking variable, i.e. age.

I'm just giving this illustration, to show how easy it is to fool the (untrained) eye. Data scientists should avoid this kind of tricks and go for clarity instead.

Conclusion: Anyone who writes an article to pay respect to their mother has my support, but the article of TheLadder probably did not deserve to be spread as far as it did, and it certainly should not end up in a quality newspaper that De Standaard claims to be.

Friday, March 8, 2013

Election fraud detection in Armenia and in Flanders

Last week, a tweet by the Dutch political scientist, Armen Hakhverdian (@hakhverdian), pointed to an interesting blog post from Fredrik M Sjoberg, a Postdoctoral Scholar at Columbia University – The Harriman Institute. It's a guest post on The Monkey Cage dealing with the recent election in Armenia and the (alleged) election fraud. One of the things he did was a very simple test. He did a $\chi^2$-test based on the assumption that:
In the absence of manipulation of vote totals the last digit should follow a uniform distribution of 10 percent in each of the 0-9 digit categories
He did that for the ruling party at the polling station level both for 2012 (no fraud allegations) and 2013 (fraud allegations). The results are summarized by the graph below (copied from the original blog post).

The $\chi^2$-test for 2013 turns out to be significant at the 0.1 percent level, but non-significant in 2012 ($p$-value = 0.981).
Apart from the fact that I'm always a bit worried when significance tests are used on population data, especially because the $\chi^2$-test is known to be sensitive for the number of observations $N$, I still think it is an interesting take on election fraud. While the absence of a significant effect is not a guarantee that no fraud happened, the fact remains that deviating strongly from a uniform distribution would raise eyebrows.
Recently I reported on this blog about a study I did on the effect voting machines had on the outcome of the municipal elections in Flanders, Belgium (see here (english) and here (dutch)). Since I have the data, I thought I might as well do a similar test as was done for Armenia, but this time for the Flemish part of Belgium (excluding Brussels), and at the level of the candidate rather than at the level of the polling station. I'll admit that the execise is futile, since nobody claimed that fraud was involved in the Belgian elections, but it turns out that you can do the test with only a few lines of R-code, so why not? This results in a $\chi^2=7.5103$, which leads to a non-significant effect with a $p$-value of 0.5841. But just simply looking at the bar chart below with the proportions makes it also clear that, w.r.t. to the "last digit-criterion" everything looks good.

So the good news is that, in contrast to Armenia, Flanders has no explaining to do w.r.t. to the "last digit-criterion". That said, I'm still surprised that the study on the "touchscreen effect" as described in a previous post has drawn more attention abroad than in Flanders and more from statisticians and data scientists than from political scientists and journalists.

Thursday, February 28, 2013

Wat er mis is met de Porno-grafiek van De Morgen

Op Donderdag 28/0213 verscheen er in De Morgen een artikel, 'Pleidooi voor porno. Maar niet helemaal', geschreven door Sjoukje Smedts. Het is een genuanceerd artikel waarin allerlei experten hun zegje kunnen doen over het fenomeen porno. Een prima stuk dus ... Maar niet helemaal. De grafiek die erbij staat, een spindiagram, kon beter.

Ten eerste valt onmiddellijk op dat de verhoudingen niet kloppen. Het percentage Dagelijkse porno kijkers is ongeveer 10 maal kleiner dan het percentage mensen die zeggen ongeveer één keer per week naar porno te kijken. In de spindiagram lijkt de verhouding eerder de helft. Het lijkt erop dat de binnenste 7-hoek niet wordt meegeteld. Maar zelfs dan lijkt de 13.3% van 'ongeveer één keer per maand' niet te kloppen.
Maar los daarvan kan je je afvragen of zo'n spindiagram (spider of radar graph) wel de beste voorstelling is. In principe is bij een spin diagram de volgorde van de verschillende variabelen niet van belang, en dus is het ook niet fout om de diagram zo voor te stellen zoals hier het geval was. Maar, met een beetje goede wil, zou je kunnen zeggen dat de variabele "Mate van porno kijken" een ordinaal meetniveau heeft. Je zou dus de verschillende categorieën kunnen ordenen van zelden naar heel vaak. Een andere mogelijkheid is om de categorieën te ordenen van de meest voorkomende naar de minst voorkomende. In dit geval geven de twee benaderingen toevallig hetzelfde resultaat. Reden te meer om dat te doen. Persoonlijk denk ik dat een gewone staafdiagram hier uiteindelijk het duidelijkste is.

Je zou ook de zaak cumulatief kunnen voorstellen. Je kan moet dan wel eerst de percentages van hierboven herrekenen naar een totaal van 75,3%.

Persoonlijk doe ik dat liever alleen bij echte metrische variabele, al is het maar omdat nu ontbreken van een zinvol label voor de laatste categorie vreemd overkomt.

Monday, February 18, 2013

A data scientist looks at the Belgian Municipal Elections.

Remark: This is the english version of my previous Dutch blog post.

After the provincial and municipal elections of the 14th of October in Belgium, media reported several cases of candidates who had received more preference votes than what normally could have been expected. The additional votes were attributed to a problem with the touch screens of the voting machines. When voters pressed too long when selecting a party, the system would sometimes register a preference vote for the candidate whose name appeared in the same area as where the party was. The figures below illustrates well what the issue is.
 
  
The figure on the left is the Parties Screen, i.e. the first screen the voter sees. On that screen the voter selects a party (sometimes called a list). In this case, the voter has selected the PVDA+ party, as indicated by the blue rectangle. The figure on the right hand side is the candidates screen, i.e. the subsequent screen the voter sees. This screen shows all the candidates for the party that was selected in the previous sceen. It was reported that in some cases, especially when the voter pushed too hard or too long, the second screen would register a preference vote for the candidate at the same location on the screen as where the party name was (also indicated with a blue rectangle). For simplicity's sake we will call the position that corresponds with the exact location where the party name was a hotspot.
While some individual cases of remarkbable results were widely reported in the newspapers, a more thorough investigation of the problem was, as far as I know lacking. This effectively means that the magnitude of the effect was unknown.
As a Data Scientist that's the kind of question that you would find interesting and you would wonder how big the 'Touch Screen Effect' was. That's exactly what I did in a paper you can download here. In this blog post I'll try to summarize what I did, focussing on the Data Science aspects.
The first problem is to get the data. While a lot of (news-)websites offered web applications to retrieve the results of the elections in a meaningful way, none of them allowed me to download the complete set of results, i.e. for earch candidate, on each list (or party), in every municipality of the Flemish part of Belgium, the number of preference votes was needed. So I wrote a Python script to scrape the data from one of those websites. I used the BeautifulSoup and Selenium packages for that. If the hypothesis of a "Touch Screen Effect" is true we would expect a higher number of votes on hotspots than on the other positions. So the second problem becomes: "What is the expected number of votes for a given candidate on a given position, on a given list (or party) in a given municipality". For reasons that are detailed in the paper we chose to model the natural logarithm of the share of vote of a candidate (relative to his or her party in his or her municipality) with a multilevel regression model based on a polynomial of the third degree of the position of the candidate on the list. The polynomial is needed to capture the curvilinear nature of the data. Typically the candidates on top of a list, and the candidates at the bottom of the list receive more votes than those in between. The computations where done in R, using the LME4 package. Those who are interested can find the formulas in the original paper. The figure below illustrates this curvilinear nature for a random selection of 9 party-municipality combinations. The red line comes from a local regression model, the green line is the multilevel model that was used in the final analysis.
    
Remark: for a figure of better quality see the original paper

So far so good. The third problem is to decide on what constitutes an exceptional share of vote. Here we use the standardized residuals, as calculated by the LMERConvenienceFunctions in R (this is because in mixed models the calculation of standardized residuals is not that straightforward). Values above 2 are considered as being outliers.
With these three problems solved we can show the results for the main parties in the city of Antwerp (see below). The black points are the share of votes of the candidates (expressed as percentages) in function of the position of the candidate. The red points are those that are considered to be outliers, using the criterion descussed above. The green line is is the multilevel regression line. Hotspots are indicated by two blue vertical lines. Notice that in this figure the first 4 positions were omitted (for a justification, see the original paper).
     
Remark: for a figure of better quality see the original paper

In the figure above we see that all parties, except Open Vld, have an outlier that happens to be on a hotspot. There are a few parties that have more than one hotspot, while only one of them is actually an outlier. And finally, there are some outliers that are not on a hotspot. The latter observation should not come as a surprise. Exceptional election results can be attributed to lots of things, such as running a good campaign, being famous, and so on. In other words, the fourth problem is that we need to take into account that outliers could also just accidentally be on a hotspot. The approach I'm using is based on the calculation of some simple conditional probabilities. The probability for a hotspot in Antwerp to be an outlier (i.e. have substantially more votes than expected based on the position on the list) is about 55%. The probability for a normal (non-hotspot) position to have an outlier is 7%. The ratio between the two is 7.5. This means that the probability to have an exceptionally high share of votes (i.e. being an outlier) is 7.5 times higher for a hotspot than it is for a normal position.
It must be said that not all municipalities have the same spectacular effects as in Antwerp. On the other hand we should also stress that estimates are probably conservative. One of the reasons why this is the case is that the regression model is generally good, except for the first and last position. This effectively means that there are quite a lot of outliers on those two positions, while those positions are not relevant from the perspective of the Touch Screen issue. We can calculate less conservative estimates by disregarding the first two positions and the last two positions. Also, my approach doesn't work well for smaller municipalities because the lower number of observations. And hence we limit ourselves to the 12 most important Flemish cities where electronic voting was used. In those cities the overall, conservative, estimate is almost 2, while the less conservative estimate is 4.5. I repeat the interpretation here: In the most important Flemish cities that used electronic voting, the probability to have a (much) higher votershare than expected on a hotspot is almost twice as high as it is for a normal position. If we use the less conservative estimate it becomes 4.5.
Some parties are more affected than others. The right wing Vlaams Belang party seems to be more affected than others. If we again limit the analysis to the 12 most important Flemish cities that used electronic voting we see that the probability that a hotspot is an outlier is 40%. This is 10 times higher than it is for other positions for this party. If we use the less conservative estimate the ratio becomes more than 80.
The heatmap below illustrates the situation for Vlaams Belang in the main Flemish cities well. The columns are the twelve major cities in Flanders that used electronic voting. The rows are the positions on the candidates-list. The blocks with a blue border are the hotspots. Notice that the total number of candidates on the list can vary over the cities. The colouring of the heatmap is a function of the squared residuals of the multilevel-model. We thus take a less binary approach as we did above when we classified all cases as either being outliers or not. The dark areas (red and orange) are the positions where the voter share was close to the expectation. Lighter colours (yellow and white) indicate positions that deviated from the expectation (higher or lower). The first thing we notice in the heatmap below is that the top position and the last position are generally not well estimated by the regression model. That's not ideal, but it is less relevant from a "Touch Screen Effect" point of view (none of the top or bottom positions are on a hotspot). The important thing here is to notice that the remaining area between the top and the last position generally is dark (red or orange). There are some brighter spots, though. The brightest spots happen to be in the blue rectangles, i.e. hotspots, illustrating the effect of the position of the partyname (on the previous screen) on the preference votes themselves. It appears that besides Turnhout, the only cities that were not affected are those where the party name was split over two candidate columns (and hence two hotspots for Genk, Aalst en Roeselare).

Remark: for a figure of better quality see the original paper

Conclusions:
Based on these findings I'm confident that the 'Touch Screen Effect' as reported by the newspapers right after the muncipal election in Flanders, Belgium in 2012, were not only anecdotal, but had a clear effect in Flanders's largest cities. The study remain inconclusive with regard to smaller municpalities. On aggregate there remains a noticeable effect over all municipalities were electronic voting was used. Some cities, such as Antwerp, and some parties, such as Vlaams Belang, seem to be stronger affected than others.
From a Data Science perspective it is interesting to notice that in this reseach I had to combine 3 skills:
  • Hacking skills to assemble all required data (Scraping of the election results from a news website with Python).
  • Statistical skills to model the data and detect outliers (multilevel regression models in R with the lme4 and LMERConvenienceFunctions packages).
  • Substantive expertise in the political situation in Belgium to understand how the election process works.
It is not by accident that these are also the three elements in The Data Science Venn Diagram of Drew Conway:

Sunday, February 17, 2013

Het 'touch screen effect' bij de gemeenteraadsverkiezingen in Vlaanderen

(My apologies for this Dutch post. Soon I'll write an English one on the same subject, but then from a Data Science point of View.)

De gemeenteraadsverkiezingen van oktober jongstleden blijven de gemoederen beroeren. Deze week waren er minstens drie berichten in de actualiteit die te maken hadden met de nasleep van de jongste gemeenteraadsverkiezingen. Er is de kwestie Ninove (zie De Morgen: Geen nieuwe verkiezing in Ninove na "inside joke"), de onwettelijke samenstelling van een aantal Vlaamse OCMW raadsleden (zie De Morgen: "Partijen op lokaal vlak te weinig ondersteund door hoofdkwartieren") en, tenslotte, is er de (vermeende) dubbele voordracht van schepenen in Zaventem (zie De Morgen: Gemeentebestuur Zaventem verzekert continuïteit werking). Het lijkt er dus een beetje op dat Vlaanderen het niet zo gemakkelijk heeft om de verkiezingen te verteren. Maar de problemen dateren niet van nu. Sommigen zullen zich nog herinneren dat de dag van de verkiezingen ook niet vlekkeloos waren verlopen. Er waren wachtrijen en technische mankementen (zie Gazet Van Antwerpen: Heel wat problemen met stemcomputers in de regio) en de problemen met de Touch Screens van de stem computers (Zie Het Laatste Nieuws: Slecht afgestelde stemcomputers leveren extra stemmen op).
Toch is het fair om te zeggen dat Vlaanderen z'n best heeft gedaan om de zaak in goede banen te leiden. De website vlaanderenkiest.be, bijvoorbeeld, opgezet door het Agentschap voor Binnenlands Bestuur, probeert in ieder geval om zoveel mogelijk duidelijkheid te scheppen rond de voorbereiding en de afhandeling van de verkiezingen. Verder waren er infobrochures, en er waren filmpjes over hoe je elektronisch moet stemmen te bekijken op YouTube en op de Vlaamse televisiezenders. Bovendien had het Vlaamse Ministerie van Binnenlandse Zaken het gereputeerde Price Waterhouse Coopers (PwC) ingehuurd om de nieuwe stemcomputers te testen. Er werden zelfs een aantal hackers losgelaten op het systeem om de veiligheid ervan uit te proberen (Zie De Redactie:Bourgeois laat hackers los op stemcomputers).
Eén van de zaken die me persoonlijk sterk heeft verbaasd is de mildheid waarmee men gereageerd heeft op het zogenaamde 'touch screen effect'. Er waren nochtans enkele opvallende uitslagen. Zo meldde De Redactie (Verkozen dankzij de nieuwe stemcomputers?) dat:
In Antwerpen-stad kreeg de vrij onbekende Nick De Wilde, 14e op de Vlaams Belanglijst, maar liefst 2.077 voorkeurstemmen, meer dan voorzitter Bruno Valkeniers (19e plaats, 1.221 voorkeurstemmen) of lijstduwer Gerolf Annemans (1.563 voorkeurstemmen). Meteen goed voor een plaatsje in de gemeenteraad.
en
Bij Vlaams Belang en PVDA+ waren de nummers 14 de gelukkigen (zo kreeg bij PVDA+ Lieve Peeters 740 voorkeurstemmen, de kandidaten boven en onder haar 355 en 319), bij de N-VA en Groen waren dat de nummers 10. N-VA'er Rob Van de Velde kreeg met 4.081 gekleurde bolletjes achter zijn naam, de op drie na meeste voorkeurstemmen van de N-VA-lijst.
De oorzaak van dit alles waren, volgens enkele kranten, de Touch Screens van de stemcomputers. Het Nieuwsblad (zie Stemcomputer verkiest kandidaten per ongeluk) schreef dat:
Zelfs de Belangtop kende niet meteen Nick De Wilde die in Antwerpen met 2.077 stemmen voorzitter Valkeniers het nakijken gaf en verkozen raakte in de gemeenteraad. De Wilde voerde niet eens campagne. ‘Boosdoeners’ zijn de nieuwe stemcomputers waarover bevoegd minister Geert Bourgeois (N-VA) gisteren in het Vlaams parlement lovend sprak. De touchscreens blijken te gevoelig te zijn. Kiezers die te hard (of per ongeluk twee keer) drukten op het stemveld voor een partij gaven automatisch een kandidaat een voorkeurstem. Wie die gelukkige was, hing af van de plaats van dat veld op het computerscherm. Bij Vlaams Belang en bij PvdA+ ging het voordeel naar de nummer 14. Bij de N-VA en Groen ontving de nummer 10 een onverwachte bonus. Rob Van de Velde (N-VA) haalde met 4.081 voorkeurstemmen haast de top tien. Met 1.043 stemmen werd Dirk Avonts (Groen) tweede opvolger.
Toch werd vrij snel het probleem geminimaliseerd. In hetzelfde artikel werd geschreven dat:
Jacques Mahieu, die als voorzitter van de Antwerpse rechtbank de Antwerpse kiesverrichtingen superviseerde, bevestigt het verhaal. ‘Inderdaad, twee getuigen hebben me dat verteld. Juridisch is er geen probleem, het gaat eigenlijk om een fout gebruik van de computer. Tussen de lijsten maakt het geen verschil, binnen de lijsten natuurlijk wel. Kiezers moeten wat aandachtiger zijn. Ze krijgen bovendien de kans om een eventuele foute stem te corrigeren.’
Ook Geert Bourgeois, de bevoegde Minister, zag, in eerste instantie, geen grote problemen. Het Laatste Nieuws (Zie Slecht afgestelde stemcomputers leveren extra stemmen op) schreef dat:
Geert Bourgeois gelooft niet dat mensen door te lang drukken op de stemcomputer ongewild op bepaalde kandidaten gestemd hebben. Zijn agentschap en het bedrijf dat de computers leverde "hebben dat vandaag nog eens uitgeprobeerd", benadrukte hij op Radio 1. "Wat wel kan is dat de kiezer de vinger op het scherm houdt en gemakshalve de eerste de beste persoon aanvinkt. Er zijn telkens twee aparte handelingen nodig", onderstreept Bourgeois. "Mijn agentschap en het bedrijf dat de computers leverde spreekt tegen dat dit kon gebeuren door te lang te drukken." Ook bij de 85.000 tests door PriceWaterhouseCoopers is het probleem "nooit gesignaleerd". Bovendien voorziet het systeem in verschillende controles, argumenteert de N-VA-minister voorts. "Zo kan je niet alleen je print nalezen, maar je ziet het ook op het scherm, waar je je stem nog eens moet bevestigen. Ik ga ervan uit dat mensen die stemmen, dat ook bewust doen."
Later, toen bekend werd dat PwC het probleem met de Touch Screens wel had ontdekt, maar niet gemeld had bij de overheid (Zie Het Nieuwsblad: Geert Bourgeois en de stemcomputers : ‘Ik sta voor schut’), veranderde Geert Bourgeois van toon en kondigde aan te onderzoeken welke maatregelen hij kon nemen tegen PwC.


Een statistisch onderzoek naar het "Touch Screen Effect".

Vanuit statistisch standpunt kun je je natuurlijk de vraag stellen of er nu werkelijk sprake is van een "Touch Screen effect" of niet. Om dit na te gaan trachtte ik uitzonderlijke verkiezingsresultaten (outliers of uitbijters) te identificeren door de residuelen van een multilevel model gefit op de verkiezingsuitslagen te bestuderen, en deze te relateren aan de posities van de kandidaten en hun lijst op de computerschermen. Hieronder probeer ik het onderzoek zo eenvoudig mogelijk uit te leggen. Wie interesse heeft voor de statistische details verwijs ik naar de paper zelf: The 'Touch Screen Effect' in the Belgian municipal elections of 2012.
Ten eerste een recapitulatie van het probleem. Bij het elektronisch stemmen moet men op een eerste scherm een partij (of lijst) kiezen, om vervolgens, op een tweede scherm, een kandidaat te kiezen.

In het voorbeeld hierboven heeft iemand voor PVDA+ gekozen (zie het blauwe vierkantje op de linkse figuur). In de figuur rechts is de overeenkomstige plaats bij het kandidaten scherm eveneens met een blauw vierkantje aangeduid. Bij deze studie concentreerde ik me op de plaats exact in het midden van het vierkantje, i.e. de plaats waar ook de naam van de partij of lijst staat. Gemakshalve noem ik de positie van de kandidaat die net onder zijn of haar lijstnaam staat, een hotspot. Als er sprake is van een "Touch Screen Effect" is de verwachting dat er er meer stemmen op de hotspots te vinden zijn dan men normaal zou verwachten.
Wat men normaal zou verwachten is niet zo evident te bepalen, immers, het aantal stemmen dat een kandidaat krijgt is een functie van heel wat variabelen. Als men alleen al naar de positie kijkt dan weten we uit ervaring en uit ander onderzoek dat de eerste plaatsen (de zogenaamde lijsttrekkers) en de laatste plaatsen (de zogenaamde lijstduwers) over het algemeen meer stemmen genereren. Met een beetje goede wil kan men het verband tussen de positie op de lijst en het aandeel in de stemmen zien als een U-curve (eerst hoog, dan lager, en vervolgens terug hoger). In de paper wordt een regressie-model gebruikt om zo goed mogelijk het verband tussen de positie op de lijst en (het natuurlijk logaritme van) het aandeel van de stemmen van een kandidaat (relatief ten opzichte van het aantal stemmen voor de lijst) te benaderen. Om het curvilineair verband goed te vatten wordt in het regressiemodel een derdegraadsvergelijking gebruikt. In de paper wordt dieper ingegaan waarom een multilevel model hier de voorkeur geniet. De figuur hieronder kan je voor een selectie van 9 partijen-en-gemeenten combinaties, voor jezelf uitmaken in welke mate het model de gegevens goed samenvat of juist niet. De rode lijnen zijn de normale regressies en de groene lijnen komen van de multilevel modellen die uiteindelijk werden gebruikt voor de verdere analyse.

Noot: Voor een beter leesbare versie van deze grafiek, zie de oorspronkelijke paper
Nu kunnen we de mate waarin het stemmenaandeel van een kandidaat meer of minder afwijkt van wat we verachten op basis van de regressie zien als een maat van het hebben van meer of minder stemmen dan men zou verwachten op basis van de positie op de lijst. Vervolgens werd naar de gestandaardiseerde residuelen gekeken om, voor elke kandidaat, na te gaan of er sprake is van een outlier (uitbijter) of niet. Tenslotte werd, voor elke kandidaat, nagegaan of ze op een hotspot zaten of niet.
De figuur hieronder geeft de resultaten weer voor de belangrijkste lijsten van de stad Antwerpen. Ik kies hier voor Antwerpen omdat daar het "Touch Screen" effect (waarschijnlijk) het grootst is. Straks wordt er verder ingegaan op de andere steden en gemeenten. Omwille van de leesbaarheid zijn de eerste vier posities niet weergegeven (zie de oorspronkelijke paper voor een argumentatie waarom. In de paper vind je ook dezelfde figuur waarin de posities 1 tot en met 4 wel zijn opgenomen). De zwarte punten geven de werkelijke stemaandelen weer per positie. De groene lijn is de regressie lijn van het multilevel model. Outliers (uitbijters) zijn in her rood gekleurd. De hotspots worden weergegeven door een paar van blauwe verticale lijnen.

Noot: Voor een beter leesbare versie van deze grafiek, zie de oorspronkelijke paper
In de bovenstaande grafiek zien we dat in Antwerpen bij PVDA+, Groen, Stadslijst, Rood! en Vlaams Belang er een outlier is die ook een hotspot is. Alleen bij Open Vld is dat niet het geval. Er zijn wel een aantal partijen waar meer dan één hotspot is, waarvan er slechts één ook effectief een outlier is. Tenslotte zien we ook outliers die niet op een hotspot zitten. Dat laatste mag alvast niet verbazen want er zijn, buiten de positie op de lijst, nog heel wat andere elementen die het relatieve stemaandeel bepalen. Het goede resultaat kan te wijten zijn aan een uitzonderlijke campagne, het kan gaan om BV's, of mensen die een zichtbaar mandaat bekleden enzovoort. Kortom, we moeten nog nagaan of hetgeen we observeren niet aan het toeval te wijten kan zijn. Een eenvoudige manier omdat te doen is om conditionele kansen te beschouwen. In Antwerpen is de kans dat een hotspot een uitzonderlijk hoog stemaandeel heeft ongeveer 55%. De kans op een outlier bij een normale (niet-hotspot) positie is ongeveer 7%. De verhouding van beide kansen is 7,5. Dit wil zeggen dat de kans op een opvallend hoog stemaandeel op een hotspot 7,5 keer groter is op een hotspot dan op een gewone plaats. In andere steden is dat heel wat minder spectaculair, maar daar moet wel bij worden vermeld dat de methode die ik gebruikt heb een conservatieve inschatting oplevert omdat:
  • het gebruik van residuelen om outliers te bepalen niet goed werkt bij kleinere gemeenten wegens het kleiner wordend aantal observaties
  • er op een vrij zwart-wit manier gekeken worden naar uitzonderlijke stemmenaandelen (met name, outlier of niet), terwijl er ook sprake zou kunnen zijn van een (stijgend) effect zonder dat dit noodzakelijk tot een effectieve outlier aanleiding geeft (een voorbeeld hiervan is positie 14 voor PVDA+).
  • ik hier de hotspot heb beperkt tot die positie die in het midden staat, terwijl aangrenzende posities ook een extra stemmenwinst zou kunnen opleveren (mogelijke voorbeelden hiervan in Antwerpen zijn: PVDA+, Rood!, N-VA en Vlaams Belang.)
  • ik de coordinaten van de hotspots heb moeten inschatten en mogelijk fouten heb gemaakt
  • er veel outliers zijn bij de eerste twee en de laatste twee posities, terwijl die posities net minder relevant zijn voor de "Touch Screen" problematiek
Aan dat laatste kan verholpen worden door bij de conditionele kansenbenadering de eerste twee en laatste twee posities uit te sluiten.

Resultaten:
Een conservatieve inschatting van de kansverhouding voor alle Vlaamse gemeenten waar elektronisch werd gestemd samen (Brussel uitgesloten) is 1,10. Nog steeds een effect, maar een eerder klein effect. Wanneer we de eerste twee en laatste twee, outlier-rijke posities, niet mee opnemen in de analyse, dan wordt die verhouding 1,44. Dat wil dus zeggen dat de kans op een uitzonderlijk stemaandeel op een hotspot een tiende tot tot een goede 40% hoger is op een hotspot dan bij een gewone positie. Als we alleen de centrumsteden waar electronisch gestemd werd bekijken dan is de conservatieve inschatting van die kansverhouding bijna 2, en de minder conservatieve inschatting meer dan 4,5. Ik herhaal hier nogmaals de interpretatie: De kans om, in een Vlaamse centrumstad (Gent uitgesloten), een uitzonderlijk stemaandeel te realiseren is op een hotspot bijna tweemaal zo groot als op een normale positie. De minder conservatieve inschatting geeft aanleiding tot een kansverhouding van meer dan 4,5.
Als we naar individuele partijen kijken dan zien we dat sommige partijen meer te lijden hebben gehad van het "Touch Screen Effect" dan anderen. Het valt bijvoorbeeld op dat Vlaams Belang, vooral in de centrumsteden, te maken heeft gehad met een sterk "Touch Screen Effect". Zo is de kans dat een hotspot op een Vlaams Belang lijst in een centrumstad (Gent uitgesloten) een uitzonderlijk stemaandeel oplevert niet minder dan 40%. Dat is 10 keer zoveel als op een normale positie voor die partij. Als men de minder conservatieve inschatting gebruikt stijgt die kansvehouding zelfs tot meer dan 80. De hele problematiek wordt aanschouwelijk in de Heatmap hieronder. De kolommen zijn de 12 centrumsteden waar elektronisch werd gestemd (Gent stemde met papier en potlood). De rijen zijn de posities van de kandidaten. Aangezien het aantal kandidaten op de Vlaams Belang lijst verschillend is van stad tot stad is de grafiek gekarteld. De donkere kleuren (rood en oranje) geven die posities aan die weinig of niet afwijken van wat we verwachten voor die positie (voor de statistici: de kleuring van de heatmap hangt af van de gekwadrateerde residuelen van het eerder besproken multilevel model). De lichte kleuren (tinten van geel en wit) geven sterk afwijkende stemaandelen weer. We zien meteen (op de eerste rij en de laatste kolommen) dat het model niet zo goed in staat is om de stemaandelen van de lijsttrekker en de lijstduwer te modelleren. Voor de studie van het "Touch Screen Effect" kan dat gelukkig niet zo veel kwaad. Hier zijn we vooral geïnteresseerd in het relevante gedeelte, zeg maar tussen de tweede en de voorlaatste positie. Zoals je kan zien is dat gedeelte over het algemeen netjes rood of donker oranje. Er zijn af en toe outliers die een uitzonderlijk hoog (of laag) aandeel in het totaal aantal stemmen van hun lijst hebben gehaald. In de kolom van Antwerpen, bijvoorbeeld, zie je dat de posities 4, 14, 19 en 20 eerder naar het licht oranje en zelfs geel neigen. Het gaat hier dus om een minder binaire (zwart-wit) manier om naar uitzonderlijke stemaandelen te kijken. De hotspots voor Vlaams Belang zijn aangeduid met een blauw rechthoekje. Onmiddellijk zie je dat in de meerderheid van de Vlaamse centrumsteden de hotspots ook een fellere (gele) kleur krijgen, wat een aanduiding is van een (sterk) afwijkend stemaandeel. Het lijken vooral steden te zijn waar de positie van de lijstnaam op het lijstenscherm gedeeld werd over twee kolommen van kandidaten (vandaar ook twee hotspots per stad in Genk, Aalst en Roeselare) dat de partij gespaard is gebleven van het "Touch Screen Effect".

Noot: Voor een beter leesbare versie van deze grafiek, zie de oorspronkelijke paper

Conclusies:
Ik durf op basis van deze vaststellingen te concluderen dat de problemen met de Touch Screens een duidelijk effect hebben gehad op de resultaten van de voorkeurstemmen bij de voorbije gemeenteraadsverkiezingen. Wel is het zo dat je, mijns inziens, op statistische gronden, niet kan nagaan of een bepaalde kandidaat eigenlijk teveel stemmen heeft ontvangen en eventueel ten onrechte verkozen is geweest. Ik vind het daarom niet verkeerd dat de Raad voor Verkiezingsbetwistingen, geen rekening heeft gehouden met het Touch Screen probleem toen het de verkiezingsuitslagen moest goedkeuren. Als je echter alle kandidaten samen beschouwt, dan kan je wel besluiten dat het heel onwaarschijnlijk is dat de goede resultaten van de kandidaten op de hotspots, louter aan het toeval te wijten is.

Sunday, January 20, 2013

Gothic is niet altijd maatschappelijk relevant

Vorige week was er heel wat te doen rond een artikel van Tom F.M. ter Bogt, Loes Keijsers en Wim H.J. Meeus in het tijdschrift Pediatrics over het verband tussen vroeg-adolescente muziekvoorkeuren en probleemgedrag. Ook in Vlaanderen maakte dit artikel veel ophef. Dit had onder andere te maken met een column van NV-A politicus Bart De Wever in De Standaard, waarin hij in een wat bizarre redenering dit onderzoek gebruikte om nogmaals zijn plaat over Theodore Dalrymple te draaien.
Meteen was de toon gezet en ontstonden er twee kampen. Ten eerste had je de groep bestaande uit populaire kranten die een sappig verhaal konden presenteren en politici zoals Bart De Wever die de hierin de kans zagen om hun conservatieve opvattingen over cultuur empirisch te onderbouwen. Aan de andere kant had je de non-believers, die de wetenschappelijkheid van het onderzoek in vraag stelden of die morele bezwaren hadden.
Gelukkig was er nog de krant De Morgen om het hoofd koel te houden. Ze slaagden erin om zowel de hysterische reacties van de non-believers te relativeren (zie "Aardige metalheads, bestaan ze?" van Bart Eeckhout) als de recuperatie door conservatief Vlaanderen aan te kaarten (zie "Kapoen Bart doet zich dommer voor dan hij is" van Patrick De Witte en "Het is geen toeval dat Bart De Wever de hiphop viseert" van nogmaals Bart Eeckhout.).
In Nederland zelf was de reactie ook stevig. Hans Van Maanen was in De Volkskrant relatief kritisch, in ieder geval kritisch genoeg om een reactie van één van de oorspronkelijke auteurs, Tom ter Bogt, te ontlokken.
Het is net die reactie waar ik het hier over wil hebben. Want ook al vind ik de reactie van de media op het oorspronkelijk werk inderdaad onjuist of minstens overdreven, het wederwoord van Tom ter Bogt in De Volkskrant is nogal zwak.
Ten eerste verwijst de titel van zijn reactie op het stuk van Hans Van Maanen, "Kritiek is goed, maar we heten niet allemaal Diederik Stapel", naar de zaak Stapel, terwijl het stuk van Hans Van Maanen helemaal niet naar Stapel of fraude verwijst. Hij vindt gewoon het gewoon een slecht onderzoek is of toch minstens overdreven conclusies trekt.
Maar belangrijker dan dat zijn enkele methodologische bedenkingen. Van Maanen heeft zeker een punt als hij stelt dat de lezer van het oorspronkelijk artikel zelf een aantal zaken moet uitrekenen om de grootte van het effect goed te kunnen inschatten. Het feit alleen al dat ik de aangehaalde voorbeelden van verklaarde varianties van 9% en 21% niet onmiddellijk terug in de oorspronkelijke tekst kan vinden doet me vermoeden dat die inderdaad zijn afgeleid uit andere gegevens. Deze opmerking klinkt misschien pedant, maar ze is wel relevant. Laat me een voorbeeld geven. In het artikel zie ik heel wat correlaties staan (r). Deze moet je kwadrateren om de verklaarde variantie te hebben. Bvb. "Adolescents liking rock music at age 12 also scored higher on delinquency at age 16 (r = 0.21).", houdt in mijn begrip in dat er een correlatie van 0.21 en dus een verklaarde variantie van 0.21x0.21=0.0441 is. Dat is iets meer dan 4%. Als ik kijk naar de rijen 13 en 14 van tabel 3 kijk dan zie ik dat de hoogste correlatie met delinquent gedrag r=0.26 is. De verklaarde variantie is dan 6.76% en dat blijft een mager beestje. Ik wil best geloven dat als je de zaak niet bivariaat bekijkt, maar naar het uiteindelijke multivariate model kijkt, dit effect iets sterker wordt, maar dan hadden de auteurs daar toch wat meer duiding mogen geven. Het loont mijns inziens toch de moeite om uit te leggen waarom het zogenaamde sterke effect van Gothic in het multivariate model, bivariaat niet eens significant is.
Veder dacht ik dat Cohen (1992) het vooral had over effect grootte en "power analyse", maar bon, zelfs al zou Cohen een verklaarde variantie van 9% middelgroot vinden, dan zou daar een correlatie van 30% tegenover moeten staan, en die zie ik niet. Nogmaals, het kan zijn dat die sterkere effecten naar voren komen wanneer je de zaak multivariaat bekijkt, maar enige duiding daarrond had wel gemogen. Overigens verbaasde het me dat met een relatief kleine steekproef (een 300-tal) er toch nog met een relatief uitgebreid multivariaat model gewerkt kon worden. Maar bon, Pediatrics is een ernstig tijdschrift, dus ga ik ervan uit dat dit technisch allemaal wel zal kloppen.
Tenslotte viel het me op dat heel wat reacties op het weerwoord van Tom ter Bogt gingen over de moeilijkheid om wetenschappelijke bevindingen in kranten correct weer te geven. Het is inderdaad daar dat het schoentje wringt: wetenschappelijke terminologie botst vaak met de betekenis die woorden hebben in het dagelijkse taalgebruik. Verklaarde variantie heeft niet noodzakelijk met causaliteit te maken, maar worden door leken vaak zo begrepen. Het feit dat men spreekt over "markers" zal bij sommige lezers een associatie met DNA en met voortbestemdheid teweegbrengen. Het is bijzonder moeilijk om wetenschappelijke bevindingen zodanig uit te leggen dat een leek het juist begrijpt. Dat is zo voor echt moeilijke onderwerpen genre kwantum fysica, maar dat is ook zo voor onderzoek dat dichter bij de leefwereld van de lezer zit (muziek, criminaliteit, enzovoort).
Er is nochtans een heel eenvoudige oplossing voor dit probleem, nl. het voorbehouden van verslaggeving over wetenschap voor echte wetenschappelijke doorbraken. Het artikel van Tom ter Bogt en collega's is volgens mij wetenschappelijk best OK, maar het is, met alle respect, geen doorbraak. Het hoort gewoon niet in de krant thuis. Een gelijkaardig studie in de organische chemie zou ook de pers niet halen. Het is niet omdat het over punk en gothic gaat dat dit plots anders wordt. In de sociale wetenschappen wordt vaak, en terecht, gewezen op het belang van maatschappelijke relevantie. Welnu, de bevindingen van Ter Bogt zijn volgens mij wel wetenschappelijk relevant maar (nog niet) maatschappelijk relevant. Dit onderzoek is een bescheiden puzzelstukje dat past in een groter geheel, nl. de de Music Marker theorie. De status van maatschappelijk relevant zijn verdient ze pas wanneer de puzzel af is. De discussie over de puzzelstukjes zelf kan best in academische kringen worden gevoerd, op die manier worden misverstanden en onnodige discussies zoals dit onderzoek veroorzaakt heeft vermeden.
Als je alleen echte wetenschappelijke doorbraken in de krant zet dan kan je allicht voldoende tijd besteden aan een duidelijke uitleg.
Tenslotte, een haastig geschreven en ongenuanceerd persbericht is zelf om moeilijkheden vragen. De auteurs moeten dus niet klagen dat ze de wind van voren krijgen, ze hebben het zelf een beetje gezocht.

Tuesday, December 18, 2012

Why The Nielsen Company is an #mrx Big Data company avant la lettre

Recently there was an interesting discussion on the Next Gen Market Research (NGMR) Linkedin group. The original discussion was started by Emma Kingham, Marketing Manager at Warc. She asked to "Make a prediction about the future of market research that you believe is GUARANTEED to happen". Pretty soon there was a subthread on market research and Big Data.

Most of us agreed that the analytical capabilities you will find in the market research world can be valuable for Big Data, especially given the strong IT-leaning it seems to have. What we didn't agree on was, suprise suprise, the definition of Big Data itself.  Basically there were two schools of thought. One group saw Big Data as a relative concept: what is small for one community might be big for another. This school basically saw no difference between Big Data and Normal Data: It's just more of it. The other group, that included me, stressed the technical challenges (Hadoop, Mahout, and so on). In my view a lot of the so called big data done by traditional market research firms is not big data by those standards. 

Independent of that  Stijn Viaene (@destivia) pointed to an article in Forbes by Quentin Gallivan (Pentaho Corp)  on retailers and Big Data (Why Big Data Is All Retailers Want for Christmas). I was struck by the fact that The Nielsen Company was not mentioned at all, while traditionally they are an important information provider for Retailers and manufacturers. They're also the largest market research company (source: The Honomichl Top 50 Report).

As an ex-Nielsen guy, I was surprised by this, because Nielsen is one of the few market research companies that actually are dealing with big data for a long time, even before the name big data was coined. OK, they might not use Hadoop (yet), but they have some features that fit the bill quite well. I can't give all the details here because I don't want their lawyers chasing me. But without giving away their trade secrets I can give a few reasons why  you could consider The Nielsen Company as a Big Data company:
  • The Nielsen Company has over half a petabyte of data on Netezza in the US, and 45 terabytes of data on Oracle in its European Customer Information Factory (2009 figures). The Buy segment processes approximately nine trillion purchasing data points each month. I'm pretty sure these numbers are much higher today. While they're mainly using traditional database systems to process the data, they have a tradition of using different strategies to improve performance, for instance in the phase where the store oriented retailer data is aggregated in market and product oriented databases. 
  • Nielsen has developed "online" algorithms to avoid batch processing. Online algorithms process input in a serial fashion without the need of having the entire input available. A very simple example is the "online" version of the mean: $$\bar x_n = \bar x_{n-1} + \frac{x_n - \bar x_{n-1}}{n}.$$I will not disclose here what they're doing with it exactly, but it is pretty clever.
  • Another technique they use to improve speed is "memoization" (i.e.  an optimization technique that uses function calls to avoid repeating the calculation of results for earlier processed inputs.) 
  • They use machine learning algorithms to automatically classify products in meaningful buckets before they are processed by humans. 
  • The company does not only process traditional forms of data, but they have years of experience in processing video and images (commercials for the Watch division and pictures of products for the Buy division).
  • Somewhere around 2005, the European branch of the Watch division of Nielsen toyed around with Tuple Spaces. According to Wikipedia, a tuple space is "an implementation of the associative memory paradigm for parallel/distributed computing. It provides a repository of tuples that can be accessed concurrently. As an illustrative example, consider that there are a group of processors that produce pieces of data and a group of processors that use the data. Producers post their data as tuples in the space, and the consumers then retrieve data from the space that match a certain pattern. This is also known as the blackboard metaphor. Tuple space may be thought as a form of distributed shared memory". Again, a Tuple Space is not Hadoop but nonetheless it is worth noticing that the company was experimenting with distributed processing quite early in the game. BTW, I can report about these experiments because the  project got canceled in an early stage and never made it in production.
  • The statistics departments in Nielsen are called "Measurement Science", pretty close to the now popular term "Data Science" that is often associated with Big Data.

Based on that I think that The Nielsen Company deserves the title of a #mrx Big Data company Avant La Lettre.