Loading [MathJax]/jax/output/CommonHTML/jax.js

Monday, 13 January 2020

Geometric Distribution

I've discovered the geometric distribution, it looks very handy.

E(X)=1p
V(X)=1pp2
P(Y=y)=(1p)y1p

If I have a cheap laptop with an in built failure rate of 1% percent per month (per factory design),  I can find the probability of it failing in exactly 2 years time. Here, p=.01, and y=24

Therefore,
P(Y=24)=(1(.01))(24)1(.01)=0.008

If I want to know the chances of it failing before and up until that point, then I need the cumulative sum of P(Y=y) = 1,2,3,4,..,24
A shortcut to get this value is

P(Y<=y)=1(1p)y
P(Y<=24)=1(1.01)24=0.214

In R, I can plot this as follows

library(dplyr)
library(ggplot2)

dfGeom <- data.frame(x = 1:24, y = pgeom(1:24-1,.01))

ggplot(data=dfGeom, aes(x = x, y = y)) + 
  geom_bar(stat = "identity", position = "dodge") +
  geom_text(aes(y = y+.02, label = round(y,2), 
                x = as.numeric(x))) 
 

Meaning, chances of failure approaching year 2 and beyond is ~.2


No comments:

Post a Comment