First R Shiny app

Rejection region plots for hypothesis tests

R
shiny
teaching
statistics
Author

Mark Isken

Published

November 30, 2014

This is my first RStudio Shiny application. I wanted to learn Shiny, a way to make R based interactive web based apps, and at the same time produce something at least a little useful. While creating a solution guide for a hypothesis testing assignment I had assigned in my statistics class, I realized it was a pain to create little plots showing rejection regions for two sample tests on the mean (based either on Z or t distribution). Hmm, seemed like a good candidate for a Shiny app. The user can specify the distribution, the significance level, which tails to show, and (eventually) some style related things like colors. The resulting plot can be downloaded to a PNG file. I then inserted the file into my homework solution guide. While there isn't a whole lot of code needed for this app, there were numerous "gotchas" and much trial and error. I am super grateful to the folks at the Scenarios Network for Alaska & Arctic Planning who have created numerous Shiny applications and tutorials and have shared them via their blog. I learned much from their examples and "borrowed" many ideas from their series of introductory tutorials on plotting random variable distributions . Hopefully this is the first of many Shiny apps for me. This post is not a Shiny tutorial. If you have no experience with Shiny, start at http://shiny.rstudio.com/tutorial/.

I deployed the app on ShinyApps.io by RStudio, a site for hosting Shiny Apps (free and paid plans). You can check it out at http://hselab.shinyapps.io/critvalues.

You can get the source code at my github repo for R Shiny apps. The source code is pretty heavily commented and includes the various trials and tribulations I had in getting this to work.

Here's what the app looks like.

Screenshot from my Shiny app. Check out the real thing at http://hselab.shinyapps.io/critvalues

Citation

BibTeX citation:
@online{isken2014,
  author = {Mark Isken},
  title = {First {R} {Shiny} App},
  date = {2014-11-30},
  langid = {en}
}
For attribution, please cite this work as:
Mark Isken. 2014. “First R Shiny App.” November 30, 2014.