Last week I posted about a modified age bias plot. In this post I began looking more deeply at an alternative plot called the BlandAltman plot. Below, I describe this plot, demonstrate how to construct it in R, give a mild critique of its use for compare fish age estimates, and develop an alternative that is mean to correct what I see as some of the shortcomings of using the BlandAltman plot for comparing age estimates. This is large a “thinking out loud” exercise so I am open to any suggestions that you may have.
BlandAltman Plot
The BlandAltman plot (Bland and Altman 1986) is commonly used in medical and chemistry research to assess agreement between two measurement or assay methods (Giavarina 2015). McBride (2015) used the BlandAltman plot in his simulation study of the effects of accuracy and precision on the ability to diagnose agreement between sets of fish age estimates. McBride (2015) noted that BlandAltman plots “readily depict both bias and imprecision” and that this was summarized for “the entire sample, rather than specific age classes.” Despite this, I am aware of only two entries in the fisheries literature that used the BlandAltman plot to compare fish age estimates (one in the grey literature, one in a thesis). Below, I describe the BlandAltman plot and then offer a modified version for comparing estimates of fish age.
The BlandAltman plot is a scatterplot where the differences in two age estimates are on the yaxis and means of the two age estimates are on the xaxis. The plot may be augmented with several horizontal lines at the following locations Figure 1:
 Zero,
 Mean difference in ages (heavy red dashed line),
 Upper and lower 95% confidence limits for the mean difference in ages (dark red dashed lines),
 Upper and lower 95% “agreement limits” (usually 1.96 times the standard deviation for the difference in ages above and below the mean difference in ages; heavy dashed blue lines), and
 Upper and lower 95% confidence limits for the upper and lower “agreement limits” (dashed dark blue lines).
Figure 1: BlandAltman plot for comparing scale to otolith age estimates of Lake Champlain Lake Whitefish. Thiw was constructed with BlandAltmanLeh
.
As a general rule, a 95% confidence interval for the mean difference that does not contain zero suggests a difference (or a bias) between the two age estimates. For example, a bias is evident in Figure 1. In addition, one would expect 95% of the points to fall within the “agreement limits.” Points that fall outside this range may be considered further as possible outliers. Log differences have been used if the differences are not normally distributed and the percentage difference (where the difference is divided by the mean age) have also been used (Giavarina 2015).
The BlandAltman plot in Figure 1 was created with bland.altman.plot()
from the BlandAltmanLeh
package (Lehnert 2015b). Other R functions exist for creating BlandAltman plots (or the equivalent “Tukey’s Mean Difference Plot”). However, this is a simple plot that can be easily constructed from “scratch” as shown next. I then provide a mild critique of the BlandAltman plot for use in age comparisons and offer an alternative (that is not an age bias plot).
Constructing a BlandAltman Plot
In this example, a BlandAltman plot is created to compare consensus (between two readers) scale (scaleC
) and otolith (otolithC
) age estimates for Lake Champlain Lake Whitefish.
The mean and differences between the two age estimates are easily computed and added to the original data.frame. One way (of many ways) to do that is with mutate()
from dplyr
(as shown below).
A scatterplot is constructed with plot()
with a formula of the form y~x
. In this case, the points are white (col="white"
) so that the points will not be evident.
In this way, items can be added “behind” the points. For example, abline()
is used with h=0
to add a horizontal reference line at zero.
In addition, horizontal lines at the mean and approximate lower and upper 95% confidence limits for the differences may be added.
Agreement lines (without confidence limits) may also be added. [These could, of course, be eliminated to address the second issue below.]
The data points are then added to this base plot with points()
. “Solid dots” (pch=19
) that are a transparent black such that when five points are overplotted the “point” will appear solid black (col2rgbt("black",1/5)
) are used to address the first issue below.
Figure 2: BlandAltman plot for comparing scale to otolith age estimates of Lake Champlain Lake Whitefish. Thiw was constructed in parts.
My Critique of the BlandAltman Plot for Age Comparisons
I like that BlandAltman plots (relative to age bias plots) do not require that one of the variables be designated as the “reference” group. This may be more useful when comparing age estimates where one set of estimates is not clearly a priori considered to be more accurate (e.g., comparing readers with similar levels of experience).
However, I don’t like the following characteristics of (default) BlandAltman plots.
 There may be considerable overlap of the plotted points because of the discrete nature of most age data. Various authors have dealt with this by adding a “petal” to the point for each overplotted point to make a socalled “sunflower plot” (Lehnert, 2015a) or using bubbles that are proportional to the number of overplotted points (McBride 2015). However, I find the “sunflowers” and “bubbles” to be distracting. I addressed this issue with transparent points above.
 The “agreement lines” are not particularly useful. They may be useful for identifying outliers, but an egregious outlier will likely stand out without these lines.
 The single confidence interval for the mean difference suggests that any bias between the sets of estimates is “constant” across the range of mean ages. This can be relaxed somewhat if the percentage difference is plotted on the yaxis. However, neither of these allows for more complex situations where the bias is nonlinear with age. For example, a common situation of little difference between the estimates at young ages, but increasing differences with increasing ages (e.g., Figure 1) is not wellrepresented by this single confidence interval.
