[R] Gaussian Quadrature Numerical Integration In R

Ines Azaiez iazaiez at mit.edu
Thu Apr 15 17:32:09 CEST 2010


Hi Ravi,
Thanks for your response. I already considered the change of variables but I was wondering if there were already a function in R which do the same thing in an optimized way. My function f(x) is complicated so adding a change of variable makes the algorithm takes a lot of time to give outputs.
Thanks,
Iazaiez.
________________________________________
From: Ravi Varadhan [rvaradhan at jhmi.edu]
Sent: Wednesday, April 14, 2010 12:50 PM
To: Ines Azaiez; r-help-bounces at stat.math.ethz.ch; r-help at r-project.org
Subject: RE: [R] Gaussian Quadrature Numerical Integration In R

Just do a variable transformation. If your function is f(x), your new
function would be:
        f'(x) = sigma * f(sigma * x + mu).  You can integrate f'(x) using
the Hermite quadrature.

Ravi.

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of Ines Azaiez
Sent: Tuesday, April 13, 2010 9:25 PM
To: r-help-bounces at stat.math.ethz.ch; r-help at r-project.org
Subject: [R] Gaussian Quadrature Numerical Integration In R

Hi All,

I am trying to use A Gaussian quadrature over the interval (-infty,infty)
with weighting function W(x)=exp(-(x-mu)^2/sigma) to estimate an integral.
Is there a way to do it in R? Is there a function already implemented which
uses such weighting function.
I have been searching in the statmode package and I found the function
"gauss.quad(100, kind="hermite")" which uses the weighting function
W(x)=exp(-x^2). Is there a more general version of this weighting function
(using mu and sigma)?

Thanks for your help

Iazaiez
______________________________________________
R-help at r-project.org 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.



More information about the R-help mailing list