Gaussian Quadrature with Probability Distributions
Calculate nodes and weights for Gaussian quadrature in terms of probability distributions.
- number of nodes and weights
- distribution that Gaussian quadrature is based on, one of
- lower limit of uniform distribution
- upper limit of uniform distribution
- mean of normal distribution
- standard deviation of normal distribution
- positive shape parameter for gamma distribution or first shape parameter for beta distribution
- positive scale parameter for gamma distribution or second shape parameter for beta distribution
This is a rewriting and simplification of
gauss.quad in terms of probability distributions.
The expected value of
f(X) is approximated by
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
The possible choices for the distribution of
X are as follows:
Normal with mean
mu and standard deviation
Beta with density
Gamma with density
- A list containing the components
nodes vector of values at which to evaluate the function weights vector of weights to give the function values
Golub, G. H., and Welsch, J. H. (1969). Calculation of Gaussian
quadrature rules. Mathematics of Computation 23, 221-230.
Golub, G. H. (1973). Some modified matrix eigenvalue problems.
Siam Review 15, 318-334.
Smyth, G. K. (1998). Polynomial approximation. In: Encyclopedia of Biostatistics, P. Armitage and T. Colton (eds.), Wiley, London, pp. 3425-3429.
out <- gauss.quad.prob(10,"normal") sum(out$weights * out$nodes^4) # the 4th moment of the standard normal is 3 out <- gauss.quad.prob(32,"gamma",alpha=5) sum(out$weights * log(out$nodes)) # the expected value of log(X) where X is gamma is digamma(alpha)