*! version 1.0 23 Apr 2024

Title

bap -- A Bland-Altman plot generator

Syntax

bap
varlist(min=2
max=2
numeric)
[if]
[,
options]

Optional
nograph Do not generate a Bland-Altman plot

formatgraph(string) Stata number format to use in graph (default is %4.1f)

Text(string) String value for the first legend (default is
variable 1 label/variable 1 name vs variable 1 label/variable 1 name)

scatterstyle(string) A twoway scatter marker specification
(default is jitter(3))

meanlinestyle(string) A twoway line specification for the mean
line (default is lcolor(gs8) lpattern(solid))

loalinestyle(string) A twoway line specification for the LOA
lines (default is lcolor(gs8) lpattern(dash))

Roweq(string) A string for setting roweq in the returned r(bap)
matrix. It is useful when combining more Bland-Altman analyses into one

lowess Use a lowess curve instead of the mean of the differences

keepvariables keep the variables for the means and the differences

* Any twoway option

Description

The command bap is yet another Bland-Altman plot generator.

It is fairly simple and quite flexible to use.

There is an option for having a lowess curve to visualize a trend instead of
the mean line.

Further, the command bap returns a matrix containing key information on
the measurements:
The mean measurements with 95% CI, the bias with 95% CI, the SEM, and the LOA limits.

Examples

Get Bland-Altman dataset:

//www-users.york.ac.uk/~mb55/datasets/pefr.dct", clear"'

`". label variable wright1 "PEFR 1, Wright (l/min)"'

`". label variable wright2 "PEFR 2, Wright (l/min)"'

`". label variable mini1 "PEFR 1, mini Wright (l/min)"'

`". label variable mini2 "PEFR 2, mini Wright (l/min)"'

Making a Bland-Altman plot:

`". bap mini1 mini2"'

Making a Bland-Altman plot with different marker and line styles:

`". bap mini1 mini2, name(g1, replace) loa(lp(dot) lc(red) lw(thick)) m(lc(green)) s(mcolor(red))"'

Stored results

Macros

r(grphcmd) The graph command for the Bland-Altman plot

Matrices

r(bap) A matrix containing key information on the measurements:
The mean measurements with 95% CI, the bias with 95% CI, the SEM, and the LOA limits

References

1983 Altman - Measurement in Medicine, the Analysis of Method

1986 Bland - Statistical method for assessing agreement between two methods of clinical measurement

2009 Carstensen - Comparing methods of measurement; Extending the LoA by regression

2015 Giavarina - Understanding Bland Altman analysis

2016 Montenij - Methodology of method comparison studies evaluating the validity of cardiac output monitors; A stepwise approach and checklist

2017 Taffe - biasplot; A Package to Effective Plots to Assess Bias and Precision in Method Comparison Studies

2023 Chatfield - blandaltman; A command to create variants of Bland–Altman plots

Authors and support

Author:

Niels Henrik Bruun,

Aalborg University Hospital

Support:

niels.henrik.bruun@gmail.com