4 mistakes in data journalism – and how to avoid them

It may sometimes feel as though data journalism is inherently more objective than other types of reporting. Numbers can’t lie, right?

Wrong.

There are lots of ways of tricking your audience or even yourself when working with data. It needn’t even be malicious. Having spent the past year studying data journalism, I’ve had plenty of opportunities to discover first-hand that it’s all too easy to make mistakes that skew your results completely.

So without further ado, here are the four biggest problems I’ve encountered with bad data journalism over the past year.

1. A lack of context or proportion

Numbers are meaningless without some context. This rarely becomes more obvious than in news reports on spending, where this problem crops up on a regular basis.

“Taxpayers paying more than $1 billion for illegal immigrant children,” headlines yell out. “Benefits spending up £6.4 billion.” The figures sound outrageous, astronomical even. It’s tempting to want to splash on them. But public spending figures have a tendency to be, well, astronomical. Put it into context: Break it down per person and you may find that in fact they’re totally reasonable.

What’s the lesson here? Proportions tell us more than absolute numbers, to be sure. But they’re not always the right way to go, either. Think about your data and how to represent it most faithfully.

Guardian data journalist James Ball recommended in a lecture that all data journalists put together some basic figures to avoid making stupid mistakes and have an easier time spotting what’s reasonable and what isn’t: How many people of working age are there in the UK? What’s the average salary? What’s the employment rate? Et cetera. Not a bad suggestion.

2. Correlation does not equal causation

If you know one thing about statistics, it’s likely to be this. Correlation and causation are two very different things.

However, this is also something that newsrooms ignore all the time. But just because you have two variables that correlate – don’t automatically assume you’ve got a scoop. This could equally be caused by some other, underlying variable. Or just be a total coincidence.

Correlation between Internet Explorer's market share and murder rate

Seems legit. (Photo via Gizmodo)

The relationship between Internet Explorer’s market share and the murder rate is a personal favourite. Check out Spurious Correlations for more (don’t blame me when you realise you’ve wasted an afternoon there, though!).

3. Not knowing how to visualise it

Okay, this really deserves a post of its own. Or several. But for now, this will have to do.

You’ve done your data analysis, you’ve got a cracking story. But a poor visualisation may leave viewers confused. Or worse, misled.

3d pie chart

Please don’t do this. (Photo via Business Insider)

Maybe you’re using line charts to show discrete data (don’t). Maybe you’re trying out some funky 3D pie charts (DON’T). Or maybe you’re just becoming part of that eternal debate on whether it’s ever, ever okay to truncate the y-axis.

Data visualisation’s both an art and a science, and there are many potential pitfalls. Here are some good guides on how to avoid them:

4. Forgetting the narrative

This is the most important point, in my opinion:

Data journalism gives us the power to explore topics quantitatively. But it’s still journalism, which means it’s still storytelling. If you’re just tossing out a bag of random figures, you’re not doing your job properly. They’re just the starting point. Now, you need to guide your readers through the story. You need to make them understand why those figures are important and how.

As  Tanveer Ali puts it in the Columbia Journalism Review:

“Numbers are a means of storytelling – not the story itself.”

Tutorial: Network analysis of a Twitter hashtag using Gephi and NodeXL

Network analysis is a nifty area of data journalism that can show you how people are connected. This can be any type of connection really – Swedish data journalist Jens Finnäs mapped Eurovision voting data to see what countries vote for each other most often – but increasingly, it means looking at social networks like Facebook and Twitter.

Twitter Census by Intellecta

Twitter Census by Intellecta

Since I’m just starting to get the hang of network analysis myself, I thought I’d share what I’ve picked up so far with this tutorial.

