Displaying 19 results from an estimated 19 matches for "adaptintegr".
Did you mean:
adaptintegral
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 of f(x,y) is. I can use adaptIntegrate to
calculate \hat{f}(x1,y1) = adaptInt...
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...
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(...
2011 Nov 10
2
performance of adaptIntegrate vs. integrate
...rate() only allows scalar integrands, thus I would need to call
it many (p=200 typically) times, which sounds suboptimal. The cubature
package seems well suited, as illustrated below,
library(cubature)
Nmax <- 1e3
tolerance <- 1e-4
integrand <- function(x, a=0.01) c(exp(-x^2/a^2), cos(x))
adaptIntegrate(integrand, -1, 1, tolerance, 2, max=Nmax)$integral
[1] 0.01772454 1.68294197
However, adaptIntegrate appears to perform quite poorly when compared
to integrate. Consider the following example (one-dimensional
integrand),
library(cubature)
integrand <- function(x, a=0.01) exp(-x^2/a^2)*cos(x...
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:
adaptInte...
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 foll...
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<-adaptIntegra...
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
2012 Oct 02
3
Integration in R
...-1
for (i in 1:length(dose)) {
psi0<-1/((1+exp(x[1]+x[2]*dose[i]))*(1+exp(x[3]+x[4]*dose[i])))
psi1<-exp(x[1]+x[2]*dose[i])/((1+exp(x[1]+x[2]*dose[i]))*(1+exp(x[3]+x[4]*dose[i])))
v<-v*(psi0^y0[i])*(psi1^y1[i])*((1-psi0-psi1)^y2[i])
}
return(v)
}
adaptIntegrate(lf, lowerLimit = c(-20, 0,-20,0), upperLimit = c(0,10,0,10))
---------------------------------------------------------------------------------------------------------------------------------
Thanks for your attention.
Kind regards,
Jamil.
[[alternative HTML version deleted]]
2013 Jan 08
2
Integration in R
...e 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.
-------------------------------------------------------------------
library(cubature)
f<-function(x) { 2/3 * (x[1] + x[2] ) }
adaptIntegrate(f, lowerLimit = c(0, 0), upperLimit = c(x[2],7))
-------------------------------------------------------------------
I guess something is wrong with the way I have assigned limits
in my codes. May I seek some advice from you.
Many thanks.
Regards,
Jamil.
[[alternative HTML version deleted...
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
...x1 <- x[1]
+ x2 <- x[2]
+ Sigma <- matrix(c(1, rho, rho, 1), 2,2)
+ mu <- rep(0,2)
+ f <- pmnorm(c((z-a*x1)/b, (z-a*x2)/b), mu,
Sigma)*dmnorm(c(0,0), mu, diag(2))
+ f
+ }
>
> adaptIntegrate(integrand, lower=rep(-Inf, 2), upper=c(2,2),
+ rho=0.1, a=0.6, b=0.3, z=3, maxEval=10000)
Error in if (any(lower > upper)) stop("lower>upper integration limits") :
missing value where TRUE/FALSE needed
[[alternative HTML version deleted]]
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]]
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]]
2012 May 08
3
Numerical integration of a two dimensional function over a disk
...ld like to take a (numerical) integration of a function f(x,y) which can be quite complex of x and y, over a disk (x-a)^2+(y-b)^2<= r^2 (with r constant). However, after some search in R, I just cannot find a function in R that suits my purpose. Function Integrate applies to one dimensional, and adaptIntegrate to rectangle. In my case, it is not easy or simply impossible to transform the definition area to a rectangle with constant boundaries. I must have missed something, but is there any R function which can solve the integration without going to ex. Monto Carlo? Many thanks in advance!
Best reg...
2011 Feb 17
1
multi process support in R
Dear all,
two days ago I was trying to run a bunch of adaptIntegrate() functions (double integrals) into my 4 core pc.
As I was not satisfied about my pc's performance I tried also to run my code to another computer that has 8 or 16 cores. Unfortunately I didnt get any really decent improvement . In both computer only the first core was looking busy while t...
2011 Nov 28
0
function manipulation for integration
Hi All,
I'm trying to use one of the (2D) numerical integration functions, which is
not where the problem is. The function definition is as follows:
adaptIntegrate(f, lowerLimit, upperLimit, ...)
The problem is that I want to integrate a 3D function which has been
parametrised such that it is a 2D function:
eg. I want to integrate f(x_start+gradient_x*t1, y_start+gradient_y*t2) for
t1 in [0,1] and t2 in [0,1].
To explain the example in another way I only...
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)]
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