Poisson Params
The Poisson distribution is a distribution for counts of events.
Assume the following things:
Events happen at a rate \(\lambda\) per unit interval on average.
Count the number of events in a time interval of \(T\) units.
Assume that the events happen at a uniform rate throughout the interval (e.g., we don’t get more customers in the morning than the afternoon).
The the number of events, \(X\), follows a Poisson distribution.
\[P(X=x) = \frac{(\lambda T)^x}{x!}e^{-\lambda T}\] The distribution looks like:
#| standalone: true
#| viewerHeight: 600
library(shiny)
library(ggplot2)
ui <- fluidPage(
inputPanel(
sliderInput("mean", label = "Expected number of events per unit time",
min=0, max=100, value=3.5, step=1),
sliderInput("t", label = "Time Interval:",
min = 0, max = 365, value = 1, step = 1)
),
mainPanel(
plotOutput("poissoncurve")))
server <- function (input,output) {
output$poissoncurve <- renderPlot({
mu <- as.numeric(input$mean) * as.numeric(input$t)
n <- mu + 3* sqrt(mu)
dat <- data.frame(x=0:n,y=dpois(0:n,mu))
ggplot(dat,aes(x,y)) +geom_col()
})
}
shinyApp(ui=ui,server=server)
The mean and variance of the Poisson distribution are \(\lambda T\) and \(\lambda T\).
As the variance grows pretty quickly, statisticians will often take the square root of count data (especially if there is heteroscedasticity) to stabilize the variance.