Today, I will begin a series of posts on numerical integration, which has a wide range of applications in many fields, including statistics. I will introduce trapezoidal integration by discussing its conceptual foundations, write my own R function to implement trapezoidal integration, and use it to check that the Beta(2, 5)probability density function actually integrates to 1 over its support set. Fully commented and readily usable R code will be provided at the end.
Given a probability density function (PDF) and its support set as vectors in an array programming language like R, how do you integrate the PDF over its support set to ensure that it equals to 1? Read the rest of this post to view my own R function to implement trapezoidal integration and learn how to use it to numerically approximate integrals.
View original post 684 more words