Source: https://www.jstatsoft.org/article/view/v033i04/v33i04.pdf