A Modified BlandAltman Plot for Age Comparisons
The third issue above has been addressed with some BlandAltman plots by fitting a linear regression that describes the difference in age estimates as a function of mean age (Giarvina 2015). However, this only allows for a linear relationship, which may not represent or reveal more interesting nonlinear relationships. A generalized additive model (GAM) could be used to estimate a “smoothed” potentially nonlinear relationship between the differences in ages and the means of the ages.
A GAM may be fit in R with gam()
from the mgcv
package (Wood 2006). A thinplate regression spline (Wood 2003) is used as the smoother by default when s()
is used on the righthandside of the formula in gam()
. The degree of smoothing is controlled by k=
in s()
. I have found (with minimal experience) that k=5
may be adequate for most age comparison situations (note that smaller values provide more smoothing, larger values provide less smoothing).
Summary of the model fit is seen by submitting the gam
object to summary()
. In this example, the approximate pvalue for the smoother term suggests that there is a relationship between the differences and means.
The smoother “line” with 95% confidence limits is added to the plot by first using the smoother to predict the differences in ages (along with the SE of those predictions) across the entire range of mean ages. Approximate confidence limits are then derived (using normal theory) from the predicted values and their SEs.
The smoother “line” is then added to the plot with lines()
.
The 95% intervals for the smoother line are added as lines with lines()
Alternatively, the 95% intervals for the smoother line may be added as a shaded region with polygon()
. Note that rev()
reverses the order of the elements in a vector and is a “trick” used to properly construct the boundaries of the polygon for plotting.
Putting this all together results in the plot shown in Figure 3. These results suggest that there is little difference between scale and otolith age estimates up to a mean age estimate of approximately five, after which age estimates from scales are less than age estimates from otoliths, with the difference between the two generally increasing with increasing mean age.
Figure 3: Scatterplot of the difference in scale and otolith age estimates versus the mean of the scale and otolith age estimates of Lake Champlain Lake Whitefish with a thinplate regression spline smoother and 95% confidence band shown.
A similar plot is shown for the comparison of otolith age estimates between two readers in Figure 4. Also note (see below) that the smoother term is not significant for the betweenreader comparison of otolith age estimates, which suggests no relationship between the differences in ages and the mean age. In addition, the intercept term is not significantly different from zero, which indicates that there is not a constant bias between the two readers.
Figure 4: Scatterplot of the difference between otolith age estimates for two readers and the mean otolith age estimates of Lake Champlain Lake Whitefish with a thinplate regression spline smoother and 95% confidence band shown.
Adding the GAM to the Age Bias Plot
In situations where one of the age estimates could be considered a priori to be more accurate, it seems to make more sense to put that age estimate on the xaxis rather than the mean between it and the less accurate estimate. In other words, return to the concept, though not the exact structure, of the age bias plot. The GAM smoother can also be added to this plot (Figures 5 and 6).
Figure 5: Scatterplot of the difference in scale and otolith age estimates versus otolith age estimates of Lake Champlain Lake Whitefish with a thinplate regression spline smoother and 95% confidence band shown.
Figure 6: Scatterplot of the difference otolith age estimates for two readers and the otolith age estimates for the first reader of Lake Champlain Lake Whitefish with a thinplate regression spline smoother and 95% confidence band shown.
Things To Do
If this all seems plausible then consider:
 Add histogram to rightside (show distribution of differences).
 Perhaps run McBride’s simulations through this.
References

Bland, J.M., and D.G. Altman. 1986. Statistical methods for assessing agreement between two methods of clinical measurement. Lancet i:307317.

Giarvina, D. 2015. Understanding Bland Altman analysis. Biochemica Medica 24:141151.

Lehnert, B. 2015a. BlandAltmanLeh Intro. Accessed on 18Apr17.

Lehnert, B. 2015b. BlandAltmanLeh: Plots (Slightly Extended) BlandAltman Plots. R package version 0.3.1.

McBride, R.S. 2015. Diagnois of paired age agreement: a simulation of accuracy and precision effects. ICES Journal of Marine Science 72:21492167.

Wood, S.N. 2003. Thinplate regression splines. Journal of the Royal Statistical Society (B)
65(1):95114. 
Wood, S.N. 2006. Generalized Additive Models: An Introduction with R. Chapman and Hall/CRC.

Ogle, D.H. 2015. Introductory Fisheries Analyses with R book. CRC Press.
Rbloggers.com offers daily email updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...