You can visualise your own Facebook friends, or find out who the most influential users are on a certain hashtag. This last example is what I’m going to go through in this tutorial, using the Excel extension NodeXL and the network visualisation tool Gephi.

  1. Download NodeXL and Gephi.
  2. Open a blank NodeXL template through your Start menu.
    2
  3. A network graph basically consists of nodes (in this case Twitter users) and the connections between them, which are called edges.
  4. We’re going to import nodes and edges for all the users who’ve tweeted using the #ddj (data journalism) hashtag. We could do this using something like R, but thanks to NodeXL it’s all got a whole lot less complicated.
  5. Click on Import and choose “Import from Twitter search network”.
    3
  6. This is where you fill in what hashtag network you want to analyse. In theory, you can import the last 18,000 tweets on this hashtag, but in practice you’re unlikely to ever get quite that many, because of Twitter’s age-limits.
    4
  7. Once you click on that OK button, sit back, relax and let NodeXL work its magic. In fact, maybe go make yourself a coffee. If there are a lot of tweets to import, it’s going to take a little while.
  8. This is what you should end up with:
    5
    Every vertex, or node, is a Twitter user, and NodeXL has logged all the ways in which it has connected with other vertices using the #ddj hashtag. The tool fetches plenty of useful information about the tweets and the tweeters – from number of followers and bios to whether something is a retweet. Have a peek through the columns.
  9. This is now ready to be exported to Gephi. Select Export as GraphML file.
  10. Now we’re getting into the really fun stuff. Fire up Gephi and click on Import Graph File in the top left.
  11. When asked in the pop-up window, choose a directed rather than undirected graph. This will vary depending on what type of network you’re analysing. For Twitter, that has asymmetrical follow relationships, directed makes more sense, but for Facebook, where a friendship can only go both ways, undirected would be better.
  12. Okay. We’ve now got a graph that looks like so much grey chaos.
    6
  13. To fix that, we’re going to start by changing the layout. Choose Force Atlas 2, and set the scaling to something like 3.0. The scaling will affect how closely the nodes in your network are drawn to each other. Click on Run and see magic start to happen.
    7
  14. Next step: On the right-hand side, you’ve got a number of settings. Click Run on Modularity and Eigenvector centrality. Eigenvector centrality is a pretty funny word, but it’s also a useful way of measuring how important a node is within its network. There are a number of different centrality measures, and which one you need will depend on your network. This post is a good introduction.
  15. We’re going to do two more things to get a more useful layout. First, colouring the nodes based on their groupings. To do this, click on Partition in the top left and choose Modularity as the partition parameter. Click Apply.
    8
  16. Next, we want the nodes’ size to reflect how important they are to the network. Click on Ranking and select Size by Eigenvector centrality. I went for a minimum of 10 and maximum of 150.
    9
  17. We’ve now got different sized nodes depending on how central they are – but they’re all jumbled up. Go back to the layout tab and select Prevent overlap. Run that again until the graph is more evenly spaced out.
    10
  18. Labels: Click the T icon under the graph to show your nodes’ labels. Click on the A next to it and select Scale labels by node size.
    11
  19. Your graph is practically done! Go to the Preview tab where you can fine-tune the actual appearance some more, if you want. Otherwise, just admire your creation. It’s ready to export!
    12
  20. A static image of your network is easily exported as SVG, PNG or PDF. If you want to make something interactive, Sigma JS is a great Javascript library. There’s also a helpful Gephi extension for it called SigmaJS Exporter.

13

Phew! That’s it, we’ve made a basic network graph of people tweeting about data journalism. Can you find yourself there?

Any questions or thoughts, let me know on @cguibourg or here.

Learning D3, or my struggles through coding’s Desert of Despair

It’s been rather quiet on the blogging front lately. I’m now more than half-way through my MA at City, and let’s just say the coursework is starting to pile up.

One thing I have been trying to make time for in those few spare moments is working my way through D3 tutorials. I’m trying to improve my Javascript skills and learn to use the visualisation library to create vizzes free from the constraints that out-of-the-box tools have.

To that end, I’ve read books, gone through video tutorials, and even went to a real live workshop. I’ve got to be honest: It’s been a challenge. If the first baby steps I took while learning to code were easier than I’d been expecting, I’m definitely deep in the Desert of Despair now.

[On a side note – every coding noob should read this blog post, with the perky title ”Why learning to code is so damn hard”. It cheered me up no end.]

D3 code

This made me hyperventilate a bit. It’s part of the code for the chart below.

Back when I whizzed through my first HTML tutorial at Codecademy, I was picking up badges and gold stars and generally feeling pretty pleased with myself. I stupidly thought to myself: ”I’ve totally got this coding thing covered.”

Now, every tutorial seems to bring up another slew of things that I need to understand. Things that I ought to understand. Things that I really, really don’t understand and that quite frankly make my head hurt. But hey, apparently that’s normal.

So it has been a little painful so far, but I’m now slowly starting to feel the possibilities that D3 could bring. I mean, sure, so far I’m happy if I manage to make a bar chart, so I may not have reached the Upswing of Awesome quite yet. But HYPOTHETICALLY. The possibilities are definitely there.

D3 bar chart

