The Bernoulli distribution


iid Bernoulli trials


Plotting all possible likelihoods for a small n

n <- 5
pvals <- seq(0, 1, length = 1000)
plot(c(0, 1), c(0, 1.2), type = "n", frame = FALSE, xlab = "p", ylab = "likelihood")
text((0 : n) /n, 1.1, as.character(0 : n))
sapply(0 : n, function(x) {
  phat <- x / n
  if (x == 0) lines(pvals,  ( (1 - pvals) / (1 - phat) )^(n-x), lwd = 3)
  else if (x == n) lines(pvals, (pvals / phat) ^ x, lwd = 3)
  else lines(pvals, (pvals / phat ) ^ x * ( (1 - pvals) / (1 - phat) ) ^ (n-x), lwd = 3) 
  }
)
title(paste("Likelihoods for n = ", n))

plot of chunk unnamed-chunk-1

Binomial trials


Choose

\[ \left( \begin{array}{c} n \\ 0 \end{array} \right) = \left( \begin{array}{c} n \\ n \end{array} \right) = 1 \]


Example justification of the binomial likelihood


Example

choose(8, 7) * .5 ^ 8 + choose(8, 8) * .5 ^ 8 
[1] 0.03516
pbinom(6, size = 8, prob = .5, lower.tail = FALSE)
[1] 0.03516

plot(pvals, dbinom(7, 8, pvals) / dbinom(7, 8, 7/8) , 
     lwd = 3, frame = FALSE, type = "l", xlab = "p", ylab = "likelihood")
plot of chunk unnamed-chunk-3

The normal distribution


zvals <- seq(-3, 3, length = 1000)
plot(zvals, dnorm(zvals), 
     type = "l", lwd = 3, frame = FALSE, xlab = "z", ylab = "Density")
sapply(-3 : 3, function(k) abline(v = k))
plot of chunk unnamed-chunk-4
[[1]]
NULL

[[2]]
NULL

[[3]]
NULL

[[4]]
NULL

[[5]]
NULL

[[6]]
NULL

[[7]]
NULL

Facts about the normal density


More facts about the normal density

  1. Approximately \( 68\% \), \( 95\% \) and \( 99\% \) of the normal density lies within \( 1 \), \( 2 \) and \( 3 \) standard deviations from the mean, respectively
  2. \( -1.28 \), \( -1.645 \), \( -1.96 \) and \( -2.33 \) are the \( 10^{th} \), \( 5^{th} \), \( 2.5^{th} \) and \( 1^{st} \) percentiles of the standard normal distribution respectively
  3. By symmetry, \( 1.28 \), \( 1.645 \), \( 1.96 \) and \( 2.33 \) are the \( 90^{th} \), \( 95^{th} \), \( 97.5^{th} \) and \( 99^{th} \) percentiles of the standard normal distribution respectively

Question


Question


Other properties


Final thoughts on normal likelihoods


The Poisson distribution


Some uses for the Poisson distribution


Poisson derivation


Rates and Poisson random variables


Poisson approximation to the binomial


Example

The number of people that show up at a bus stop is Poisson with a mean of \( 2.5 \) per hour.

If watching the bus stop for 4 hours, what is the probability that \( 3 \) or fewer people show up for the whole time?

ppois(3, lambda = 2.5 * 4)
[1] 0.01034

Example, Poisson approximation to the binomial

We flip a coin with success probablity \( 0.01 \) five hundred times.

What's the probability of 2 or fewer successes?

pbinom(2, size = 500, prob = .01)
[1] 0.1234
ppois(2, lambda=500 * .01)
[1] 0.1247