Displaying 20 results from an estimated 4000 matches similar to: "Multiple Integration"
2008 Mar 07
1
triple integral: adapt package question
Dear All,
I have a function f(x,y,z)=exp(x^3+y^4+x^2*y+x*z^2+y/z) over D, where is D={
(x,y,z)| 0 <z<Inf, 0<y<c1*z, 0<x<c2*/y}. x,y,z are all vectors and c1 and c2
are constants. I tried the "adapt" package and I get some error. This is the
error message:
"Error in function (z, y, x) : argument "x" is missing, with no default"
I included my R
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"
2007 Oct 29
1
meaning of lenwrk value in adapt function
R-listers,
In using the adapt function, I am getting the following warning:
Ifail=2, lenwrk was too small. -- fix adapt() !
Check the returned relerr! in: adapt(ndim = 2, lower = lower.limit,
upper = upper.limit, functn = pr.set,
Would someone explain what the 'lenwrk' value indicates in order to help
diagnose this issue.
Also, what are the possible codes for Ifail, so I can set
2008 Oct 19
1
multivariate integral with ADAPT when the parameter is close to boundary
Dear All,
There is one problem I encountered when I used ADAPT to compute some
2-D integral w.r.t beta density.
For example, when I try to run the following comments:
fun2<-function(theta){return(dbeta(theta[1],0.005,0.005)*dbeta(theta[2],0.005,0.005))}
int.fun2<-adapt(ndim=2,lo = c(0,0), up = c(1,1),functn = fun2,eps = 1e-4)
It seems it will take very long time to run. Acturally, I
2002 Jul 14
1
help with adapt function
Dear People,
I'm trying to use the function adapt, from the adapt library package,
which does multidimensional numerical integration. I think I must be using
the wrong syntax or something, because even a simple example does not
work. Consider
foo <- function(x){x[1]*x[2]}
and
adapt(2, lo = c(-1,-1), up = c(1,1), functn = foo)
This simply hangs. A more complicated example crashes R,
2003 Apr 22
1
Do loop
Dear all,
I am doing integration by using integrate(..) command
of R. Integrand is a function of parameters (say p).
And I ahve to do the integration for p ranging from 10
to 500 (eg p<-10*1:50). And I want to store the
results in a table like.
p result
10 ------
20 ------
Is there any easy way to do this. I was trying
for(p<-10*1:50){integrate(Func, lower = 0, upper =
182)}, but some
2005 Nov 03
1
multidimensional integration not over a multidimensionalrectangle
Hi,
anyone knows about any functions in R can get multidimensional integration
not over a multidimensional rectangle (not adapt).
For example, I tried the following function f(x,n)=x^n/n!
phi.fun<-function(x,n)
{ if (n==1) {
x
}else{
integrate(phi.fun, lower=0, upper=x, n=n-1)$value
}
}
I could get f(4,2)=4^2/2!=8, but failed in f(4,3)=4^3/3! Thanks
Best,
Lynette
2004 Jul 27
1
Integration with "adapt"
Hi all,
I need to calculate a multidimensional integration on R. I am using the
command "adapt" (from library adapt), although sometimes I get the
following error message:
Ifail=2, lenwrk was too small. -- fix adapt() !
Check the returned relerr! in: adapt(3, linf, lsup, functn = Integrando1)
I guess it happens because the domain of integration is too small,
although I tried a
2008 Mar 07
3
Numerical Integration in 1D
Dear UseRs,
I'm curious about the derivative of n!.
We know that Gamma(n+1)=n! So when on takes the derivative of
Gamma(n+1) we get Int(ln(x)*exp(-x)*x^n,x=0..Inf).
I've tried code like
> integrand<-function(x) {log(x)*exp(x)*x^n}
> integrate(integrand,lower=0,upper=Inf)
It seems that R doesn't like to integrate for any n, and I was
wondering if anyone knew a way around
2011 Oct 05
2
cuhre usage ?? multidimensional integration
my=function(x){
len=1
for(i in 1:len){
y[i]=x[i]
}
g=1
w=NULL
t=NULL
for(i in 1:len)w[i]=x[i+len]
for(i in 1:len)t[i]=x[i+2*len]
for(i in 1:len)g=g*dnorm(y[i])*dnorm(w[i])*dnorm(z[i])
return(g)
}
cuhre(6,1,my,rep(-100,6),rep(100,6))
Error in crff(match.call(), integrand, "cuhre", libargs, ...) :
Additional argument not expected in the integrand function
function change to
2007 Jul 07
2
No convergence using ADAPT
I am trying calculate a probability using numerical integration. The first
program I ran spit out an answer in a very short time. The program is below:
## START PROGRAM
trial <- function(input)
{
pmvnorm(lower = c(0,0), upper = c(2, 2), mean = input, sigma = matrix(c(.1, 0,
0, .1), nrow = 2, ncol = 2, byrow = FALSE))
}
require(mvtnorm)
require(adapt)
bottomB <- -5*sqrt(.1)
topB <-
2003 Jun 06
2
little manipulation on data frame
Dear all,
I have data like 3 coulmns and many rows. Each entry
is less than 10.
Example
x y z
1 5 3 2
2 3 7 8
3 8 9 5
4 5 4 6
--------------------------
---------------------------
I have to sum entries of each coulmn (seperately) till
it be 10. This i have to start for each row. And I
want to assign no. of rows needed including that row
too(it to be 10 or 10+, the moment it exceeds 10, i
2013 Mar 06
3
Plotting time data for various countries in same graph
Hi,
I've the following kind of data
Time Country Values
2010Q1 India 5
2010Q2 India 7
2010Q3 India 5
2010Q4 India 9
2010Q1 China 10
2010Q2
2007 Feb 13
1
Multidimensional Integration over arbitrary sets
Hi,
I need to integrate a 2D function over range where the limits depend
on the other e.g integrate f(x,y)=x*y over {x,0,1} and {y,x,1}.
i.e \int_0^1 \int_x^1 xy dydx
I checked adapt but it doesn't seem to help here. Are they any
packages for this sort of thing?
I tried RSitesearch but couldn't find the answer to this.
Many thanks for you help.
Regards
Saptarshi
Saptarshi Guha
2001 Jan 11
1
segmentation fault in integrate (PR#812)
I tried to integrate numerically a function wich is similar to the
following:
> dummy <- function(x) { exp(-1*x) * dnorm(x) }
> dummy(-100)
[1] 0
> dummy(-1000)
[1] NaN
> dummy(-10000)
[1] NaN
If I choose the lower boundary to be too small integrate causes a
segmentation fault:
> library(integrate)
> integrate(dummy, -100, 0)$value
[1] 1.387143
> integrate(dummy, -1000,
2007 Nov 05
0
multidimensional integration with adapt
Hello,
I apologize for eventual double-posting.
I am trying to integrate a 2-dimensional function that already calls the
function adapt. More precisely, I am calling
adapt(2,lower=c(-100,-100),upper=c(100,100),functn=function(s){1-exp(-50*Unc
enteredGauss(c(-10,10,-10,10),60,s)})
where UncenteredGauss is given by the following code in R:
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
2002 Nov 12
1
Probabilities for bivariate normal distribution with adapt
Dear R-List:
I`m trying to calculate the probabilities for a bivariate normal
distribution while using the mvtnorm-package(dmvnorm) and the
adapt-package for multidimensional integration.
The problem is that I can`t specify the upper bound in the adapt-package
the way I need it because I don`t need a rectangular area. I want to
calculate the probability starting at the origin under the line y=x.
2023 Oct 31
1
9.3p1 Daemon Rejects Client Connections on armv7l-dey-linux-gnueabihf w/ GCC 10/11/12
I have an NXP i.MX6-based armv7l-dey-linux-gnueabihf system in which I
am seeing some as-yet-unaccountable behavior in sshd when compiled with
Arm/GCC 10/11/12. That is, when attempting to scp/slogin/ssh to
'root@<host>', where <host> is either a name or IPv4 or IPv6 address,
the connection is quickly closed by the server without prompting for a
password.
The variable I can
2006 Nov 17
0
Question regarding "integrate" function
Hi there. Thanks for your time in advance.
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 estimated marginal densities.
My problem:
I have the following R codes using "adapt" package. Although "adapt"
function is mainly designed