So yeah, I can now make bar charts.

(You can have a peek at the interactive version of the chart here.)

Anyway, this is all a rather roundabout way of saying that I wrote a longer piece about the pros and cons of different D3 tutorials, posted on the Interhacktives blog. Have a read if you, like me, want to learn more about it.

Learn Python the Hard Way, exercise 22

SYMBOL

DEFINITION

print Outputs results of expressions to command line. Similar to JavaScript’s ”console.log”
# Comments out a line of the script
#MATH OPERATORS
+ Add
Subtract
* Multiply
/ Divide. Division with integers rounds down to the nearest integer.
% Modulos. Gives the remainder of a division.
+= Shorthand for ”plus itself”. Eg. x = x + y is the same as x += y
#COMPARATORS
< Less than
> Greater than
<= Greater than or equal to
>= Less than or equal to
!= Not equal
== Equals
= Assigns value to variable. NB! Not a comparator.
variable A storage location holding some data, assigned some identifying name.
integer Whole digit numbers
float Numbers with decimals.
string A sequence of characters, eg text.
boolean A variable with two possible values: True or False.
concatenation Joining several strings together end to end.
formatters Allows you to format strings with variables within them.
%s String
%d Digit
%r String
\ Escapes certain characters from the script.
\n New line
\t Tab
””” Three quotes allow you to write strings as long and as many lines as you want
raw_input() Prompts user to input something.
int(raw_input() Converts user input to integer
import Import modules from other Python libraries to your script. This enables you to import just those bits that you need for your script, keeping it small and neat.
modules Features
argv List of command line arguments for a Python script.
open() Opens an external file in your script. The default is read-mode, but you can pass an optional argument to the method to open it in write or annotation mode. Eg. [file].open(‘w’) opens in write mode.
read() Reads opened file.
close() Closes a file
write() Writes a string to the file. Syntax fileobject.write( str )
truncate() Clears file, partially or completely. An optional size argument truncates the file to that size.
seek() Sets the file’s current position at the offset. Default position is 0, but there is an optional whence argument.
readline() Reads one line of your file
len() Returns the length of an object
functions A named section of your script that performs a certain task when called.
def Used to define new functions in Python. Syntax: def function_name:
arguments Input parameters
return Returns a value from a function
exists Checks if a file exists
pydoc Python documentation. Access through Powershell via ”python -m pydoc [method]”

 

Project Ada: Why I’m launching a website on women in tech

Good news, everyone!

I’ve just launched the news website Project Ada, together with my fellow Interhacktives Sam, Keila and Ashley. (Mainly I think I’m just on a roll, purchasing domain names left, right and centre, after discovering how incredibly easy it was when I created my own website.)

(I kid.)

Screenshot of the Project Ada website.

Project Ada covers women in technology, which handily combines two of my greatest interests: feminism and all things geeky and techy. We fannishly borrowed the name from the original geek goddess and first ever computer programmer, Ada Lovelace.

What’s this?

Tech industries have a massive gender problem, with the percentage of women in the field not just low but actually dropping. Which may have something to do with the tragically old-fashioned ideas about tech being somehow… un-feminine that are still being bandied about. Here’s Decoded’s Kathryn Parsons, who I interviewed for Project Ada last week:

“People still say to me ‘women’s brains don’t really work that way’. It happens every week. I won’t stop until I never hear that phrase again.”

We want to report on these issues, and also showcase the many role models in the industry that are obviously out there.

So why am I doing this?

What, apart from the fact that I get to report on an important topic for me?

I want to deepen my knowledge of this niche, so that I can become a better reporter on this particular beat, and get to know people in this field. And heck, what better way to learn than by just getting out there and doing it?

I want to be covering this beat anyway, so this is a perfect opportunity to practice and build contacts in this field, while showcasing some of the stories that I’m proud of.

Also, although I’ve worked as a web editor for a few years, this is actually my first experience of building a news site completely from scratch, and building a community alongside it, and I look forward to experimenting both with content, site and how to build an audience.

Facebook

Our brand-new Facebook page is already attracting more traffic than Twitter.

If nothing else, I’ve got high hopes that reporting for Project Ada will get me off my butt and into attending a lot of inspiring hackathons and events. Not a bad reason in itself.

Interview: Elliot Bentley on why newsrooms need hackathons

Getting readers into the editorial process at the click of a button? This was the idea that caught the judges’ attention at the recent Build The News hackathon.

I took a moment to speak to the Wall Street Journal’s Elliot Bentley, one of the team members behind winning entry, Crowdtip, about what makes their idea stand out.

A screenshot of Crowdtip

Crowdtip

“Often the comments can be a big cesspool of readers shouting at each other, or at the writer. It’s difficult for journalists to gather meaningful feedback from vast quantities of comments,” he said.

To solve that, Crowdtip works as a widget embedded into articles, allowing readers to vote on which direction the newsroom should take in future coverage. A vote is submitted at the click of a button.

Why go to a hackathon?

Elliot Bentley

Elliot Bentley

So, after a hectic 48 hours, does he think it was worth giving up a weekend to participate in a hackathon? Elliot Bentley, who’s been to one other hackathon before Build The News, is convinced of its value.

“What’s great is that you create a space to experiment in and come up with ideas, without worrying about day-to-day work. There are often a lot of practical reasons why these things couldn’t get done, so it’s nice to put these limitations to the side.”

Melding journalists and coders

Most newsrooms today are still treating journalists and developers as slightly separate species, with their workspaces physically and mentally separated from each other. Events like Build The News bring them closer together, Elliot Bentley said.

“These events create an understanding between these two groups – actually, I don’t like to think of them two groups, personally. They start melding.”

Incidentally, he rather neatly embodies this idea himself, having moved from student media to front-end developing. The Guardian once described the Wall Street Journal graphics editor as a “new breed of journalist-cum-coder”.

“I really like coding, and I really like web development. For me it was natural to develop these skills I was interested in,” he said, adding that we should all be aspiring for ‘technological literacy’.

“I wouldn’t say that everyone aspiring to be a journalist should learn to code. That would be ridiculous. But journalists should get a better understanding of what’s going on behind the scenes as computers become more and more essential.”

Building the news

I’ve spent the past weekend fueled by a constant Haribo and caffeine rush at Build The News.

At the hackathon, organised by The Times, student journalists and developers join up to create the best journalistic product.

Build The News
Look how tidy everything is at the start of the weekend! (Photo: Keila Guimaraes)

Our team, one of two from City University, worked on Hotspot, a way of curating and integrating comments on articles. Essentially, a traffic light ‘hotspot’ system shows the reader how commented a specific paragraph of the article is, highlighting the most hotly commented parts. Then, it allows you to jump right in on a comment thread specifically about that paragraph.

The idea is to remove noise, tailor discussions to readers’ interest – and quickly show readers what other have considered the most interesting parts of the article.

(We’ve written a whole lot more about our idea and the whole concept development process on our team blog Interhacktives Build The News.)

It’s been an extremely intense 48 hours, but it’s been a blast. I was really impressed by the ideas that all the other teams were coming up with, and I’ve had some very interesting discussions with people who’re really making some amazing things happen in an industry in massive flux.

Not every journalist can or should be a developer, of course, but collaboration and communication between journalists and developers is key. That’s one of the main lessons to be learned from events like Build The News, and I hope to see more newsrooms move to integrate these teams more.

Another of the really great things about Build The News was something which I’m also loving about going back to j-school, after some years as a reporter: It was great to really take the opportunity to get thinking and experimenting about where we want the future of journalism to go. It’s the kind of discussion that should be constantly ongoing – but honestly was something I rarely had the time for when actually in a newsroom.

250308_10152634014034822_7539968367491162617_n
Clearly battling my code and losing… (Photo: Ashley Kirk)

I now solemnly pledge to do it more regularly. Also to get cracking on my really appallingly rusty Javascript.

(Want to read more accounts of this weekend? Fellow students Ben, Emily and Ashley have penned some great thoughts about it.)

How to create Google Fusion maps that actually look nice

Fair warning: This post will include a snippet or two of HTML and Javascript. Don’t panic.

So here’s the thing: Google’s Fusion Tables is a fantastic free tool for mapping data, particularly when more advanced programs such as CartoDB and qGIS still scare you (=me). If you’re unfamiliar with it, data journalist Simon Rogers has published a great tutorial of how to use it.

There’s only one problem. Since every newsroom in the world is using the same tool, results tends to look very… generic. For instance, I recently made an interactive map for a story in the Hackney Post about Hackney’s claimant count being the highest in Greater London. Dandy, but when I simply use Google’s auto-version of the map, it looks like this:

fusion1

The colours are incomprehensible, there’s no legend… Definite room for improvement.

Luckily, there is a solution to this. It’s actually possible to tweak and customize your maps as much as you want.

Colours

First of all, and easiest: On a chloropleth map, we can change the colours of the polygons freely, and a great tool for choosing appropriate colour schemes for your data, whether it’s diverging or sequential, is ColorBrewer.

fusion2

Legend

Google’s Fusion Tables doesn’t automatically include a legend, but you’re pretty much always going to want one. Open “Change feature styles” and click on ”Automatic legend” to get that sorted.

fusionnew1

Background

Phew, piece of cake! Next we’re going to change the background of our map, which still has that very recognizable Google Maps colour scheme. Now, this bit does mean you’ll have to be able to look at a page of code and not run screaming in the other direction. If you’re somewhat familiar with the syntax of these languages, you’ll be absolutely fine. If not, take some deep breaths and you’ll still get through it!

1) When publishing your map, instead of grabbing that handy old Iframe code and embedding it into your article, you’re going to want to use the raw HTML code.

