This is a rewriting and simplification of gauss.quad
in terms of probability distributions.
The probability interpretation is explained by Smyth (1998).
For details on the underlying quadrature rules, see gauss.quad
.
The expected value of f(X)
is approximated by sum(w*f(x))
where x
is the vector of nodes and w
is the vector of weights. The approximation is exact if f(x)
is a polynomial of order no more than 2n-1
.
The possible choices for the distribution of X
are as follows:
Uniform on (l,u)
.
Normal with mean mu
and standard deviation sigma
.
Beta with density x^(alpha-1)*(1-x)^(beta-1)/B(alpha,beta)
on (0,1)
.
Gamma with density x^(alpha-1)*exp(-x/beta)/beta^alpha/gamma(alpha)
.