<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/shinyfit-advanced-regression-modelling-in-a-shiny-app/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="http://www.datasurg.net/2018/12/07/shinyfit-advanced-regression-modelling-in-a-shiny-app/"> R – DataSurg</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>Many of our projects involve getting doctors, nurses, and medical students to collect data on the patients they are looking after. We want to involve many of them in data analysis, without the requirement for coding experience or access to statistical software. To achieve this we have built Shinyfit, a shiny app for linear, logistic, and Cox PH regression. </p>
<ul>
<li>Aim: allow access to model fitting without requirement for statistical software or coding experience.</li>
<li>Audience: Those sharing datasets in context of collaborative research or teaching.</li>
<li>Hosting requirements: Basic R coding skills including <a rel="nofollow" href="https://www.tidyverse.org/" target="_blank"><code>tidyverse</code></a> to prepare dataset (5-10 minutes).</li>
<li>Deployment: Any shiny platform, <a rel="nofollow" href="http://www.shinyapps.io/" target="_blank">shinyapps.io</a>, <a rel="nofollow" href="https://www.rstudio.com/products/shiny/shiny-server/" target="_blank">ShinyServer</a>, <a rel="nofollow" href="https://www.rstudio.com/products/connect/" target="_blank">RStudio Connect</a> etc. </li>
</ul>
<p><code>shinyfit</code> uses our <a rel="nofollow" href="http://finalfit.org/" target="_blank"><code>finalfit</code></a> package.</p>
<h2>Features</h2>
<ul>
<li>Univariable, multivariable and mixed effects linear, logistic, and Cox Proportional Hazards regression via a web browser.</li>
<li>Intuitive model building with option to include a reduced model and common metrics.</li>
<li>Coefficient, odds ratio, hazard ratio plots.</li>
<li>Cross tabulation across multiple variables with statistical comparisons.</li>
<li>Subset data by any included factor.</li>
<li>Dataset inspection functions.</li>
<li>Export tables to Word for publication or as a CSV for further analysis/plotting.</li>
<li>Easy to deploy with your own data.</li>
</ul>
<h2>Examples</h2>
<p><a rel="nofollow" href="https://argoshare.is.ed.ac.uk/shinyfit_colon/" target="_blank">argoshare.is.ed.ac.uk/shinyfit_colon</a><br><a rel="nofollow" href="https://argoshare.is.ed.ac.uk/shinyfit_melanoma" target="_blank">argoshare.is.ed.ac.uk/shinyfit_melanoma</a></p>
<h2>Code</h2>
<p><a rel="nofollow" href="http://github.com/ewenharrison/shinyfit" target="_blank">github.com/ewenharrison/shinyfit</a></p>
<h2>Screenshots</h2>
<figure class="wp-block-image"><img data-orig-file="http://www.datasurg.net/wp-content/uploads/2018/12/shinyfit_table.png" data-orig-size="2416,738" data-medium-file="http://www.datasurg.net/wp-content/uploads/2018/12/shinyfit_table-300x92.png" data-attachment-id="1114" data-image-meta="{" data-image-description="" src="https://i0.wp.com/www.datasurg.net/wp-content/uploads/2018/12/shinyfit_table-1024x313.png?resize=456%2C139" data-permalink="http://www.datasurg.net/2018/12/07/shinyfit-advanced-regression-modelling-in-a-shiny-app/shinyfit_table/" data-large-file="https://i0.wp.com/www.datasurg.net/wp-content/uploads/2018/12/shinyfit_table-1024x313.png?resize=456%2C139" alt="" data-image-title="shinyfit_table" sizes="(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px" data-comments-opened="1" class="wp-image-1114" data-recalc-dims="1"><figcaption>Linear, logistic or CPH regression tables<br></figcaption></figure>
<figure class="wp-block-image"><img data-orig-file="http://www.datasurg.net/wp-content/uploads/2018/12/shinyfit_plot.png" data-orig-size="2179,1402" data-medium-file="http://www.datasurg.net/wp-content/uploads/2018/12/shinyfit_plot-300x193.png" data-attachment-id="1115" data-image-meta="{" data-image-description="" src="https://i1.wp.com/www.datasurg.net/wp-content/uploads/2018/12/shinyfit_plot-1024x659.png?resize=456%2C293" data-permalink="http://www.datasurg.net/2018/12/07/shinyfit-advanced-regression-modelling-in-a-shiny-app/shinyfit_plot/" data-large-file="https://i1.wp.com/www.datasurg.net/wp-content/uploads/2018/12/shinyfit_plot-1024x659.png?resize=456%2C293" alt="" data-image-title="shinyfit_plot" sizes="(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px" data-comments-opened="1" class="wp-image-1115" data-recalc-dims="1"><figcaption>Coefficient, odds ratio or hazard ratio plots</figcaption></figure>
<figure class="wp-block-image"><img data-orig-file="http://www.datasurg.net/wp-content/uploads/2018/12/shinyfit_crosstabs.png" data-orig-size="2436,749" data-medium-file="http://www.datasurg.net/wp-content/uploads/2018/12/shinyfit_crosstabs-300x92.png" data-attachment-id="1116" data-image-meta="{" data-image-description="" src="https://i0.wp.com/www.datasurg.net/wp-content/uploads/2018/12/shinyfit_crosstabs-1024x315.png?resize=456%2C140" data-permalink="http://www.datasurg.net/2018/12/07/shinyfit-advanced-regression-modelling-in-a-shiny-app/shinyfit_crosstabs/" data-large-file="https://i0.wp.com/www.datasurg.net/wp-content/uploads/2018/12/shinyfit_crosstabs-1024x315.png?resize=456%2C140" alt="" data-image-title="shinyfit_crosstabs" sizes="(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px" data-comments-opened="1" class="wp-image-1116" data-recalc-dims="1"><figcaption>Crosstabs</figcaption></figure>
<figure class="wp-block-image"><img data-orig-file="http://www.datasurg.net/wp-content/uploads/2018/12/shinyfit_glimpse.png" data-orig-size="2414,821" data-medium-file="http://www.datasurg.net/wp-content/uploads/2018/12/shinyfit_glimpse-300x102.png" data-attachment-id="1117" data-image-meta="{" data-image-description="" src="https://i0.wp.com/www.datasurg.net/wp-content/uploads/2018/12/shinyfit_glimpse-1024x348.png?resize=456%2C155" data-permalink="http://www.datasurg.net/2018/12/07/shinyfit-advanced-regression-modelling-in-a-shiny-app/shinyfit_glimpse/" data-large-file="https://i0.wp.com/www.datasurg.net/wp-content/uploads/2018/12/shinyfit_glimpse-1024x348.png?resize=456%2C155" alt="" data-image-title="shinyfit_glimpse" sizes="(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px" data-comments-opened="1" class="wp-image-1117" data-recalc-dims="1"><figcaption>Inspect dataset with <code>ff_glimpse</code></figcaption></figure>
<h2>Use your data</h2>
<p>To use your own data, clone or download app from <a rel="nofollow" href="https://github.com/ewenharrison/shinyfit" target="_blank">github</a>.</p>
<ul>
<li></li>
<li>Edit <code>0_prep.R</code> to create a shinyfit_data object. </li>
<li>Test the app, usually within RStudio.</li>
<li>Deploy to your shiny hosting platform of choice. </li>
<li>Ensure you have permission to share the data</li>
</ul>
<p>Editing <code>0_prep.R</code> is straightforward and takes about 5 mins. The main purpose is to create human-readable menu items and allows sorting of variables into any categories, such as <code>outcome</code> and <code>explanatory</code>. </p>
<p>Errors in <code>shinyfit</code> are usually related to the underlying dataset, e.g.</p>
<ul>
<li>Variables not appropriately specified as numerics or factors. </li>
<li>A particular factor level is empty, thus regression function (<code>lm</code>, <code>glm</code>, <code>coxph</code> etc.) gives error.</li>
<li>A variable with >2 factor levels is used as an outcome/dependent. This is not supported.</li>
<li>Use <code>Glimpse</code> tabs to check data when any error occurs.</li>
</ul>
<p>It is fully mobile compliant, including datatables.</p>
<p>There will be bugs. Please report <a rel="nofollow" href="https://github.com/ewenharrison/shinyfit/issues" target="_blank">here</a>. </p>
	<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="http://www.datasurg.net/2018/12/07/shinyfit-advanced-regression-modelling-in-a-shiny-app/"> R – DataSurg</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 rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...
<img alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/rsX_hhy0p6E" height="1"></a></div>