Jun 19, 2015

Bland Altman plots with density plots (with repeated measurement) (R code)

The Bland-Altman plot is a tool to analyze the agreement between two different measurements. I used it in several of my papers. Sometimes, I feel the original B-A plot is not visually enough to show the distribution of dots (mean vs diff). Adding the density plots for the mean and diff may provide more information of how the two quantities located/shaped. So in most of my papers, I use B-A plot together with density plots of mean and diff (of the two measurements).

Also, in some studies, we have repeated measurements for each subject. Then the B-A plot should adjust to the repeated measurement. The MedCalc has a menu to do "B-A plot with multiple measurements per subject" Also see Bland JM, Altman DG(2007) Agreement between methods of measurement with multiple observations per individual. J. of Biopharmaceutical Statistics, 17:571-582.

MedCalc is a good tool. But I still hope to use R to draw a configurable (good-looking) graph. So, here are two R scripts for B-A plots (traditional, and for repeated measurements). Have to say, I just assembled the code (I used example code from here). The R code is available here.

To use it. assume in r workspace there are variables 'x' and 'y' as two measurements (same length vector), and a variable 'id' to indicate which subject each value belongs to.
>Bland.Altman.re(x, y, rep.meas=TRUE, subject=id, xname='XMeas', yname='YMeas', addDensity=TRUE)

Mar 14, 2015

A Note: They get my affiliation info wrong in a recent publication

Just want to make a note here.
In a recent publication: 
Titled as "Accuracy of continuous noninvasive hemoglobin monitoring for the prediction of blood transfusions in trauma patients.", my affiliation was mistaken as "Department of Biomedical Engineering, UMBC", which I have never been affiliated with. The correct one should be "Department of Anesthesiology, University of Maryland School of Medicine". I don't understand why such mistake had been made! It is very frustrating since I feel I contributed much in this paper while the small detail was not taken care of.

I just make a note here. I hope this issue could be solved later, after I contacting with them.

Mar 7, 2015

How to create high resolution figures for publication

When publishing articles in some journals, we may see some specific requirement for figures, such as the size, color, and resolution. For resolution, often the authors are asked to submit separate image files with high resolution (e.g., 300 dpi for color images, and 1200 dpi for gray images), instead of embedded ones (often seen in medical journals). If you are not using LaTeX, Pgf or tikz, you may need to create those figures from drawings generated by MS Word, or PPT, or other drawing software.

Here are the steps to create high resolution figures.
1. Install 'GIMP' from www.gimp.org
2. Prepare your figures from any plotting software; keep it as clear as possible. If they are plotted from Word or Powerpoint, use the system snipping tool, or any screen print program to 'cut' the image. For example, below is one figure generated by Powerpoint.
3. Save the screenshot as png. Right click to find out its dimension from "properties-->details". E.g. this image is 583x303 pixels, with 32 bit depth.
4. Launch 'GIMP', create a new file, and set Image size W=583, H=303; In advanced options, set X resolution=300, Y-resolution=300 (or other values required). If the journal requires some specific figure size, then you need to set the Image size correspondingly.
5. Click OK, and drag the saved PNG image file into the newly created canvas. From 'File' --> "Save As". Now you can save it as the required file type, (often be 'TIF', or 'eps'). You can verify the new figure's resolution by right click and choose "Properties" --> "details".
Of course, I personally prefer LaTeX+TIKZ. But not all the time you can use them. So the GIMP comes for help.