[R] Integration of functions with a vector argument
Levine, Michael
m|ev|n@ @end|ng |rom purdue@edu
Sun Jun 23 23:31:14 CEST 2024
Dear Ivan,
Thank you very much again for your suggestions! I will try to use Cubature, then.
yours sincerely,
Michael
Michael Levine
Associate Professor, Statistics
Department of Statistics
Purdue University
250 North University Street
West Lafayette, IN 47907 USA
email: mlevins using purdue.edu
Phone: +1-765-496-7571
Fax: +1-765-494-0558
URL: www.stat.purdue.edu/~mlevins
________________________________
From: Ivan Krylov <ikrylov using disroot.org>
Sent: Thursday, June 20, 2024 11:37 AM
To: Levine, Michael <mlevins using purdue.edu>
Cc: r-help using r-project.org <r-help using r-project.org>
Subject: Re: [R] Integration of functions with a vector argument
---- External Email: Use caution with attachments, links, or sharing data ----
� Tue, 18 Jun 2024 23:12:03 +0000
"Levine, Michael" <mlevins using purdue.edu> �����:
> I have heard of several packages used for numerical integration in R -
> cubature that you mentioned, mvQuad, and pracma. My impression is
> that you think that Cubature is the best in your opinion. Is that so?
Yes, but the preference is not very strong. My own numerical
integration experience is limited to using QUADPACK in a project where
everything had to be rewritten in Fortran for speed.
I trust the code of the 'cubature' library by Steven G. Johnson (whose
work includes FFTW and NLopt) and the 'Cuba' library by Thomas Hahn.
The 'cubature' R package wraps these two libraries. Unfortunately, as
you see, its documentation can be lacking.
Like 'cubature', the 'mvQuad' package won't require a significant
rewrite of the integrand because it expects its functions to take
matrices of arguments. Unfortunately, the two packages differ in the
meanings they assign to the matrices: in 'cubature', individual
arguments of the function correspond to the rows of the first argument,
while in 'mvQuad', they must be in the columns.
The 'mvQuad' package requires manual adjustments to the generated
quadratures using rescale(...), which may be not very convenient.
The 'pracma' package contains implementations of a lot of excellent
methods (I've trusted it before for its other functions), but the (two-
or three-argument) integrand will have to be rewritten to accept
separate arrays (of arbitrary shape?) instead of a single matrix.
> If yes, do you know of any detailed discussion of this package beyond
> the two vignettes available on CRAN?
I don't know how much it can help, but more information about the
underlying code for 'cubature' can be found at
<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fstevengj%2Fcubature&data=05%7C02%7Cmlevins%40purdue.edu%7Cebdca9b21fa14410c84308dc913eed65%7C4130bd397c53419cb1e58758d6d63f21%7C0%7C0%7C638544946662774955%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=jflgsS7UUtmkgKyWyYuKxHtJNBpWA0eSbPQRWxEHOTk%3D&reserved=0<https://github.com/stevengj/cubature>> and <https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Ffeynarts.de%2Fcuba%2F&data=05%7C02%7Cmlevins%40purdue.edu%7Cebdca9b21fa14410c84308dc913eed65%7C4130bd397c53419cb1e58758d6d63f21%7C0%7C0%7C638544946662793433%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=kRblrnUyftzdC7SKqJrVQ9rLjpSX3ySWJK%2FCzhWYAvE%3D&reserved=0<https://feynarts.de/cuba/>>.
--
Best regards,
Ivan
[[alternative HTML version deleted]]
More information about the R-help
mailing list