Source: https://www.stat.auckland.ac.nz/~fewster/325/notes/ch8.pdf