PubMed publications in 2011 by 202 world countries: who’s the winner?

May 07, 2012

post feature image. By Kristoffer Magnusson


I had this idea that it’d be fun to look at all PubMed’s articles from 2011 and extract country affiliation for each individual country. So I set out to do just that, but in addition to just look at 2011 I also looked at proportional change in publication 1980–2010 for the top 20 countries. The data for 2011 is visualized on a world map both as a bubble plot and as a heat map.

It turned that this project weren’t as straightforward as I first had anticipated. Mainly because PubMed’s affiliation field is a veritable mess with no apparent reporting standard. I imagine there are databases who are much more suited to this task than PubMed.


There were 986 427 articles published in PubMed in 2011; so I, naturally, used R to extract national publication counts. I did this by downloading all citations into one 8.37 Gb XML-file, imported the affiliation strings into MySQL and then used R to extract country affiliation using grep and regular expressions.

To avoid unnecessary manual work I used lists of country names, U.S state & university names, India states and Japan universities. I also looked at word frequencies for the affiliations strings that couldn’t be matched, and used this to make additional pattern lists. Lastly, I also used mail-suffixes to extract affiliation.


To find out how many mismatches my script perfomed, I drew a random sample (n = 2000) and manually screened for errors. 22 errors were found, and all of them entailed the string being matched to the correct country plus one incorrect country, i.e. this string were matched to both UK and US (because “Bristol” is matched to UK):

Department of Biotransformation, Bristol-Myers Squibb, Route 206 and Province Line Road, Princeton, NJ 08543, USA.

It’s not really a big problem since it only occurs in 1.1 % of the sample. The following countries had erroneous extra matches in my random screening sample:

Moreover 1.8% of the affiliation strings couldn’t be matched to any country, by analyzing the word frequencies for the unmatched strings, I concluded there didn’t appear to be any words that could be used to identify an significant amount of countries.

Additionally, I compared the number of hits for my top 20 countries to the corresponding hits when searching PubMed using rudimentary country queries. These were the results:

The measurement error is a bit high in countries like Poland, Switzerland and Spain. Nonetheless, I decided to use these PubMed quires to look at annual publications for these countries 1980–2010, using my PubMed trend script


In total 202 countries were extracted, with the publication distribution looking like this:

PubMed publications world map plot. By Kristoffer Magnusson

PubMed publications top 20 countries world map bubble plot. By Kristoffer Magnusson

The same plot as above, but with the bubble size representing publications per capita.

PubMed publications top 20 countries world map bubble plot. By Kristoffer Magnusson

And a plot of the top 20 countries publication percentages 1980–2010

PubMed publications top 20 country year 1980–2010. By Kristoffer Magnusson

I really don't know why USA had such a boost in the 1990s, perhaps it got something to do with PubMed's indexing or maybe it's a consequence of the ["1990s United States boom"][]? The reason for the sudden increase in US citations in the 90s is that prior to 1995 MEDLINE did only record institution, city, and state including zip code for authors affiliated with the US. So naturally, my queries will miss most US publications prior to 1995. However, the apparent question is: when will china surpass US in scientific output?

PS 1. Thanks to Allan Just for telling me how to extract centroid values from the country polygons.

PS 2. My plan is to do some more in-depth analyzes if this data, e.g. to look at publications per capita (in a vain attempt to increase Sweden’s rankings) and some traditional statistical analysis. Update: Publications per capita added.

Written by Kristoffer Magnusson a researcher in clinical psychology. You should follow him on Twitter and come hang out on the open science discord Git Gud Science.


Published May 07, 2012 (View on GitHub)

Questions & Comments

Please use GitHub Discussions for any questions related to this post, or open an issue on GitHub if you've found a bug or wan't to make a feature request.