Graphics for Clinical Trials


These graphs represent some of the displays I have used in my work as a statistical reviewer for FDA. They have benefited from the input of many individuals, in particular Ana Szarfman and Norman Stockbridge of FDA, and Dan Carr of George Mason University. The present work would have been impossible (or at least really, really, hard) without R and the great work done by the R community.

This page provides links to graphical displays for visualizing data from clinical trials. Each page allows the user to either enter their own data or use the provided sample data, to produce a graph. The output from R script is provided, as is the R script used to produce the graph. It is my hope that these scripts will be used by others to learn about R and produce useful visual displays. Because intermediate files are stored on a remote server, I cannot guarantee the privacy of any data entered into the forms.


The analysis of a clinical trial can be thought of as the answering of a series of questions about the design of the study and the results of the study. In particular the analysis should answer the following questions:

In addition to these questions, an overarching question in a clinical trial is always “Compared to what?” Without a concurrent control group, or a very good understanding of the natural history of the condition being treated, inference about the safety and efficacy of a treatment is suspect. Because of this, most displays should attempt to display both the treatment of interest and a control group.

Why R?

R has a comprehensive graphics system, a comprehensive collection of statistical methods, is available for virtually all computer systems, is widely used, and is free.

Technologies used in constructing this web site include Django, Python, R, and Cairo.
R packages used include Cairo, Gplots, Hmisc, MASS, Rcolorbrewer, and treemap

John Fox and Sanford Weisberg (2011). An {R} Companion to Applied Regression, Second Edition. Thousand Oaks CA: Sage. URL:

Frank E Harrell Jr and with contributions from many other users. (2012). Hmisc: Harrell Miscellaneous. R package version 3.9-3.

Levine, JG, Choosing Strata Weights In Two Group Fixed Effect Analysis of Variance With Multiple Strata When Interaction May Be Present: A Problem In Analyzing Multicenter Clinical Trials. Unpublished doctoral dissertation, 1998.

Levine JG and Szarfman, A Standardized Data Structures and Visualization Tools. Biopharmaceutical Report, Volume 4, No. 3, Fall, 1996.

Erich Neuwirth (2011). RColorBrewer: ColorBrewer palettes. R package version 1.0-5.

R Core Team (2014). R: A language and environment for statistical computing. R Foundation for Statistical Computing, Vienna, Austria. URL

Szarfman, A, Levine,JG, and Tonning, JM, A new paradigm for analyzing adverse drug events in Computer Applications in Pharmaceutical Research and Development, edited by Sean Ekins. John Wiley & Sons, Inc., 2006

Szarfman A, Talarico L and Levine JG Analysis and Risk Assessment of Hematological Data from Clinical Trials. In Comprehensive Toxicology, Volume 4: Toxicology of the Hematopoietic System. Edited by I. G. Sipes, C. A. McQueen and A. J. Gandolfi. Elsevier Science, New York, 1997.

Martijn Tennekes (2012). treemap: Treemap visualization. R package version 1.0-4.

Simon Urbanek and Jeffrey Horner (2011). Cairo: R graphics device using cairo graphics library for creating high-quality bitmap (PNG, JPEG, TIFF), vector (PDF, SVG, PostScript) and display (X11 and Win32) output.. R package version 1.5-1.

Venables, W. N. & Ripley, B. D. (2002) Modern Applied Statistics with S. Fourth Edition. Springer, New York. ISBN 0-387-95457-0

Gregory R. Warnes. Includes R source code and/or documentation contributed by: Ben Bolker, Lodewijk Bonebakker, Robert Gentleman, Wolfgang Huber Andy Liaw, Thomas Lumley, Martin Maechler, Arni Magnusson, Steffen Moeller, Marc Schwartz and Bill Venables (2012). gplots: Various R programming tools for plotting data. R package version 2.11.0.

R Learning Resources

More Books About R on Amazon

Clinical Research Graphs

Scatter Plot With Density Estimates Min Max Scatter Plot With Boxplots Patient Event Time Line Bubble Plot Boxplots with density estimates Mean Response by Subgroup Cell Means Over Time Labs Tests Over Time- Points Labs Tests Over Time- Lines Labs Tests- Representative Curves Sample Sizes by Study Tree Map Adverse Event Dot Chart Boxplots for Several Variables Boxplots for Several Variables--Diet Cumulative Incidence Plot Competing Risks-Kim Example Competing Risks-cmprsk Example QQ Plot QQ Plot QQ Plot Descriptive Statistics Multicenter Clinical Trial QQ Plot for Two Groups Scatter Plot With Boxplots Min Max Scatter Plot With Density Estimates Crosstab of Boxplots With Density Estimates