Developing Data Products Final Project

Stacy Hoehn
March 5, 2020

Introduction

A Normal Distribution Calculator was created as a Shiny app for the final project in the Developing Data Products course. This app will compute the area under a normal curve between two specified values.

What the App Does

To use the app, the user simply specifies the mean and standard deviation of the normal distribution they wish to study, as well as the range of values they want to find the area between.

User Inputs

The app then returns a plot of this normal distribution, with the desired region shaded in blue. The area of this region is given under the plot.

Outputs

How the App Finds the Area

The pnorm(x,mu,sigma) command computes the area to the left of the value of x under a normal distribution with mean mu and standard deviation sigma. Thus to find the area between the specified lower bound and upper bound, we can simply use the pnorm command twice, as shown below.

mean <- 0
sd <- 1
lowerValue <- -1
upperValue <- 1
area <- pnorm(upperValue,mean,sd)-pnorm(lowerValue,mean,sd)
area
[1] 0.6826895

Reactivity in the App

Notice that the values on the slider, as well as the title, shaded region, axis labels, and caption all update dynamically as the user changes the mean, standard deviation, and range of values.

The interactive nature of this app makes it helpful for use in the classroom as students are learning about the normal distribution. No more drawing all of these pictures by hand!