Displaying 20 results from an estimated 700 matches similar to: "bivariate vector numerical integration with infinite range"
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.
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 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
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
2011 Nov 10
2
performance of adaptIntegrate vs. integrate
Dear list,
[cross-posting from Stack Overflow where this question has remained
unanswered for two weeks]
I'd like to perform a numerical integration in one dimension,
I = int_a^b f(x) dx
where the integrand f: x in IR -> f(x) in IR^p is vector-valued.
integrate() only allows scalar integrands, thus I would need to call
it many (p=200 typically) times, which sounds suboptimal. The
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 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:
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 <-
2006 Nov 18
1
Questions regarding "integrate" function
Hi there. Thanks for your time in advance.
I am using R 2.2.0 and OS: Windows XP.
My final goal is to calculate 1/2*integral of
(f1(x)^1/2-f2(x)^(1/2))^2dx (Latex codes:
$\frac{1}{2}\int^{{\infty}}_{\infty}
(\sqrt{f_1(x)}-\sqrt{f_2(x)})^2dx $.) where f1(x) and f2(x) are two
marginal densities.
My problem:
I have the following R codes using "adapt" package. Although "adapt"
2012 May 23
1
numerical integration
Greetings,
Sorry, the last message was sent by mistake! Here it is again:
I encounter a strange problem computing some numerical integrals on [0,oo).
Define
$$
M_j(x)=exp(-jax)
$$
where $a=0.08$. We want to compute the $L^2([0,\infty))$-inner products
$$
A_{ij}:=(M_i,M_j)=\int_0^\infty M_i(x)M_j(x)dx
$$
Analytically we have
$$
A_{ij}=1/(a(i+j)).
$$
In the code below we compute the matrix
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
2011 Nov 06
2
how to use quadrature to integrate some complicated functions
Hello to all,
I am having trouble with intregrating a complicated uni-dimensional function
of the following form
Phi(x-a_1)*Phi(x-a_2)*...*Phi(x-a_{n-1})*phi(x-a_n).
Here n is about 5000, Phi is the cumulative distribution function of
standard normal,
phi is the density function of standard normal, and x ranges over
(-infty,infty).
My idea is to to use quadrature to handle this integral. But
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 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
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
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
2010 Dec 22
3
How to integrate a function with additional argument being a vector or matrix?
Dear expeRts,
I somehow don't see why the following does not work:
integrand <- function(x, vec, mat, val) 1 # dummy return value
A <- matrix(runif(16), ncol = 4)
u <- c(0.4, 0.1, 0.2, 0.3)
integrand(0.3, u, A, 4)
integrate(integrand, lower = 0, upper = 1, vec = u, mat = A, val = 4)
I would like to integrate a function ("integrand") which gets an "x" value (the
2013 Feb 12
2
integrate function
Hi All,
Can any one help to explain why min and max function couldn't work in the
integrate function directly.
For example, if issue following into R:
integrand <- function(x) {min(1-x, x^2)}
integrate(integrand, lower = 0, upper = 1)
it will return this:
Error in integrate(integrand, lower = 0, upper = 1) :
evaluation of function gave a result of wrong length
However, as min(U,V) =
2004 May 05
4
Discontinuities in a simple graph (machine precision?)
Hi,
I've got an ugly but fairly simple function:
mdevstdev <- function(a){
l <- dnorm(a)/(1-pnorm(a))
integrand <- function(z)(abs(z-l)*dnorm(z))
inted <- integrate(integrand, a, Inf)
inted[[1]]/((1- pnorm(a))*sqrt((1 + a*l - l^2)))
}
I wanted to quickly produce a graph of this over the range [-3,3] so I
used:
plotit <-function(x=seq(-3,3,0.01),...){
2011 May 30
1
Error in minimizing an integrand using optim
Hi,
Am not sure if my code itself is correct. Here's what am trying to do:
Minimize integration of a function of gaussian distributed variable 'x' over
the interval qnorm(0.999) to Inf by changing value of parameter 'mu'. mu is
the shift in mean of 'x'.
Code:
# x follows gaussian distribution
# fx2 to be minimized by changing values of mu
# integration to be done over