[R] Numerical integration with R

2014-06-14 Thread Christofer Bogaso
Hi again, I was tying to solve following 2-fold integration with package cubature. However spending approximately 2 hours it failed to generate any number. I am using latest R with win-7 machine having 4gb ram. library(cubature) f - function(x) { + z1 - x[1] + z2 - x[2] + + Rho = 1 + + L -

Re: [R] Numerical integration with R

2014-06-14 Thread David Winsemius
On Jun 14, 2014, at 7:40 AM, Christofer Bogaso wrote: Hi again, I was tying to solve following 2-fold integration with package cubature. However spending approximately 2 hours it failed to generate any number. I am using latest R with win-7 machine having 4gb ram. library(cubature) f -

[R] numerical integration of a bivariate function

2013-04-22 Thread Hicham Mezouara
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

Re: [R] numerical integration of a bivariate function

2013-04-22 Thread R. Michael Weylandt
On Mon, Apr 22, 2013 at 2:04 PM, Hicham Mezouara hicham_d...@yahoo.fr wrote: 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

Re: [R] numerical integration of a bivariate function

2013-04-22 Thread Berend Hasselman
On 22-04-2013, at 15:04, Hicham Mezouara hicham_d...@yahoo.fr wrote: 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

[R] numerical integration

2012-05-23 Thread Michael Meyer
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

Re: [R] numerical integration

2012-05-23 Thread Hans W Borchers
Michael Meyer mjhmeyer at yahoo.com writes: Check your logic. The following lines show that integrate *does* return the correct values: a = 0.08 # alpha M - function(j,s){ return(exp(-j*a*s)) } A - matrix(NA, 5, 5) for (i in 1:5) { for (j in i:5) {

Re: [R] Numerical integration of a two dimensional function over a disk

2012-05-09 Thread yingfu xie
Sent: Tuesday, May 8, 2012 1:44 PM Subject: Re: [R] Numerical integration of a two dimensional function over a disk Simply impossible seems an odd description for a technique described in every elementary calculus text under the heading integration in cylindrical coordinates

[R] Numerical integration of a two dimensional function over a disk

2012-05-08 Thread yingfu xie
Hello, there!   Basically my problem is very clear. I would 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

Re: [R] Numerical integration of a two dimensional function over a disk

2012-05-08 Thread Jeff Newmiller
Simply impossible seems an odd description for a technique described in every elementary calculus text under the heading integration in cylindrical coordinates. --- Jeff NewmillerThe .

[R] Numerical integration again

2012-04-18 Thread casperyc
parameters that will cause the function to return an error or return an inaccurate value, discussed in http://r.789695.n4.nabble.com/R-numerical-integration-td4500095.html R-numerical-integration Any comments or suggestions? Thanks! casper - ## PhD candidate in Statistics

Re: [R] R numerical integration

2012-03-26 Thread Hans W Borchers
casperyc casperyc at hotmail.co.uk writes: I don't know what is wrong with your Maple calculations, but I think you should check them carefully, because: (1) As Petr explained, the value of the integral will be 0.5 (2) The approach of Peter still works and returns : 0.4999777 (3) And the same

Re: [R] R numerical integration

2012-03-25 Thread casperyc
### -- View this message in context: http://r.789695.n4.nabble.com/R-numerical-integration-tp4500095p4503766.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r

Re: [R] R numerical integration

2012-03-24 Thread Hans W Borchers
casperyc casperyc at hotmail.co.uk writes: 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

Re: [R] R numerical integration

2012-03-24 Thread Hans W Borchers
Hans W Borchers hwborchers at googlemail.com writes: casperyc casperyc at hotmail.co.uk writes: Is there any other packages to do numerical integration other than the default 'integrate'? Basically, I am integrating: integrate(function(x)

Re: [R] R numerical integration

2012-03-24 Thread Petr Savicky
On Fri, Mar 23, 2012 at 01:27:57PM -0700, casperyc wrote: 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

Re: [R] R numerical integration

2012-03-24 Thread peter dalgaard
On Mar 24, 2012, at 09:46 , Petr Savicky wrote: Integrating with infinite limits is necessarily a heuristic. ...as is numerical integration in general. In the present case, the infinite limits are actually only half the problem. The integrate() function is usually quite good at dealing with

[R] R numerical integration

2012-03-23 Thread casperyc
: http://r.789695.n4.nabble.com/R-numerical-integration-tp4500095p4500095.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http

Re: [R] Numerical integration

2011-07-01 Thread nany23
thank you very much for your suggestion! I tried to do that with the psf I need to use: the 3 parameters Lognormal. I did that with a single xstar and a single triplet of parameters to check it works.[I put some numbers to make it woks , but actually they comes from statistical analysis] /#

Re: [R] Numerical integration

2011-07-01 Thread nany23
thanks for the Italian! I apologize for my previuos explanation which was not clear actually there are two k parameters, so I change one them; let's put it this way /# these are the 3 parameters a- 414.566 b- 345.5445 g- -0.9695679 xstar- 1397.923 *m-100* #I create a vector pars

Re: [R] Numerical integration

2011-06-30 Thread Dennis Murphy
Hi: You could write the function this way: f - function(x, xstar, k) dnorm(x) * k * x * (x = xstar) where the term in parentheses is a logical. For any x xstar, f will be zero by definition. Substitute your density in for dnorm(). To integrate over a grid of (xstar, k) values, you could try

[R] Numerical integration

2011-06-29 Thread nany23
Hello! I know that probably my question is rather simple but I' m a very beginner R-user. I have to numerically integrate the product of two function A(x) and B(x). The integretion limits are [X*; +inf] Function A(x) is a pdf function while B(x)=e*x is a linear function whose value is equal

Re: [R] numerical integration and 'non-finite function value' error

2011-06-24 Thread Adan_Seb
The domain of the beta distribution as defined in R is 0 = x = 1 and as shown by David Winsemius it is undefined outside [0,1]. But thats sort of the question I have. To elaborate, I have a variable with 0 as its natural lower limit but can assume any positive number as an upper limit. So its

Re: [R] numerical integration and 'non-finite function value' error

2011-06-23 Thread Adan_Seb
Here is a self-contained example of my problem. set.seed(100) x = rbeta(100, 10.654, 10.439) # So the shape parameters and the exteremes are a = 10.654 b = 10.439 xmax = 1 xmin = 0 # Using the non-standardized form (as in my application and this shouldn't make any difference) of the # Beta

Re: [R] numerical integration and 'non-finite function value' error

2011-06-23 Thread David Winsemius
On Jun 23, 2011, at 8:55 AM, Adan_Seb wrote: Here is a self-contained example of my problem. set.seed(100) x = rbeta(100, 10.654, 10.439) # So the shape parameters and the exteremes are a = 10.654 b = 10.439 xmax = 1 xmin = 0 # Using the non-standardized form (as in my application and this

[R] numerical integration and 'non-finite function value' error

2011-06-22 Thread Adan_Seb
Dear R users, I have a question about numerical integration in R. I am facing the 'non-finite function value' error while integrating the function xf(x) using 'integrate'. f(x) is a probability density function and assumed to follow the three parameter (min = 0)

Re: [R] numerical integration and 'non-finite function value' error

2011-06-22 Thread Ravi Varadhan
: Wednesday, June 22, 2011 6:46 PM To: r-help@r-project.org Subject: [R] numerical integration and 'non-finite function value' error Dear R users, I have a question about numerical integration in R. I am facing the 'non-finite function value' error while integrating the function

[R] Numerical integration

2010-11-17 Thread Eduardo de Oliveira Horta
Hi! I was wondering if there are any other functions for numerical integration, besides 'integrate' from the stats package, but which wouldn't require the integrand to be vectorized. Oh, and must be capable of integrating over (-inf,+inf). Thanks in advance, Eduardo Horta [[alternative

Re: [R] Numerical integration

2010-11-17 Thread David Winsemius
On Nov 17, 2010, at 6:44 AM, Eduardo de Oliveira Horta wrote: Hi! I was wondering if there are any other functions for numerical integration, besides 'integrate' from the stats package, but which wouldn't require the integrand to be vectorized. Oh, and must be capable of integrating

[R] Numerical Integration

2009-12-18 Thread Julio Rojas
Dear @ll. I have to calculate numerical integrals for triangular and trapezoidal figures. I know you can calculate the exactly, but I want to do it this way to learn how to proceed with more complicated shapes. The code I'm using is the following: integrand-function(x) { print(x)

Re: [R] Numerical Integration

2009-12-18 Thread Julio Rojas
: Is there a way to use approx as the integrand? Best regards. Julio --- El vie 18-dic-09, William Dunlap wdun...@tibco.com escribió: De: William Dunlap wdun...@tibco.com Asunto: RE: [R] Numerical Integration A: Julio Rojas jcredbe...@ymail.com Fecha: viernes, 18 diciembre, 2009, 4:03 pm

Re: [R] Numerical Integration

2009-12-18 Thread William Dunlap
-Original Message- From: Julio Rojas [mailto:jcredbe...@ymail.com] Sent: Friday, December 18, 2009 9:06 AM To: William Dunlap; r-help@r-project.org Subject: RE: [R] Numerical Integration Thanks a lot William. I'm sorry about the syntax problem. I was working at the same time

[R] Numerical integration problem

2009-09-23 Thread Marcus Rowcliffe
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

Re: [R] Numerical integration problem

2009-09-23 Thread Ravi Varadhan
] 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

[R] numerical integration

2009-09-10 Thread Roslina Zakaria
Hi r-users,   Can I do a numerical integration in R to solve for F(z)- integral_0^z {f(t) dt} = 0 where F(z) is the CDF and f(t) is the pdf?  What package can I use?   Thank you so much for any help given. [[alternative HTML version deleted]]

Re: [R] numerical integration

2009-09-10 Thread Bert Gunter
] numerical integration Hi r-users, Can I do a numerical integration in R to solve for F(z)- integral_0^z {f(t) dt} = 0 where F(z) is the CDF and f(t) is the pdf? What package can I use? Thank you so much for any help given. [[alternative HTML version deleted

Re: [R] Numerical Integration Problems

2009-01-08 Thread Christos Argyropoulos
Hi, You may want to try the double exponential transformation on the numerator and the denominator on this one. The method is described in detail here: http://projecteuclid.org/DPubS?service=UIversion=1.0verb=Displayhandle=euclid.prims/1145474600 If you want to give it a shot outside R

[R] Numerical Integration in 1D

2008-03-07 Thread Max
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

Re: [R] Numerical Integration in 1D

2008-03-07 Thread Ravi Varadhan
Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Max Sent: Friday, March 07, 2008 1:41 PM To: [EMAIL PROTECTED] Subject: [R] 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

Re: [R] Numerical Integration in 1D

2008-03-07 Thread Max
Prof Brian Ripley formulated on Friday : On Fri, 7 Mar 2008, Max wrote: 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)

Re: [R] Numerical Integration in 1D

2008-03-07 Thread Ravi Varadhan
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Max Sent: Friday, March 07, 2008 1:41 PM To: [EMAIL PROTECTED] Subject: [R] Numerical Integration in 1D Dear UseRs, I'm curious about the derivative of n!. We

Re: [R] Numerical Integration in 1D

2008-03-07 Thread Prof Brian Ripley
On Fri, 7 Mar 2008, Max wrote: Prof Brian Ripley formulated on Friday : On Fri, 7 Mar 2008, Max wrote: 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

Re: [R] numerical integration of a ftn of 2 variables

2008-02-21 Thread Paul Smith
On Tue, Feb 19, 2008 at 11:07 PM, Chris Rhoads [EMAIL PROTECTED] wrote: To start, let me confess to not being an experienced programmer, although I have used R fairly extensively in my work as a graduate student in statistics. I wish to find the root of a function of two variables that

Re: [R] numerical integration of a ftn of 2 variables

2008-02-21 Thread Berend Hasselman
Chris Rhoads wrote: I wish to find the root of a function of two variables that is defined by an integral which must be evaluated numerically. So the problem I want to solve is of the form: Find k such that f(k)=0, where f(y) = int_a^b g(x,y) dx. Again, the integral involved must

[R] numerical integration of a ftn of 2 variables

2008-02-19 Thread Chris Rhoads
Dear R gurus, To start, let me confess to not being an experienced programmer, although I have used R fairly extensively in my work as a graduate student in statistics. I wish to find the root of a function of two variables that is defined by an integral which must be evaluated numerically.