DensityPlotPitch

Jinxi Li
Sep 1 2018

Brief Introduction

This App is created for enhancing users' understanding of some specific probability densities by showing their density curves. You can try the app here

Such three densities are included:

  • Normal Distribution
  • Uniform Distribution
  • Exponential Distribution

Normal Distribution

Normal Distribution, also known as Gaussian Distribution, is two-parameter determined - \( \mu \) and \( \sigma \). The shape of the bell curve will change. The density curve of a standard normal is as below, and users can change the mean and variance in the app and see the way how the bell curve changes.

library(ggplot2)
ggplot(mapping = aes(rep(-5:5))) + 
  stat_function(fun = dnorm, color = "lightblue", size = 2,  args = list(mean = 0, sd = 1)) + 
  labs(title = "Normal Distribution", x = "x")

plot of chunk normal

Uniform Distribution

Uniform Distribution is a distribution distributing uniformly on a interval, which means every point in that interval has the same probability to happen. It is boring to see the density curve because it is only a stright segment line.

Here I simulate two uniform variables to construct a scatterplot, you can see how the square is filled almost equally by dots. In the app, you can make any blocks to chack every part of the square is filled almost equally.

plot of chunk uniform

Exponential Distribution

Exponential Distribution is a one-parameter determined distribution, which is widely used to model waiting time. The parameter here, named rate is actually the mean and variance of the distribution. The density curve of a exponential with rate 1 is as below, and users can change the rate in the app and see the way how the curve changes.

library(ggplot2)
ggplot(mapping = aes(rep(0:5))) + 
              stat_function(fun = dexp, color = "lightblue", size = 2, args = list(rate = 1)) + 
              labs(title = "Exponential Distribution", x = "x")

plot of chunk exponential