Geometric random variable

  • Definition: Let \(X\) be a geometric random variable, then:
    • \(p_X(k) = (1-p)^{k-1}p\), where \(p\) is a fixed value in \((0, 1)\) called the geometric parameter and \(k\) is a positive integer.
    • Notation: \(X \sim Geometric(p)\)
  • Theorem: Let \(X \sim Geometric(p)\), then:
    • \(\mathbb{E}[X] = 1/p\)
    • \(\mathbb{E}[X^2] = 2/p^2 - 1/p\)
    • \(Var[X] = \dfrac{1-p}{p^2}\)
n <- 20
states <- 1:n
p <- 0.4

plot(
  states, dgeom(states, p), type = 'h',
  ylim = c(0, 1), main = "Geom(p)",
  xlab = "States", ylab = "Probabilities"
)