Source: https://www.jstatsoft.org/article/view/v029i05/v29i05.pdf