Re: [R] Gaussian Adaptive Quadrature
"Ravi Varadhan" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > The terminology "Gaussian quadrature" is not restricted to Gauss-Hermite > quadrature (where exp(-x^2) is the weight function), but applies more > broadly to Gauss-Legendre, Gauss-Laguerre, etc., where the abscissa are > chosen from Legendre, Laguerre polynomials. Also, the functional form of the integrand and limits of integration vary a bit with the different Gaussian Quadrature methods. With Gaussian Quadrature the integral from a to b of f(x) dx is approximated as the sum of certain weights multiplied by the function evaluated at certain points related to the roots of the orthogonal polynomials. Gauss-Legendre is perhaps the most general, since it works well with most functions over a fixed, finite, interval, normally [-1,1]. The Legendre polynomials are orthogonal on the interval [-1,1] with respect to a weighting function w(x) = 1. A simple transformation allows the integration interval to be any finite interval, [a,b]. Gauss-Laguerre assumes a weighting function w(x) = exp(-x) in the integrand, and an interval of integration from 0 to infinity. Gauss-Hermite assumes a weighting function w(x) = exp(-x^2) in the integrand, and an interval of integration from -infinity to infinity. Applied Numerical Methods by Carnahan et al provides good details and examples (but in FORTRAN). One "adaptive" approach that can be used with Gaussian Quadrature is to use a different number of terms to evaluate the integral. To save computation time, you can use fewer terms. This file gives the weights needed for various N-point Gauss-Legendre quadrature approximation: http://www.math.ntnu.no/num/nnm/Program/Numlibc/gauss_co.c Some years ago on a project we found that 2-point Gaussian Quadrature gave us an answer that was "good enough," and obviously was quite fast with so few function evaluations. For your problem you might try 2-point to 15-point quadrature to see if you get the desired accuracy. I've always used pre-computed polynomial roots and weights for the various N-point formulas. I'm not sure how gauss.quad in library(statmod) gets these values. It wasn't obvious to me from a quick look at the source code. Another "adaptive" Gaussian approach might break a single integral up into a number of other integrals. One could even use different N-point formulas over different intervals, using lower N for "smoother" areas, and larger N if a function wasn't so well-behaved. Some other good links: Gauss-Legendre Quadrature http://math.fullerton.edu/mathews/n2003/gaussianquad/GaussianQuadBib/Links/GaussianQuadBib_lnk_1.html http://mathworld.wolfram.com/Legendre-GaussQuadrature.html efg Earl F. Glynn Scientific Programmer Stowers Institute for Medical Research __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Gaussian Adaptive Quadrature
Hi, The function "integrate" is based on QUADPACK Fortran package by Piessens. It does indeed perform adaptive Gauss-Kronrod quadrature, where Kronrod's method allows the re-use of abscissa from the previous iteration, thus enabling the estimation of the quadrature error and its control. In contrast, in the standard Gaussian quadrature methods this is not feasible. The terminology "Gaussian quadrature" is not restricted to Gauss-Hermite quadrature (where exp(-x^2) is the weight function), but applies more broadly to Gauss-Legendre, Gauss-Laguerre, etc., where the abscissa are chosen from Legendre, Laguerre polynomials. Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: [EMAIL PROTECTED] Webpage: http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Douglas Bates Sent: Wednesday, March 21, 2007 9:25 AM To: Doran, Harold Cc: Help mailing list - R Subject: Re: [R] Gaussian Adaptive Quadrature On 3/21/07, Doran, Harold <[EMAIL PROTECTED]> wrote: > The function integrate() uses AGQ. There are other functions for > gaussian quadrature in the statmod() package that I really like. I think that integrate does adaptive quadrature but not adaptive Gaussian quadrature (which probably should have been called adaptive Gauss-Hermite quadrature to be more specific). In the first case the "adaptive" refers to a choice of mesh size. In the second case one is integrating a function that is close to a multivariate Gaussian density by first finding the conditional optimum of the integrand and using a quadratic approximation to the log-integrand to establish the location of the Gauss-Hermite quadrature points. The Laplace approximation to the log-likelihood for a generalized linear mixed model is a 1-point adaptive Gauss-Hermite quadrature evaluation. > > > -Original Message- > > From: [EMAIL PROTECTED] > > [mailto:[EMAIL PROTECTED] On Behalf Of Caio > > Lucidius Naberezny Azevedo > > Sent: Wednesday, March 21, 2007 5:55 AM > > To: Help mailing list - R > > Subject: [R] Gaussian Adaptive Quadrature > > > > Hi all, > > > > Does anybody know any function that performs gaussian > > adapative quadrature integration of univariate functions? > > > > Thanks in advance, > > > > Regards, > > > > Caio > > > > __ > > > > > > [[alternative HTML version deleted]] > > > > __ > > R-help@stat.math.ethz.ch mailing list > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide > > http://www.R-project.org/posting-guide.html > > and provide commented, minimal, self-contained, reproducible code. > > > > __ > R-help@stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Gaussian Adaptive Quadrature
On 3/21/07, Doran, Harold <[EMAIL PROTECTED]> wrote: > The function integrate() uses AGQ. There are other functions for > gaussian quadrature in the statmod() package that I really like. I think that integrate does adaptive quadrature but not adaptive Gaussian quadrature (which probably should have been called adaptive Gauss-Hermite quadrature to be more specific). In the first case the "adaptive" refers to a choice of mesh size. In the second case one is integrating a function that is close to a multivariate Gaussian density by first finding the conditional optimum of the integrand and using a quadratic approximation to the log-integrand to establish the location of the Gauss-Hermite quadrature points. The Laplace approximation to the log-likelihood for a generalized linear mixed model is a 1-point adaptive Gauss-Hermite quadrature evaluation. > > > -Original Message- > > From: [EMAIL PROTECTED] > > [mailto:[EMAIL PROTECTED] On Behalf Of Caio > > Lucidius Naberezny Azevedo > > Sent: Wednesday, March 21, 2007 5:55 AM > > To: Help mailing list - R > > Subject: [R] Gaussian Adaptive Quadrature > > > > Hi all, > > > > Does anybody know any function that performs gaussian > > adapative quadrature integration of univariate functions? > > > > Thanks in advance, > > > > Regards, > > > > Caio > > > > __ > > > > > > [[alternative HTML version deleted]] > > > > __ > > R-help@stat.math.ethz.ch mailing list > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide > > http://www.R-project.org/posting-guide.html > > and provide commented, minimal, self-contained, reproducible code. > > > > __ > R-help@stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Gaussian Adaptive Quadrature
The function integrate() uses AGQ. There are other functions for gaussian quadrature in the statmod() package that I really like. > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Caio > Lucidius Naberezny Azevedo > Sent: Wednesday, March 21, 2007 5:55 AM > To: Help mailing list - R > Subject: [R] Gaussian Adaptive Quadrature > > Hi all, > > Does anybody know any function that performs gaussian > adapative quadrature integration of univariate functions? > > Thanks in advance, > > Regards, > > Caio > > __ > > > [[alternative HTML version deleted]] > > __ > R-help@stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Gaussian Adaptive Quadrature
Hi all, Does anybody know any function that performs gaussian adapative quadrature integration of univariate functions? Thanks in advance, Regards, Caio __ [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.