Distribution Explorer

Sergey Chernov
12/02/2015

Course project for Developing Data Products by Brian Caffo, PhD, Jeff Leek, PhD, Roger D. Peng, PhD

About product "Distribution explorer"

This program was made for Coursera course “Developing Data Products” This program can be used for simulation and associated explanatory text the properties of the Exponential and Poison distribution of the mean. We made:

  1. Show the sample mean and compare it to the theoretical mean of the distribution.
  2. Show how variable the sample is (via variance) and compare it to the theoretical variance of the distribution.

All work have been made for Shyny framework.

Working with program

For initialize simulation we seted :

lambda<-0.2
n<-1000
len<-10

You can choose lambda with using Shyny component Input Slider in interval from 0.1 to 5 with step 0.1

You can set number of experiment n with using Shyny component Numeric input.

You can set length of set len with using Shyny component Numeric input.

You have to choose type of distribution (Exponential or Poison) with using Shyny component Select Input.

Example (simulation)

This program make simulation and calculate means depends on type of distribution. For example, if you choose Poison distribution.

For initialize simulation we seted :

experiment<-function(lambda,n,len,distr) {
    matrixExp<-matrix(rpois(n*len,lambda),n,len)
    means<-apply(matrixExp,1,mean)
    means
}
m<-experiment(lambda,n,len,"Poison")
head(m)
[1] 0.1 0.2 0.2 0.2 0.5 0.1

Example (plot)

After that program calculate theoretical mean, sample mean, theoretical variance, sample variance and print the results.

In the end program plot the distribution of means. plot of chunk unnamed-chunk-3