Bland-Altman analysis function for R. Package created as existing
functions don't suit my needs, and don't generate 95% confidence intervals
for bias and limits of agreement. This base function calculates the basic
statistics, and generates return values which can be used in the related
blandr.display and bland.altamn.plot functions. However
the return results can be used to generate a custom chart if desired.
blandr.statistics(method1, method2, sig.level = 0.95, LoA.mode = 1)A list of numbers.
A list of numbers.
(Optional) Two-tailed significance level. Expressed from 0 to 1. Defaults to 0.95.
(Optional) Switch to change how accurately the limits of agreement (LoA) are calculated from the bias and its standard deviation. The default is LoA.mode=1 which calculates LoA with the more accurate 1.96x multiplier. LoA.mode=2 uses the 2x multiplier which was used in the original papers. This should really be kept at default, except to double check calculations in older papers.
means List of arithmetic mean of the two methods
differences List of differences of the two methods
method1 Returns the 'method1' list in the data frame if further evaluation is needed
method2 Returns the 'method2' list in the data frame if further evaluation is needed
sig.level Significance level supplied to the function
sig.level.convert.to.z Significance level convert to Z value
bias Bias of the two methods
biasUpperCI Upper confidence interval of the bias (based on significance level)
biasLowerCI Lower confidence interval of the bias (based on significance level)
biasStdDev
biasSEM Standard error for the bias
LOA_SEM Standard error for the limits of agreement
upperLOA Upper limit of agreement
upperLOA_upperCI Upper confidence interval of the upper limit of agreement
upperLOA_lowerCI Lower confidence interval of the upper limit of agreement
lowerLOA Lower limit of agreement
lowerLOA_upperCI Upper confidence interval of the lower limit of agreement
lowerLOA_lowerCI Lower confidence interval of the lower limit of agreement
proportion Differences/means*100
no.of.observations Number of observations
regression.equation A regression equation to help determine if there is any proportional bias
regression.fixed.slope The slope value of the regression equation
regression.fixed.intercept The intercept value of the regression equation
Based on: (1) Bland, J. M., & Altman, D. (1986). Statistical methods for assessing agreement between two methods of clinical measurement. The Lancet, 327(8476), 307-310. http://dx.doi.org/10.1016/S0140-6736(86)90837-8
Confidence interval work based on follow-up paper: (2) Altman, D. G., & Bland, J. M. (2002). Commentary on quantifying agreement between two methods of measurement. Clinical chemistry, 48(5), 801-802. http://www.clinchem.org/content/48/5/801.full.pdf
# NOT RUN {
# Generates two random measurements
measurement1 <- rnorm(100)
measurement2 <- rnorm(100)
# Generates Bland-Altman statistics data of the two measurements
blandr.statistics( measurement1 , measurement2 )
# }
Run the code above in your browser using DataLab