Ggplot2, PubMed citation frequency and DSM-IV Axis I disorders by year

Introduction

In an earlier post I used ggplot2 to plot publication count by year for different psychotherapy orientations. I’m using an updated version of that R-code in this post to plot publication count for several major DSM-IV disorders. It’s basically like a very simple discourse analysis.

The search string

I searched for the following disorders: Depression, Bipolar disorder, Post-Traumatic Stress Disorder (PTSD), Attention-Deficit/Hyperactivity Disorder (ADHD), Obsessive-Compulsive Disorder (OCD), Anorexia nervosa, Bulimia nervosa, Social phobia, Panic disorder, Generalized anxiety disorder (GAD), Borderline personality disorder, Agoraphobia and Specific phobia. The following PubMed queries were used:

PubMed Search String

  • Depression[Title/Abstract] (186815 hits)
  • Bipolar disorder[Title/Abstract] (12341 hits)
  • Post-Traumatic Stress Disorder[Title/Abstract] (4294 hits)
  • Attention-Deficit/Hyperactivity Disorder[Title/Abstract] (5121 hits)
  • Obsessive-Compulsive Disorder[Title/Abstract] (7172 hits)
  • Anorexia nervosa[Title/Abstract] (8634 hits)
  • Bulimia nervosa[Title/Abstract] (3547 hits)
  • “Social phobia” OR “social anxiety disorder”[Title/Abstract] (3418 hits)
  • “Panic disorder” OR “panic attack”[Title/Abstract] (8542 hits)
  • Generalized anxiety disorder[Title/Abstract] (2965 hits)
  • Borderline personality disorder[Title/Abstract] (3116 hits)
  • Agoraphobia[Title/Abstract] (2352 hits)
  • Specific phobia[Title/Abstract] (424 hits)

Results — the plots


Figure 1. ggplot with DSM-IV Axis 1 disorders PubMed publication count by year.

Depression removed and plot zoomed in.

Figure 1. ggplot with DSM-IV Axis 1 disorders PubMed publication count by year (depression removed).

Conclusion

The word depression is really mentioned much much more often than the other disorders in articles title/abstracts. Among the other disorders there seem to be that some disorders have become more popular in the last decade. Bipolar disorder, PTSD, ADHD and OCD seem to have gotten some extra attention compared to the remaining disorders. Especially bipolar disorder appear to really have become the "it" diagnosis in the last decade. From what I've heard from psychologists and psychiatrists working in the swedish psychiatry there seem to be some validity to this conclusion.

Changes to the R code

I made some changes to the R code since my last post. Since I'm importing and reading publication year from individual data files for each disorder, I changed the code to bind each new disorder to the previous one, generating one variable in long format. It would have made a lot of redundant code to plot each disorder on it's own ggplot2-layer. I also updated the scrape.pubmed()-function to now accept two arguments, where I specified disorder and disorder type (like mood disorder or anxiety disorder). Another change is that I'm now using direct.label() to remove the legend from ggplot and add labels direct to the plot.

The actual code used

library(stringr) # used for str_extract()
library(ggplot2) # used for plotting
library(plyr) # used for count()

#########################
#### Scrape function ####
#########################
scrape.pubmed <- function(x,y) {
  results <- pubmed_result[5]
  results <- results[results != "ShortDetails"]
  year <- str_extract(results, "(19[0-9]{2}|20[0-1][0-9])")
  count <- count(year[year < 2012])
  count$cat <- x
  count$type <- y
  return(count)
}

########################
#### scrape pubmed #####
########################

# read.delim is used on some files because the csv wouldn't be read
# correctly. Excel was used to save the csv-files as tab delim. files.

# borderline
pubmed_result <- read.delim("~/Downloads/pubmed_borderline.txt")
data.long <- scrape.pubmed("borderline","personality disorder")

# ADHD
pubmed_result <- read.csv("~/Downloads/pubmed_ADHD.csv", row.names = NULL)
data.long <- rbind(data.long, 
             scrape.pubmed("ADHD","Attention deficit ... behavior disorder"))

# Depression
pubmed_result <- read.delim("~/Downloads/pubmed_depression.txt")
data.long <- rbind(data.long, scrape.pubmed("depression","mood disorder"))

# Bulimia
pubmed_result <- read.csv("~/Downloads/pubmed_bulimia.csv", row.names = NULL)
data.long <- rbind(data.long, scrape.pubmed("bulimia","eating disorder"))

