Displaying 20 results from an estimated 700 matches similar to: ""adaptIntegrate" function"
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 <-
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 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.
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
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
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
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]]
2010 Apr 12
1
Strange results from Multivariate Normal Density
Hello,
I'm using dmnorm from the package {mnormt} and getting strange results.
First, according to the documentation, dmnorm should return a vector of
densities, and I'm only getting one value returned (which is what I would
expect). I've been interpreting this as the joint density of all values in
the x vector (which is what I want). Should a vector of densities be
returned, and if
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 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 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
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]]
2009 Jun 04
1
Using WinBUGS from R: A Multi-Way Array Problem
Please suggest a way out to the following problem.
I have a T by n data matrix (say Y) where coulmns are time series of length
T.
To do some analysis in WinBUGS I need to construct my data as follows.
yy<-rep(Y,k) ## this will be a vector
Yk<-array(yy,dim=c(T,n,k)) ## data array
Here the definition of dim indices is
first index: T rows
second index: n columns
third index: for kth T by n
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 Feb 15
1
minimizing a numerical integration
Dear all,
I am a new user to R and I am using pracma and nloptr libraries to minimize
a numerical integration subject to a single constraint . The integrand
itself is somehow a complicated function of x and y that is computed
through several steps. i formulated the integrand in a separate function
called f which is a function of x &y. I want to find the optimal value of x
such that 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)]
2010 Aug 02
2
Dealing with a lot of parameters in a function
Hi all,
I'm trying to define and log-likelihood function to work with MLE.
There will be parameters like mu_i, sigma_i, tau_i, ro_i, for i between
1 to 24. Instead of listing all the parameters, one by one in the
function definition, is there a neat way to do it in R ? The example is
as follows:
ll<- function(mu1=-0.5,b=1.2,tau_1=0.5,sigma_1=0.5,ro_1=0.7)
{ if (tau1>0 &&
2013 Feb 18
2
error: Error in if (is.na(f0$objective)) { : argument is of length zero
Dear all,
I tried running the following syntax but it keeps running for about 4 hours
and then i got the following errors:
Error in if (is.na(f0$objective)) { : argument is of length zero
In addition: Warning message:
In is.na(f0$objective) :
is.na() applied to non-(list or vector) of type 'NULL'
Here is the syntax itself:
library('nloptr')
library('pracma')
#
2012 Mar 23
3
R numerical integration
Hi all,
Is there any other packages to do numerical integration other than the
default 'integrate'?
Basically, I am integrating:
integrate(function(x) dnorm(x,mu,sigma)/(1+exp(-x)),-Inf,Inf)$value
The integration is ok provided sigma is >0.
However, when mu=-1.645074 and sigma=17535.26
It stopped working. On the other hand, Maple gives me a value of
0.5005299403.
It is an