Package: pyCompare
pyCompareA Python module for generatingBland-Altmanplots to compare two sets of measurements.You can try out the code usingBinder.InstallationTo installviapip, run:pip install pyCompareInstallation with pip allows the usage of the uninstall command:pip uninstall pyCompareDocumentationUsageblandAltman(data1, data2,
            limitOfAgreement=1.96,
            confidenceInterval=95,
            confidenceIntervalMethod='approximate',
            detrend=None,
            percentage=False,
            **kwargs)Generate a Bland-Altman plot to compare two sets of measurements of the same value.Paired measurmentes from each set should be passed indata1anddata2with each containing a list of values from one of the methods.The range of the limits of agreement is 1.96 by default, and can be customised with thelimitOfAgreement=argument.By default confidance intervals are plotted over the 95% range, this can be customised to thex% range by passing the argumentconfidenceInterval=xor removed withconfidenceInterval=None.There are two options for plotting confidence intervals on the mean difference and limit of agreement:[default] 'approximate' uses the approximate method described by Bland & Altman'exact paired' uses the exact paired method described by CarkeetThe 'exact paired' method will give more accurate confidence intervals on the limits of agreement when the number of paired measurements is low (approx < 100), at the expense of a much slower plotting time.A multiplicative offset between the two measures can be modeled with thedetrend=argument, which supports the following options:[default]Nonedo not attempt to detrend data - plots the raw values'Linear' attempt to model and remove a multiplicative offset between each assay by linear regression'ODR' attempt to model and remove a multiplicative offset between each assay by orthogonal distance regression'ODR' is the recommended method if you do not useNone.If passed asTrue, thepercentage=argument plots the percentage difference between measures, instead of the units the methods were measured in.Plots are displayed using the current matplotlib backend by default, or may be saved with thesavePath=argument.When saving, png format graphics are saved by default:blandAltman(data1, data2,
            savePath='SavedFigure.png')The save format type can be chosen from those known bymatplotlibwith thefigureFormat=argument:blandAltman(data1, data2,
            savePath='SavedFigure.svg',
            figureFormat='svg)Full list of argumentsblandAltman(data1, data2)data1(list like) – List of values from the first methoddata2(list like) – List of paired values from the second methodlimitOfAgreement(float) – Multiple of the standard deviation to plot limit of agreement bounds at (defaults to 1.96)confidenceInterval(None* or *float) – If notNone, plot the specified percentage confidence interval on the mean and limits of agreementconfidenceIntervalMethod(str) – Method used to calculated confidence interval on the limits of agreementdetrend(None* or *str) – If notNoneattempt to detrend by the method specifiedpercentage(bool) – IfTrue, plot differences as percentages (instead of in the units the data sources are in)title(str) – Title text for the figureax(matplotlib.axes._subplots.AxesSubplot) – Matplotlib axis handle - if not None draw into this axis rather than creating a new figurefigureSize((float,float)) – Figure size as a tuple of (width, height) in inchesdpi(int) – Figure resolutionsavePath(str) – If notNone, save figure at this pathfigureFormat(str) – When saving figure use this formatmeanColour(str) – Colour to use for plotting the mean differenceloaColour(str) – Colour to use for plotting the limits of agreementpointColour(str) – Colour for plotting data pointsReferencesTo citepyCompare, use the Zendo DOI:10.5281/zenodo.1238915.Altman, D. G., and Bland, J. M. “Measurement in Medicine: The Analysis of Method Comparison Studies” Journal of the Royal Statistical Society. Series D (The Statistician), vol. 32, no. 3, 1983, pp. 307–317.JSTOR.Altman, D. G., and Bland, J. M. “Measuring agreement in method comparison studies” Statistical Methods in Medical Research, vol. 8, no. 2, 1999, pp. 135–160.DOI.Carkeet, A. "Exact Parametric Confidence Intervals for Bland-Altman Limits of Agreement" Optometry and Vision Science, vol. 92, no 3, 2015, pp. e71–e80DOI.