Simple Creation of Summary Statistics for Research Papers
Generating summary statistics is a common task in research and often requires iterative refinements. In this post we will demonstrate how to conveniently generate a Table 1 used for research papers in an automated fashion. We will be using public data from a clinical trial by Vickers et al. (2004) which was published in the British Medical Journal (BMJ) on the use of acupuncture as a therapy for chronic headache. The PDF is available for download for free at the BMJ website (link).
As is customary, the authors provide a Table 1 featuring baseline characteristics of the treatment and control groups.
A copy of the raw trial data is available here (link) on the Springer website (Excel File Format).
Using this data set we will walk through the steps on how to create a Table 1 automatically, by making use of www.table1.cc.
Let's get started!
1. Download the sample trial data
- Go to https://trialsjournal.biomedcentral.com/articles/10.1186/1745-6215-7-15#Sec18 to download the trial raw data (excel format) or use the direct link here: 13063_2006_152_MOESM1_ESM.xls)
2. Select the data of interest
- Open the Excel file with MS Excel, LibreOffice or Google Docs
- The Table 1 in the trial is based only on patients that are listed as “completers”. (Fig. 2)
- If you wish to recreate the exact same Table 1 select patients that are “completers”: In the tab ‘Data’, sort for ‘completers’ and select all rows in which completer is ‘1’. This should be the case for 302 rows (including the header row).
- Feel free to use a different subset of the data set or your own data set if you would like to experiment with that
- Copy the rows of interest into the clipboard by either pressing control+c or right clicking on the selection and selecting copy.
3. Go to table1.cc and paste the content of the clipboard
- Right-click on the text field on the starting page and select paste (Fig. 3; orange box). Alternatively, you can press control + v to paste the file.
- Next, click on ‘I pasted the spreadsheet data’ (Fig. 3; red arrow)
4. Select variables of interest and variable types
- You should see a message Table parsed successfully appear in a green box (Fig. 4)
- To recreate the original Table 1, check age, sex, migraine and chronicity as ‘variables of interest’
- Feel free to experiment with other variables. For the example data set, their meaning can be found in the Excel file in the Description of Variables tab
- For age, leave continuous. For sex and migraine, select categorical.
5. Select the grouping variable and confirm to create the table
- The ‘grouping variable’ stratifies the resulting table by a certain characteristic.
- To recreate the original Table 1, select group (which distinguishes between intervention and control patients).
- Check “switch group order” to have the intervention group (1) appear before the controls (0)
- Scroll down and click the “Make Table 1!” button
- Scroll down again and your Table 1 with the selected variables of interests and the appropriate measures (mean, standard deviation, percentages) appears (Figure 5)
- Voilà, you just created summary statistics, fast and efficient !
6. Adjust and Fine tune formatting
- Experiment with additional variables of interest, adding p-values, etc.;
- It is now very simple to add p values, missing values, and fine-tune the table to you needs
- You can also explore other grouping options to help understand your data
- Selections of variables can be adjusted quickly, as the settings will carry forward
The caveat of the authors of the tableone Python package always applies:
We encourage the use of tableone alongside other methods of descriptive statistics and, in particular, visualization to ensure appropriate data handling. […] Guidance should be sought from a statistician when using
tableonefor a research study, especially prior to submitting the study for publication.
Try out simple and efficient creation of your Table 1 by applying this tutorial at https://www.table1.cc !
Follow us on Twitter (@table1cc) to stay up to date with new features or submit requests or questions.