# Anorexia
pubmed_result <- read.csv("~/Downloads/pubmed_anorexia.csv", row.names = NULL)
data.long <- rbind(data.long, scrape.pubmed("anorexia", "eating disorder"))

# GAD
pubmed_result <- read.csv("~/Downloads/pubmed_gad.csv", row.names = NULL)
data.long <- rbind(data.long, scrape.pubmed("GAD", "anxiety disorder"))

# PTSD
pubmed_result <- read.csv("~/Downloads/pubmed_ptsd.csv", row.names = NULL)
data.long <- rbind(data.long, scrape.pubmed("PTSD", "anxiety disorder"))

# OCD
pubmed_result <- read.csv("~/Downloads/pubmed_ocd.csv", row.names = NULL)
data.long <- rbind(data.long, scrape.pubmed("OCD", "anxiety disorder"))

# Specific phobia
pubmed_result <- read.csv("~/Downloads/pubmed_specific_phobia.csv", 
                          row.names = NULL)
data.long <- rbind(data.long, scrape.pubmed(
                              "Specific phobia", "anxiety disorder"))

# Agoraphobia
pubmed_result <- read.csv("~/Downloads/pubmed_agoraphobia.csv", row.names = NULL)
data.long <- rbind(data.long, scrape.pubmed("agoraphobia", "anxiety disorder"))

# Panic disorder
pubmed_result <- read.csv("~/Downloads/pubmed_panic.csv", row.names = NULL)
data.long <- rbind(data.long, scrape.pubmed("Panic disorder", "anxiety disorder"))

# Bipolar disorder
pubmed_result <- read.delim("~/Downloads/pubmed_bipolar.txt")
data.long <- rbind(data.long, scrape.pubmed("Bipolar disorder", "mood disorder"))

# Social phobia
pubmed_result <- read.csv("~/Downloads/pubmed_socialphobia.csv", row.names = NULL)
data.long<- rbind(data.long, scrape.pubmed("social phobia", "anxiety disorder"))

###############
#### plot #####
###############

# Used for a plot without depression.
data.long <- data.long[data.long$cat != "depression",]

# Custom linetypes
line.type <- c("anxiety disorder" = "solid",
               "mood disorder" = "longdash",
               "eating disorder" = "dashed",
               "personality disorder" = "twodash",
               "Attention deficit ... behavior disorder" = "dotted"
               )

# Ggplot syntax, saved in 'p' for use with direct.label()
p <- ggplot(data.long, aes(x, freq, group = cat, color = cat, linetype=type)) + 
  geom_line() +
  scale_x_discrete(breaks = seq(1900,2011,5), 
                   limits=as.character(seq(1970,2021))) +
  opts(title="Number of PubMed hits per year and DSM-IV diagnosis",
       axis.text.x=theme_text(angle=45)) +
  xlab("Publication year") +
  ylab("Hits") +
  scale_linetype_manual("Disorder type", values=line.type)

# Use direct.label with the saved ggplot-syntax, to get direct labels after
# each line. 
direct.label(p, "last.bumpup")

Kristoffer Magnusson

I'm a PhD-student and a clinical psychologist from Sweden with a passion for research and statistics. This is my personal blog about psychological research and statistical programming with R.

Comments (2) Write a comment

  1. Another good post. Some comments -

    “Depression” crops up in all kinds of science, e.g. in neuroscience you have “long-term depression” and “cortical spreading depression” which are nothing to do with mood. This is a problem for PubMed counts.

    “Bipolar” has taken off, but this may be partly because it’s a new name for “manic-depression” / “manic-depressive” a term which went out of fashion (and incidentally manic-depression is tricky to search for because it contains a “-”!)

    Also “bipolar” can crop up in other contexts, e.g. “bipolar electrodes” (gets a lot of EEG studies) and some bacteria are bipolar apparantly.

    When I’ve been doing this kind of thing I’ve used “mania” and “hypomania” as proxies for “bipolar” for that reason.

    Reply

    • Yes, you are correct about “depression”. I’ve been pondering if the query would be more valid if I added something like “AND DSM-x …”

      The same could really be added to all terms, since I am searching for DSM-diagnoses. But I think the term “bipolar disorder” (with quotation marks) would be fairly specific. I will re-run these terms with more elaborate queries, now that I don’t have to do it manually. The plot would also be easier to interpret if I added a smoothing function

      Reply

Leave a Reply