author: Yamina Touhami
date: 25/10/2014
A Poisson distribution is the probability distribution that results from a Poisson experiment, which is a statistical experiment that has the following properties:
library(shiny)
library(ggplot2)
library(eeptools)
shinyUI(pageWithSidebar(
# Title
headerPanel("Visualizing the Poisson Distribution"),
sidebarPanel(
sliderInput("obs","Number of observations:",
min=0,max=1000,value=100),
sliderInput("lambda","vector of non-negative means:",
min=1,max=20,value=5)
),
# GGPLOT
mainPanel(
plotOutput("distPlot")
)
))
<!–html_preserve–>
library(shiny)
shinyServer(function(input,output){
output$distPlot<-reactivePlot(function(){
dist<-rpois(input$obs, input$lambda)
p<-qplot(dist,binwidth=0.02)+geom_vline
(xintercept=mean(dist))+theme_dpi()
p<-p+coord_cartesian(xlim=c(-5,30))
+geom_vline(xintercept=median(dist),
color=I("red"))
print(p)
})
})
Specifiy the following using slider bars & dropdown box:
This applet was made as a project for Coursera's class on Developing Data Products.
It was written in R and hosted by shiny apps at https://tensoriel.shinyapps.io/Newapp