On Fri, May 8, 2009 at 7:07 AM, Boikanyo Makubate <boika...@stats.gla.ac.uk> wrote:
> Can anyone help me on how to get the nodes and weights of the adaptive > quadrature > using R. You need to be more specific about which quadrature formula. I'm guessing that you probably have Gauss-Hermite quadrature in mind because it is used when a density is approximated by a Gaussian density (the "adaptive" modifier refers to a process where the conditional mode and conditional variance are determined, given values of parameters). In that case you could start at http://en.wikipedia.org/wiki/Gauss-Hermite_Quadrature for the theory. There is C code in the lme4 package to compute the nodes and weights for Gauss-Hermite quadrature but we haven't written a public interface to it. You can try, for example > library(lme4) > .Call("lme4_ghq", 7) [[1]] [1] 2.6519614 1.6735516 0.8162879 0.0000000 -0.8162879 -1.6735516 -2.6519614 [[2]] [1] 0.0009717812 0.0545155828 0.4256072526 0.8102646176 0.4256072526 [6] 0.0545155828 0.0009717812 to get the nodes and the weights for a 7-point Gauss-Hermite quadrature. (There are two versions of the Hermite polynomials, the physicist's version where the kernel is exp(-x^2) and the probabilist's version where the kernel is exp(-(x^2)/2). I'm pretty sure these are from the physicist's version.) ______________________________________________ R-help@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.