Dear R-users I would like to integrate something like \int_k^\infty (1 - F(x)) dx, where F(.) is a cumulative distribution function. As mentioned in the "integrate" help-page: integrate(dnorm,0,20000) ## fails on many systems. This does not happen for an adaptive Simpson or Lobatto quadrature (cf. Matlab). Even though I am hardly familiar with numerical integration the implementation seems to be fairly straightforward. My questions: - Is this extension of the function "integrate" planned for upcoming versions of R? - Do there exist packages / workarounds? I'm using R 2.6.2 on Windows and the reason why I want to integrate such an expression is for the sake to compute the performance measure "Omega" for financial securities. Best regards, David -- David L?thi idp - Institute of Data Analysis and Process Design Zurich University of Applied Sciences Postfach 805 CH-8401 Winterthur E-mail: david.luethi at zhaw.ch Phone: 058 934 78 03 http://www.idp.zhaw.ch --
Types of quadrature
3 messages · Lüthi David (luda), Ravi Varadhan, Brian Ripley
Hi, Why do you need an extension of integrate()? integrate() is adaptive - it uses an adaptive Gauss-Kronrod quadrature. You can specify Inf and -Inf as upper and lower limits, resp., in integrate(). In fact, this is what the help page recommends, and it also discourages the use of a large number as a surrogate for Inf. What is the specific problem or distribution that you are having trouble with in using integrate()? 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: rvaradhan at jhmi.edu Webpage: http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html ---------------------------------------------------------------------------- -------- -----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of L?thi David (luda) Sent: Wednesday, March 12, 2008 1:25 PM To: r-help at r-project.org Subject: [R] Types of quadrature Dear R-users I would like to integrate something like \int_k^\infty (1 - F(x)) dx, where (.) is a cumulative distribution function. As mentioned in the "integrate" help-page: integrate(dnorm,0,20000) ## fails on many systems. This does not happen for an adaptive Simpson or Lobatto quadrature (cf. Matlab). Even though I am hardly familiar with numerical integration the implementation seems to be fairly straightforward. My questions: - Is this extension of the function "integrate" planned for upcoming versions of R? - Do there exist packages / workarounds? I'm using R 2.6.2 on Windows and the reason why I want to integrate such an expression is for the sake to compute the performance measure "Omega" for financial securities. Best regards, David -- David L?thi idp - Institute of Data Analysis and Process Design Zurich University of Applied Sciences Postfach 805 CH-8401 Winterthur E-mail: david.luethi at zhaw.ch Phone: 058 934 78 03 http://www.idp.zhaw.ch -- ______________________________________________ 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.
Note that integrate accepts upper=Inf. All that is needed is to read the help and do as it asks.
On Wed, 12 Mar 2008, L?thi David (luda) wrote:
Dear R-users I would like to integrate something like \int_k^\infty (1 - F(x)) dx, where F(.) is a cumulative distribution function. As mentioned in the "integrate" help-page: integrate(dnorm,0,20000) ## fails on many systems. This does not happen for an adaptive Simpson or Lobatto quadrature (cf. Matlab). Even though I am hardly familiar with numerical integration the implementation seems to be fairly straightforward. My questions: - Is this extension of the function "integrate" planned for upcoming versions of R? - Do there exist packages / workarounds? I'm using R 2.6.2 on Windows and the reason why I want to integrate such an expression is for the sake to compute the performance measure "Omega" for financial securities. Best regards, David -- David L?thi idp - Institute of Data Analysis and Process Design Zurich University of Applied Sciences Postfach 805 CH-8401 Winterthur E-mail: david.luethi at zhaw.ch Phone: 058 934 78 03 http://www.idp.zhaw.ch --
______________________________________________ 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.
Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595