<p><div><div><div><div data-width="100" data-show-faces="false" data-send="true" data-layout="button_count" data-height="21" data-href="https://www.r-bloggers.com/a-shiny-app-for-passing-bablok-and-deming-regression/"></div></div><div><a data-url="https://www.r-bloggers.com/a-shiny-app-for-passing-bablok-and-deming-regression/" data-counturl="https://www.r-bloggers.com/a-shiny-app-for-passing-bablok-and-deming-regression/" data-count="horizontal" data-text="A Shiny App for Passing Bablok and Deming Regression" class="twitter-share-button" data-via="rbloggers" href="https://twitter.com/share"></a></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="http://labrtorian.com/2016/08/15/a-shiny-app-for-passing-bablok-and-deming-regression/"> The Lab-R-torian</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<h2>Background</h2>
<p>Back in 2011 I was not aware of any tool in R for Passing Bablok (PB) regression, a form of robust regression described in a series of three papers in Clinical Chemistry and Laboratory Medicine (then J Clin Chem and Biochem) available <a target="_blank" href="http://www.degruyter.com/view/j/cclm.1983.21.issue-11/cclm.1983.21.11.709/cclm.1983.21.11.709.xml">here</a>, <a target="_blank" href="http://www.degruyter.com/view/j/cclm.1984.22.issue-6/cclm.1984.22.6.431/cclm.1984.22.6.431.xml">here</a> and <a target="_blank" href="http://www.degruyter.com/view/j/cclm.1988.26.issue-11/cclm.1988.26.11.783/cclm.1988.26.11.783.xml">here</a>. For reasons that are not entirely clear to me, this regression methodology is favoured by clinical chemists but seems largely ignored by other disciplines. However since reviewers clinical chemistry journals will demand the use of PB regression, it seemed expeditious to me to code it in R. This is what spawned a <a target="_blank" href="http://cprsoftware.blogspot.ca/">small project</a> for a piece of software to do PB (and Deming and ordinary least squares) regression using a self-contained executable that could be downloaded, unzipped on a Windows Desktop and just ran. You can <a target="_blank" href="https://sourceforge.net/projects/cprchempath/">download here</a> and instructions for installation and use are <a target="_blank" href="https://www.youtube.com/watch?v=NfnF9ScrINQ&feature=youtu.be">here</a> and <a target="_blank" href="https://www.youtube.com/watch?v=rSA7li5Ejgo&feature=youtu.be">here</a> respectively. The calculations are all done in R, the GUI is built with Python and Py-Qt4 and the executable with <a target="_blank" href="http://cx-freeze.sourceforge.net/">cx_freeze</a>. I made it run without an installer because hospital IT often refuse to install software that has not been officially vetted and purchased. The tool was a lot more popular than I anticipated now having about 2000 downloads. In any case, maintenance, upgrades, bug fixing and dealing with operating system updates that break things (like OSX El Capitan's security policies) are no-fun so a Shiny based solution to the same problem makes a lot of sense. </p>
<h2>Update</h2>
<p>Since 2011, statisticians at Roche Diagnostics programmed the <a target="_blank" href="https://cran.r-project.org/web/packages/mcr/index.html">mcr package</a> for PB and Deming regression. Additionally, there is also the <a target="_blank" href="https://cran.r-project.org/web/packages/MethComp/index.html">MethComp package</a> and the <a target="_blank" href="https://cran.r-project.org/web/packages/deming/index.html">deming package</a> from the Mayo Clinic which both offer PB regression. </p>
<h2>Shiny App</h2>
<p>Enter <a target="_blank" href="https://www.linkedin.com/in/burak-bahar-59155586">Burak Bahar</a>, a like-minded Clinical Pathologist who is currently doing a fellowship at Yale. He liked my <a target="_blank" href="http://www.sciencedirect.com/science/article/pii/S0009912014007425">cp-R program</a> but he saw the need for a web-based equivalent. </p>
<p>Burak and his wife Ayse, also a physician, have coded a Shiny App for doing Deming, PB and least squares regression in R which is capable of producing publication quality figures and provides all the regression statistics you would need for method-validation or publication. It can also produce a regression report in PDF, Word or HTML. The dynamic duo of the Bahar-MDs deserve all credit here as my only contribution related to suggestions related to usability. This project was presented at the 2016 American Association of Clinical Chemistry meeting in Philadelphia. </p>
<p>The app URL is <a target="_blank" href="https://bahar.shinyapps.io/method_compare">bahar.shinyapps.io/method_compare</a>. Go to the data tab on the left and then cut and paste your data from an spreadsheet program. Shortcuts CTRL-C (copy) and CTRL-V (paste) work natively in the table. The table is pre-populated with some random data for demonstration purposes. Once your data is pasted in, click on the Plots tab and choose the Bland-Altman or Scatter Plot.</p>
<h2>Example</h2>
<p>Here is an image generated with the Bahar Shiny app using method comparison data obtained from <a target="_blank" href="http://www.providencelaboratory.com/">St. Paul's Hospital Laboratory</a> in migrating from Siemens Immulite 2000 XPi to Roche Cobas e601 for Calcitonin determination. Don't worry, we did more than 33 comparison–I am just showing the low end.</p>
<p><a target="_blank" href="http://i1.wp.com/labrtorian.com/wp-content/uploads/2016/08/regression.png"><img sizes="(max-width: 623px) 100vw, 623px" alt="regression" class="wp-image-388" src="http://i1.wp.com/labrtorian.com/wp-content/uploads/2016/08/regression.png?resize=604%2C388" data-recalc-dims="1"></a></p>
<p><a target="_blank" href="http://i2.wp.com/labrtorian.com/wp-content/uploads/2016/08/BA.png"><img sizes="(max-width: 604px) 100vw, 604px" alt="BA" class="wp-image-389" src="http://i2.wp.com/labrtorian.com/wp-content/uploads/2016/08/BA.png?resize=604%2C388" data-recalc-dims="1"></a></p>
<p>Try adjusting some of the plot parameters. The figures will update in real time. Thanks to Burak and Ayse Bahar for your work!</p>

<p><strong>(Dan's) Parting Thought</strong></p>
<p>There are straight lines that matter a lot more than regression.</p>
<p><em>I will make justice the measuring line and righteousness the plumb line</em><br>
(Isa 28:17)</p>
<p><div><div><div><div data-width="55" data-show-faces="false" data-send="true" data-layout="box_count" data-height="62" data-href="https://www.r-bloggers.com/a-shiny-app-for-passing-bablok-and-deming-regression/"></div></div><div><a data-url="https://www.r-bloggers.com/a-shiny-app-for-passing-bablok-and-deming-regression/" data-counturl="https://www.r-bloggers.com/a-shiny-app-for-passing-bablok-and-deming-regression/" data-count="vertical" data-text="A Shiny App for Passing Bablok and Deming Regression" class="twitter-share-button" data-via="rbloggers" href="https://twitter.com/share"></a></div><div></div></div><div></div></div>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="http://labrtorian.com/2016/08/15/a-shiny-app-for-passing-bablok-and-deming-regression/"> The Lab-R-torian</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a title="The R Project for Statistical Computing" rel="nofollow" href="https://www.r-project.org/">R</a> news and <a title="R tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=tutorial">tutorials</a> on topics such as: <a title="Data science" rel="nofollow" href="https://www.r-bloggers.com/?s=data%20science">Data science</a>, <a title="Big Data" rel="nofollow" href="https://www.r-bloggers.com/?s=Big%20Data">Big Data, <a title="R jobs" rel="nofollow" href="https://www.r-users.com/">R jobs</a>, visualization (<a title="ggplot and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=ggplot2">ggplot2</a>, <a title="Boxplots using lattice and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=boxplot">Boxplots</a>, <a title="Maps and gis" rel="nofollow" href="https://www.r-bloggers.com/?s=map">maps</a>, <a title="Animation in R" rel="nofollow" href="https://www.r-bloggers.com/?s=animation">animation</a>), programming (<a title="RStudio IDE for R" rel="nofollow" href="https://www.r-bloggers.com/?s=RStudio">RStudio</a>, <a title="Sweave and literate programming" rel="nofollow" href="https://www.r-bloggers.com/?s=sweave">Sweave</a>, <a title="LaTeX in R" rel="nofollow" href="https://www.r-bloggers.com/?s=LaTeX">LaTeX</a>, <a title="SQL and databases" rel="nofollow" href="https://www.r-bloggers.com/?s=SQL">SQL</a>, <a title="Eclipse IDE for R" rel="nofollow" href="https://www.r-bloggers.com/?s=eclipse">Eclipse</a>, <a title="git and github, Version Control System" rel="nofollow" href="https://www.r-bloggers.com/?s=git">git</a>, <a title="Large data in R using Hadoop" rel="nofollow" href="https://www.r-bloggers.com/?s=hadoop">hadoop</a>, <a title="Web Scraping of google, facebook, yahoo, twitter and more using R" rel="nofollow" href="https://www.r-bloggers.com/?s=Web+Scraping">Web Scraping</a>) statistics (<a title="Regressions and ANOVA analysis tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=regression">regression</a>, <a title="principal component analysis tutorial" rel="nofollow" href="https://www.r-bloggers.com/?s=PCA">PCA</a>, <a title="Time series" rel="nofollow" href="https://www.r-bloggers.com/?s=time+series">time series</a>, <a title="finance trading" rel="nofollow" href="https://www.r-bloggers.com/?s=trading">trading</a>) and more...
<img height="1" alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/ltVjk5tbea8"></a></div>