fusionnew

2) Paste it into any sort of text editor, such as Notepad or SublimeText (which I highly recommend for any sort of coding).

3) To customise the background colours, you can tweak freely using Google’s own Style Wizard.

fusion7

If you’re lazy, though (=again, me) a site called SnazzyMaps prepares ready-made templates. Whichever you use, you’re going to end up with a snippet of code.

Where to put it?

fusion5

4) Roughly one-third of the way through the code you’ve got in your editor (I’m using SublimeText, which is why everything is so delightfully colourful!) there’s a row that looks like this:

                     mapTypeId: google.maps.MapTypeId.ROADMAP

Add a comma to the end of that row and press enter. Then paste in your snippet of code from SnazzyMaps or the Style Wizard. Like so:

fusion8

That’s it! That’s all we need to be able to do with the code. My finished result, uploaded onto my website, looks like this:

fusionmap

 

Now, to keep it simple, in this example we only changed the background colours. Once you’re feeling comfortable with the code, you can of course tweak any part of it. Change the size of the map, add charts to your info-windows, change the legend (something you may notice I’ve actually done above)… The possibilities are limitless!

Is there anything you think I’ve missed? Let me know! Write me a comment, or tweet me @cguibourg.

12 Twitter accounts you should follow for Hoxton West and Hackney

