similar to: performance of adaptIntegrate vs. integrate

Displaying 20 results from an estimated 800 matches similar to: "performance of adaptIntegrate vs. integrate"

2011 May 03
2
adaptIntegrate - how to pass additional parameters to the integrand
Hello, I am trying to use adaptIntegrate function but I need to pass on a few additional parameters to the integrand. However, this function seems not to have the flexibility of passing on such additional parameters. Am I missing something or this is a known limitation. Is there a good alternative to such restrictions, if there at all are? Many thanks for your time. HC -- View this message in
2013 Mar 21
1
"adaptIntegrate" function
Hi all, it seems that there is problem with function "adaptIntegrate", when the integration limits is infinity. Please see the code below. The second integration does not seem to work. Can anyone familiar with this give some help? Thank you with much. Hanna library(mnormt) library(cubature) ff <- function(x, rho){ mu <- rep(0,3) Sigma
2012 Mar 25
1
cubature
Hi, I am using adaptIntegrate from Cubature to do numerical integration on a double integral with a 1 x 2 vector x. Say the function is something simple to start like f(x)=x1*x2 and I wish to integrate x1 over (0,365-x2) and x2 over (0,365) f <- function(x) {(x[2])*(x[1])} # "x" is vector int1<-adaptIntegrate(f, lowerLimit = c(0, 0), upperLimit = c(365-x[2], 365)) I recieve
2010 Sep 21
3
bivariate vector numerical integration with infinite range
Dear list, I'm seeking some advice regarding a particular numerical integration I wish to perform. The integrand f takes two real arguments x and y and returns a vector of constant length N. The range of integration is [0, infty) for x and [a,b] (finite) for y. Since the integrand has values in R^N I did not find a built-in function to perform numerical quadrature, so I wrote my own after
2013 Jan 08
2
Integration in R
Hi R-users. I'm having difficulty with an integration in R via the package "cubature". I'm putting it with a simple example here. I wish to integrate a function like: f(x1,x2)=2/3*(x1+x2) in the interval 0<x1<x2<7. To be sure I tried it by hand and got 114.33, but the following R code is giving me 102.6667.
2012 May 21
0
Erratic error with adaptIntegrate in cubature package
Hi everyone, I have been using adaptIntegrate from the cubature package for a multidimensional integral that has infinite variance (and so not appropriate for Monte Carlo techniques). Most of the time it works but sometimes (though not always) when I slightly increase the accuracy I want, or increase the bounds of integration I get the following error: REAL() can only be applied to a
2012 Oct 02
3
Integration in R
Dear R-users, I am facing problem with integrating in R a likelihood function which is a function of four parameters. It's giving me the result at the end but taking more than half an hour to run. I'm wondering is there any other efficient way deal with. The following is my code. I am ready to provide any other description of my function if you need to move forward.
2012 May 23
0
Error from using adaptIntegrate within a function that is then integrated
I want to measure the error in the estimation of a 2 dimensional density function that is calculated using an integral but run into problems trying to integrate with adaptIntegrate because the integrand also calls the function adaptIntegrate. In particular I want \int \hat{f}(x,y) - f(x,y) dx dy where \hat{f}(x,y) = \int K(a,b, x, y) da db and in this simulation study I know what the true value
2011 Dec 02
1
R2Cuba package, failed with message ‘Dimension out of range’
Hi All, I get the message failed with message ‘Dimension out of range’ when using cuhre in package R2Cuba. Does anyone know what this mean? Or would I need to email the package author? The funny thing is it does give a result and comparing it to "adaptIntegrate" in package cubature, the two numbers are very close. Thanks, Sachin [[alternative HTML version deleted]]
2013 Mar 05
2
Error message
Dear all, I got an error message when running the following code. Can anyone give any suggestions on fixing this type of error? Thank you very much in advance. Hanna > integrand <- function(x, rho, a, b, z){ + x1 <- x[1] + x2 <- x[2] + Sigma <- matrix(c(1, rho, rho, 1), 2,2) + mu <- rep(0,2) + f <-
2012 Oct 17
1
for loop output
Dear R users, In the code below, I am trying to print the result of my loop function. The output first gives me the result for k=1, and then for k=1 and k=2. I only want the last output which is [,1] [,2] [1,] 0.1700065 0.5002659 [2,] 0.3080273 0.4954731 [3,] 0.4844886 0.4544306 [4,] 0.5062987 0.1868154 [5,] 0.5846982 0.4353522 [6,] 0.4332621 0.2202922 [7,] 0.4391985
2013 Feb 16
3
two dimensional integration
Dear R-users, I'm wondering how to calculate this double integral in R: int_a^b int_c^y g(x, y) dx dy where g(x,y) = exp(- alpha (y - x)) * b Thanks for answering! Cheers, Alui [[alternative HTML version deleted]]
2010 Dec 06
3
0.5 != integrate(dnorm,0,20000) = 0
Hello: The example "integrate(dnorm,0,20000)" says it "fails on many systems". I just got 0 from it, when I should have gotten either an error or something close to 0.5. I got this with R 2.12.0 under both Windows Vista_x64 and Linux (Fedora 13); see the results from Windows below. I thought you might want to know. Thanks for all your work in creating
2013 Apr 22
2
numerical integration of a bivariate function
hello I work on the probabilities of bivariate normal distribution. I need integrate  the following function. f (x, y) = exp [- (x ^ 2 + y ^ 2 + x * y)] with - ∞ ≤ x ≤ 7.44 and - ∞ ≤ y ≤ 1.44   , either software R or  matlab Version R 2009a Thank you for helping me Regards Mezouara hicham PhD in Metrology Hicham_dess @ yahoo.fr [[alternative HTML version deleted]]
2011 Jan 27
0
adaptIntegral takes too much time
Hello Dear List members, as you can see (and guess) from the code below adaptIntegrate(f,lowerLimit=c(-1,-1),upperLimit=c(.9999,.9999)) $integral [1] 9.997e-09 $error [1] 1.665168e-16 $functionEvaluations [1] 17 $returnCode [1] 0 > adaptIntegrate(f,lowerLimit=c(-1,-1),upperLimit=c(1,1)) the last command runs for 45 mins now. -this one takes only less than sec:
2009 Sep 23
1
Numerical integration problem
Hi there I'm trying to construct a model of mortality risk in 2D space that requires numerical integration of a hazard function, for which I'm using the integrate function. I'm occasionally encountering parameter combinations that cause integrate to terminate with error "Error in integrate... the integral is probably divergent", which I'm not sure how to interpret. The
2010 Jul 01
3
Double Integration
Dear R helpers I am working on the Bi-variate Normal distribution probabilities. I need to double integrate the following function (actually simplified form of bivariate normal distribution) f(x, y) = exp [ - 0.549451 * (x^2 + y^2 - 0.6 * x * y) ] where 2.696 < x < 3.54 and -1.51 < y < 1.98 I need to solve something like INTEGRATE (2.696 to 3.54) dx INTEGRATE [(-1.51 to 1.98)]
2007 Nov 09
5
Multivariate integration with infinite limits
Dear All, Can R perform multivariate integration with infinite limits of integration? Thanks in advance, Paul
2011 Dec 10
2
efficiently finding the integrals of a sequence of functions
Hi folks, I am having a question about efficiently finding the integrals of a list of functions. To be specific, here is a simple example showing my question. Suppose we have a function f defined by f<-function(x,y,z) c(x,y^2,z^3) Thus, f is actually corresponding to three uni-dimensional functions f_1(x)=x, f_2(y)=y^2 and f_3(z)=z^3. What I am looking for are the integrals of these three
2008 Aug 26
2
Problem with Integrate for NEF-HS distribution
I need to calcuate the cumulative probability for the Natural Exponential Family - Hyperbolic secant distribution with a parameter theta between -pi/2 and pi/2. The integration should be between 0 and 1 as it is a probability. The function "integrate" works fine when the absolute value of theta is not too large. That is, the NEF-HS distribution is not too skewed. However, once the