As a trainee reporter at City University, I’ve been assigned to cover Hoxton West for the next couple of months. One of the first things I did to better get to know my patch was to dive headfirst into Twitter (don’t worry, I went out in the real world too!). I’ve compiled a Twitter list of interesting people to follow for news about Hoxton and the rest of Hackney.

1.  Carole Wiliams is one of Hoxton West’s three Labour councillors and an active tweeter for political news about the ward.

2. Philip Glanville, another councillor from Hoxton West to have taken to Twitter, mixes politics and more personal tweets. (If you’re wondering about the ward’s third councillor, Clay McKenzie, he does have a Twitter account, but last posted some 1100 days ago.)

3. St John’s Hoxton is a church clearly working to bring the Anglican faith into the 21st century, with an active Twitter account and lots of news on its online noticeboard. 

4. MPS Hackney. The police are very active on Twitter in many of Hackney’s wards, but it seems Hoxton West has no specific police account. @MPSHackney tweets more generally about crime in the whole borough, but is still a useful account to keep an eye on. 

5. Likewise, Hackney Council covers a larger area, but tweets lots of updates that are relevant to Hoxton West. 

6. Meg Hillier is the MP for Hackney South and Shoreditch, and tweets about local political news. 

7. We Love Hoxton. (Sure, who doesn’t?) Behind the cheerful name is an account with political news, run by councillor Carole Williams. 

8. Hackney Winter Night Shelter provides night shelter for homeless people during winter, and aforementioned St John’s Hoxton is one of the churches affiliated with the Night Shelter. 

9. Young Hackney is a great account for keeping track of what’s going on for young people in Hackney. The account also retweets lots of relevant news about young people from other accounts. 

10. Yeah Hackney is a forum for people living in Hackney, and tweets a daily summary of the major news from the forum and from other relevant Hackney accounts. 

11. @HackneyCVS keeps you posted on volunteer work being done in the area. 

12. Greener Hackney is the council’s channel for environmental news. As Hackney has once been named inner London’s ”greenest borough”, expectations on green developments in the area are high. 

… and, as a bonus, there’s naturally the Hackney Post! Run by City students (full disclosure: I am one of those students), the paper aims to provide great local news from Hackney.