Re: [R] Integration of functions with a vector argument

2024-06-24 Thread Levine, Michael
-0558 URL: www.stat.purdue.edu/~mlevins From: Bert Gunter Sent: Thursday, June 20, 2024 1:09 PM To: Ivan Krylov Cc: Levine, Michael ; r-help@r-project.org Subject: Re: [R] Integration of functions with a vector argument You don't often get email from bgun

Re: [R] Integration of functions with a vector argument

2024-06-24 Thread Levine, Michael
Phone: +1-765-496-7571 Fax: +1-765-494-0558 URL: www.stat.purdue.edu/~mlevins From: Ivan Krylov Sent: Thursday, June 20, 2024 11:37 AM To: Levine, Michael Cc: r-help@r-project.org Subject: Re: [R] Integration of functions with a vector argument External

Re: [R] Integration of functions with a vector argument

2024-06-20 Thread Bert Gunter
The calculus package might also be relevant (not sure if it was in the Task View): https://cran.r-project.org/web/packages/calculus/index.html -- Bert On Thu, Jun 20, 2024 at 10:01 AM Bert Gunter wrote: > If you haven't already done so, you may wish to have a look here: > > > https://cran.r-pr

Re: [R] Integration of functions with a vector argument

2024-06-20 Thread Bert Gunter
If you haven't already done so, you may wish to have a look here: https://cran.r-project.org/web/views/NumericalMathematics.html#differentiation-and-integration (Or perhaps in other related subtopics in the Numerical Math task view) Cheers, Bert On Thu, Jun 20, 2024 at 8:37 AM Ivan Krylov via R

Re: [R] Integration of functions with a vector argument

2024-06-20 Thread Ivan Krylov via R-help
В Tue, 18 Jun 2024 23:12:03 + "Levine, Michael" пишет: > I have heard of several packages used for numerical integration in R - > cubature that you mentioned, mvQuad, and pracma. My impression is > that you think that Cubature is the best in your opinion. Is that so? Yes, but the preference

Re: [R] Integration of functions with a vector argument

2024-06-19 Thread Levine, Michael
email: mlev...@purdue.edu Phone: +1-765-496-7571 Fax: +1-765-494-0558 URL: www.stat.purdue.edu/~mlevins From: Ivan Krylov Sent: Thursday, June 13, 2024 6:21 AM To: Levine, Michael Cc: r-help@r-project.org Subject: Re: [R] Integration of functions with a v

Re: [R] Integration of functions with a vector argument

2024-06-13 Thread Ivan Krylov via R-help
В Wed, 12 Jun 2024 23:42:18 + "Levine, Michael" пишет: > f.int1 <- function(x,y) {Vectorize (function(y) f(c(x,y),H=H,j=j))} Vectorize returns a callable function(y), so wrapping it in a function(x,y) will not work. Since you'd like to integrate over y, we can perform the same transformation

Re: [R] Integration of functions with a vector argument

2024-06-13 Thread Levine, Michael
purdue.edu/~mlevins From: Ivan Krylov Sent: Wednesday, June 12, 2024 6:41 AM To: Levine, Michael Cc: r-help@r-project.org Subject: Re: [R] Integration of functions with a vector argument [You don't often get email from ikry...@disroot.org. Learn why this is imp

Re: [R] Integration of functions with a vector argument

2024-06-13 Thread Jeff Newmiller via R-help
How do you integrate perpendicular to a plane if you don't have a concept of 3d? In that direction the plane is just a point. Vectors in R do not have any concept of "n by 1"... they are like a string of beads. When you take a column out of a matrix `a` using indexing b <- a[,j] the resulting v

Re: [R] Integration of functions with a vector argument

2024-06-12 Thread Ivan Krylov via R-help
В Tue, 11 Jun 2024 18:44:08 + "Levine, Michael" пишет: > Let us say we have a function > > F <- function(x){ body of the function} > > Where x is, in general, a d by 1 vector with d>1. Now I want to > integrate out some of the coordinates of x, e.g. x[1] or x[2] or both > of them etc. I'm

Re: [R] Integration of vector syntax unknown

2013-03-22 Thread Jeff Newmiller
You hope it makes sense, but it doesn't to me. Can you describe it without the multiple instances? Your last equation in particular seems confusing (e.g. undefined variable N, integrating by a variable N_1 to a limit of N_1, what is a_2 and why is it being used to determine gamma_1). For clarit

Re: [R] Integration of mixed normal distribution

2013-01-30 Thread David Winsemius
On Jan 30, 2013, at 4:19 AM, Johannes Radinger wrote: Hi, I already found a conversation on the integration of a normal distribution and two suggested solutions (https://stat.ethz.ch/pipermail/r-help/2007-January/124008.html): 1) integrate(dnorm, 0,1, mean = 0, sd = 1.2) and 2) pnorm(1, mea

Re: [R] Integration of mixed normal distribution

2013-01-30 Thread Rui Barradas
Hello, You could do something like the following. fun <- function(x, mean, sd1, sd2, p) dnorm(x, mean, sd1)*p + dnorm(x, mean, sd2)*(1 - p) fun2 <- function(x1, x2, mean, sd1, sd2, p){ p1 <- pnorm(x2, mean, sd1) - pnorm(x1, mean, sd1) p2 <- pnorm(x2, mean, sd2) - pnorm(

Re: [R] Integration in R

2013-01-08 Thread David Winsemius
On Jan 8, 2013, at 1:31 PM, David Winsemius wrote: On Jan 8, 2013, at 1:07 PM, Berend Hasselman wrote: On 08-01-2013, at 22:00, Berend Hasselman wrote: …... David implemented the condition by multiplying by x[1]in a numeric context is 0 when x[1]=x[2]. OOPS!! Reverse the 0 and the 1 in

Re: [R] Integration in R

2013-01-08 Thread David Winsemius
On Jan 8, 2013, at 1:07 PM, Berend Hasselman wrote: On 08-01-2013, at 22:00, Berend Hasselman wrote: …... David implemented the condition by multiplying by x[1]in a numeric context is 0 when x[1]=x[2]. OOPS!! Reverse the 0 and the 1 in that sentence (TRUE becomes 1 and FALSE becomes 0)

Re: [R] Integration in R

2013-01-08 Thread Berend Hasselman
On 08-01-2013, at 22:00, Berend Hasselman wrote: > …... > David implemented the condition by multiplying by x[1] numeric context is 0 when x[1]=x[2]. OOPS!! Reverse the 0 and the 1 in that sentence (TRUE becomes 1 and FALSE becomes 0) Berend __ R-h

Re: [R] Integration in R

2013-01-08 Thread Berend Hasselman
On 08-01-2013, at 19:51, Naser Jamil wrote: > Thanks. But then how to implement condition like 0 happy to know that. > David implemented the condition by multiplying by x[1]=x[2]. That is what your requirement does. The condition 0x2 which is what your inequality implies. Berend > On 8 Jan

Re: [R] Integration in R

2013-01-08 Thread Naser Jamil
Thanks. But then how to implement condition like 0 wrote: > Please reply on list. > > > On Jan 8, 2013, at 10:27 AM, Naser Jamil wrote: > > Hi David, >> x[2] is the second variable, x2. It comes from the condition 0> > > No, it doesn't come from those conditions. It is being grabbed from some > "

Re: [R] Integration in R

2013-01-08 Thread David Winsemius
On Jan 8, 2013, at 10:51 AM, Naser Jamil wrote: Thanks. But then how to implement condition like 0be happy to know that. Multiply the function by the conditional expression: > f<-function(x) { 2/3 * (x[1] + x[2] )*(x[1] < x[2]) } > adaptIntegrate(f, lowerLimit = c(0, 0), upperLimit = c(7,7))

Re: [R] Integration in R

2013-01-08 Thread David Winsemius
Please reply on list. On Jan 8, 2013, at 10:27 AM, Naser Jamil wrote: Hi David, x[2] is the second variable, x2. It comes from the condition 0 No, it doesn't come from those conditions. It is being grabbed from some "x"-named object that exists in your workspace. If your limits were 7 in

Re: [R] Integration in R

2013-01-08 Thread David Winsemius
On Jan 8, 2013, at 9:43 AM, Naser Jamil wrote: 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 0by hand and got 114.33, but the follow

Re: [R] Integration in R

2012-11-21 Thread Ravi Varadhan
Send us a reproducible R code that shows what you actually tried. Ravi Varadhan, Ph.D. Assistant Professor The Center on Aging and Health Division of Geriatric Medicine & Gerontology Johns Hopkins University rvarad...@jhmi.edu 410-502-2619 [[alternative HTML ve

Re: [R] Integration in R

2012-11-21 Thread William Dunlap
wdunlap tibco.com > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf > Of Rolf Turner > Sent: Wednesday, November 21, 2012 12:57 PM > To: Rehena Sultana > Cc: r-help@r-project.org > Subject: Re: [R] Integration in R &g

Re: [R] Integration in R

2012-11-21 Thread Rolf Turner
On 21/11/12 22:26, Rehena Sultana wrote: Dear R - Experts, I am trying to integrate lognormal distribution (mu = -0.3 and sigma2 = 0.00041.. ) based on the some hypothetical data. But I am getting 0 as the result. I have checked that my R-code is correct as code is giving me result for some o

Re: [R] Integration in R

2012-10-02 Thread Berend Hasselman
On 02-10-2012, at 20:50, Dereje Bacha wrote: > Hi > > I am facing a problem of restricting an intercept of systems of equations. > Y1=f(X1,X2,X3) > Y2=(X1,X2,X4) > > I want to restrict an intercept of equation 2 equal to coefficient of X2 of > equation 1. > Please do not hijack a thread

Re: [R] Integration in R

2012-10-02 Thread Dereje Bacha
Hi I am facing a problem of restricting an intercept of systems of equations.   Y1=f(X1,X2,X3) Y2=(X1,X2,X4)   I want to restrict an intercept of equation 2 equal to coefficient of X2 of equation 1.  Please help Dereje   From: Naser Jamil To: r-help@r-project

Re: [R] Integration in R

2012-10-02 Thread William Dunlap
ginal Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf > Of Berend Hasselman > Sent: Tuesday, October 02, 2012 11:19 AM > To: Rui Barradas > Cc: r-help@r-project.org; Naser Jamil > Subject: Re: [R] Integration in R > > > O

Re: [R] Integration in R

2012-10-02 Thread Rui Barradas
Hello, Em 02-10-2012 19:18, Berend Hasselman escreveu: On 02-10-2012, at 20:01, Rui Barradas wrote: Hello, Yes, it's possible to remove the loop. Since the loop is used to compute a running product and all we want is the final result, use the vectorized behavior of R and a final ?prod(). S

Re: [R] Integration in R

2012-10-02 Thread Berend Hasselman
On 02-10-2012, at 20:01, Rui Barradas wrote: > Hello, > > Yes, it's possible to remove the loop. Since the loop is used to compute a > running product and all we want is the final result, use the vectorized > behavior of R and a final ?prod(). > Seedup: another 2x. And 4x2 == 8 == 1 [decimal]

Re: [R] Integration in R

2012-10-02 Thread Rui Barradas
Hello, Yes, it's possible to remove the loop. Since the loop is used to compute a running product and all we want is the final result, use the vectorized behavior of R and a final ?prod(). Seedup: another 2x. And 4x2 == 8 == 1 [decimal] order of magnitude. lf2 <-function (x) { v<-1 x1

Re: [R] Integration in R

2012-10-02 Thread Berend Hasselman
On 02-10-2012, at 17:23, Naser Jamil wrote: > 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 wa

Re: [R] Integration between R and Microsoft SQL Server?

2012-09-11 Thread Duncan Murdoch
On 12-09-11 3:30 AM, johannes rara wrote: Oracle has its own R integration called Oracle R Enterprise: http://www.oracle.com/technetwork/database/options/advanced-analytics/r-enterprise/index.html Is there a same kind of integration available for Microsoft SQL Server? If there is not, does MS h

Re: [R] Integration of two dimension function

2012-05-17 Thread Petr Savicky
On Thu, May 17, 2012 at 09:43:13PM -0400, li li wrote: > Dear all, >I have a function f <- function(x,y,c){as.numeric(x*y < c) } > I need to solve the value of c so that when I take the integral of > the function f from 0.2 to 0.8 with respect to x and from 0 to 1 > with respect to y, the int

Re: [R] integration

2011-08-28 Thread Uwe Ligges
On 26.08.2011 20:27, . wrote: Hi Ravi, are you saying to apply the idea of a trapezoidal method "again", because I was expecting the integrate() already do it for me. Is not the case? I am also dealing with troubles related to integrate. Just to say, I tried to figure out the problem in Mathe

Re: [R] integration

2011-08-26 Thread .
Hi Ravi, are you saying to apply the idea of a trapezoidal method "again", because I was expecting the integrate() already do it for me. Is not the case? I am also dealing with troubles related to integrate. Just to say, I tried to figure out the problem in Mathematica and it gives me the expecte

Re: [R] integration function

2011-06-26 Thread li li
Peter, Thank you very much! 2011/6/26 Peter Ehlers > On 2011-06-26 06:34, li li wrote: > >> Thank you all for the answering. >> Sorry I did not state the problem clearly. I want to take the >> integration with respect to mu, not x. >> For example, f1 should have been a function of x after integr

Re: [R] integration function

2011-06-26 Thread Peter Ehlers
On 2011-06-26 06:34, li li wrote: Thank you all for the answering. Sorry I did not state the problem clearly. I want to take the integration with respect to mu, not x. For example, f1 should have been a function of x after integrating mu out of f(x, mu) which is the following: f(x, mu)=dnorm(x, m

Re: [R] integration function

2011-06-26 Thread li li
Thank you all for the answering. Sorry I did not state the problem clearly. I want to take the integration with respect to mu, not x. For example, f1 should have been a function of x after integrating mu out of f(x, mu) which is the following: f(x, mu)=dnorm(x, mean=mu, sd=1)*dnorm(mu, mean=2, sd=1

Re: [R] integration function

2011-06-25 Thread Peter Ehlers
On 2011-06-25 08:48, li li wrote: Hi all, Can anyone please take a look at the following two functions. The answer does not seem to be right. Thank you very much! f1<- function(x) {integrand<- function (x, mu){ dnorm(x, mean=mu, sd=1)*dnorm(mu, mean=2, sd=1)

Re: [R] integration

2011-04-11 Thread Ravi Varadhan
han Cc: r-help@r-project.org Subject: Re: [R] integration 'integrate' does not allow parameter limits. For example, the limits of x is (z/y, Inf) while z and y are unkonwn. On Fri, Apr 8, 2011 at 9:46 PM, Ravi Varadhan mailto:rvarad...@jhmi.edu>> wrote: ?integrate _

Re: [R] integration

2011-04-09 Thread cindy Guo
'integrate' does not allow parameter limits. For example, the limits of x is (z/y, Inf) while z and y are unkonwn. On Fri, Apr 8, 2011 at 9:46 PM, Ravi Varadhan wrote: > ?integrate > > > From: r-help-boun...@r-project.org [r-help-boun...@r-project.org] On

Re: [R] integration

2011-04-08 Thread Ravi Varadhan
?integrate From: r-help-boun...@r-project.org [r-help-boun...@r-project.org] On Behalf Of cindy Guo [cindy.g...@gmail.com] Sent: Friday, April 08, 2011 9:21 PM To: r-help@r-project.org Subject: [R] integration Hi, All, I have a density function with 3 v

Re: [R] Integration with variable bounds

2011-03-29 Thread Dmlong21
That works perfectly! Thanks so much. DUSTIN -- View this message in context: http://r.789695.n4.nabble.com/Integration-with-variable-bounds-tp3413606p3416851.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailin

Re: [R] Integration with variable bounds

2011-03-29 Thread Ravi Varadhan
han Date: Tuesday, March 29, 2011 9:13 pm Subject: Re: [R] Integration with variable bounds To: Dmlong21 Cc: r-help@r-project.org > You get 0 because you did not specify lower and upper bounds that > define the hyper-rectangle; therefore, the default is used which is (0,1)^4. > > Specify

Re: [R] Integration with variable bounds

2011-03-29 Thread Ravi Varadhan
Professor, Division of Geriatric Medicine and Gerontology School of Medicine Johns Hopkins University Ph. (410) 502-2619 email: rvarad...@jhmi.edu - Original Message - From: Dmlong21 Date: Tuesday, March 29, 2011 3:11 pm Subject: Re: [R] Integration with variable bounds To: r-help@r

Re: [R] Integration with variable bounds

2011-03-29 Thread Dmlong21
Thanks for the tip but all I get is 0 for the integral. Any other suggestions? int <- function(y){ u2 = y[1] z2 = y[2] u1 =y[3] z1 = y[4] reg.nonzero <- (u2 > z1 & u2 < z2) & (z2 > z1 & z2 < 12) & (u1 > 4 & u1 < z1) & (z1 > 4 & z1 < 12) ff <- ifelse (reg.nonzero, u1*(z1-u1)*u2*(z2-u2)*exp(-0.0

Re: [R] Integration with variable bounds

2011-03-29 Thread Ravi Varadhan
One useful trick is to use the indicator function in your integrand to define regions where the integrand is non-zero. int <- function(y){ u2 = y[1] z2 = y[2] u1 =y[3] z1 = y[4] reg.nonzero <- (u2 > z1 & u2 <= 12) & (z2 > z1 & z2 <= 12) & (u1 > 4 & u1 <= z2) & (u2 > 4 & u2 <= z2) ff <- ifelse

Re: [R] Integration with an Indicator Function in R

2011-02-19 Thread Uwe Ligges
On 17.02.2011 22:10, li li wrote: Hi all, I have some some problem with regard to finding the integral of a function containing an indicator function. please see the code below: func1<- function(x, mu){ (mu^2)*dnorm(x, mean = mu, sd = 1)*dgamma(x, shape=2)} m1star<- function(x){ int

Re: [R] Integration of two lines

2011-01-26 Thread Xavier Robin
Hans W Borchers wrote : > First define a function from those points: > > fx <- approxfun(x, f_x) > fy <- approxfun(y, f_y) > f <- function(x) abs(fx(x)-fy(x)) > > and now you can apply integrate() or trapz(): > > xx <- sort(c(x, y)) > yy <- f(xx) > trapz(xx, yy) > > tra

Re: [R] Integration of two lines

2011-01-25 Thread Xavier Robin
Le 25.01.2011 15:23, Rmh a écrit : > g <- function(x) abs(f1(x)-f2(x)) > > now you have one function and you can integrate it. Thank you Rich. Unfortunately I have no f1 and f2 functions, only a set of observed points on two lines - and no idea about the underlying distribution to create a funct

Re: [R] Integration of two lines

2011-01-25 Thread Hans W Borchers
Xavier Robin unige.ch> writes: > Hello, > > I need to integrate the absolute difference between two lines measured > on different points. > > # For example : > x <- seq(0, 1, 1/100) > f_x <- runif(101) + x > y <- seq(0, 1, 1/23) > f_y <- runif(24) + (1 - y) > > plot(x, f_x, type="l") > lines(y

Re: [R] Integration of two lines

2011-01-25 Thread Rmh
g <- function(x) abs(f1(x)-f2(x)) now you have one function and you can integrate it. Rich Sent from my iPhone On Jan 25, 2011, at 7:32, Xavier Robin wrote: > Hello, > > I need to integrate the absolute difference between two lines measured > on different points. > > # For example : > x <-

Re: [R] Integration in R

2011-01-10 Thread Ravi Varadhan
You are missing basic algebra skills! You had: myfunc<- function(x) {0.25*(9*x^4 + 6*x^2 + 1)} This should be: myfunc<- function(x) {0.25*(9*x^4 - 6*x^2 + 1)} Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medici

Re: [R] integration Sweave and TexMakerX

2011-01-05 Thread Duncan Murdoch
On 05/01/2011 12:04 PM, Sebastián Daza wrote: Hi, Does anyone know how to integrate texmakerx and sweave on Windows? I mean, to run .rnw files directly from texmakerx and get a pdf or dvi file. I don't know texmakerx, but the patchDVI package (on R-forge, see https://r-forge.r-project.org/R/

Re: [R] Integration with LaTex and LyX

2010-12-23 Thread Eduardo de Oliveira Horta
Thanks! On Mon, Dec 13, 2010 at 7:10 PM, Yihui Xie wrote: > I tried hard to write an automagic script to configure LyX so that you > don't need to go to the instructions on CRAN > (http://cran.r-project.org/contrib/extra/lyx/): > > > http://yihui.name/en/2010/10/how-to-start-using-pgfsweave-in-l

Re: [R] Integration with LaTex and LyX

2010-12-13 Thread Yihui Xie
I tried hard to write an automagic script to configure LyX so that you don't need to go to the instructions on CRAN (http://cran.r-project.org/contrib/extra/lyx/): http://yihui.name/en/2010/10/how-to-start-using-pgfsweave-in-lyx-in-one-minute/ This works for LyX 1.6.x and major OS'es with probabi

Re: [R] Integration with LaTex and LyX

2010-12-13 Thread Liviu Andronic
On Mon, Dec 13, 2010 at 4:55 PM, Jonathan P Daily wrote: > ?Sweave > > LyX is a bit harder, although you can probably export LyX docs to a *.tex > and Sweave those fairly painlessly. > LyX can play very nicely with Sweave and R. For the 1.6.x series, you could get started here [1]. If that's not e

Re: [R] Integration with LaTex and LyX

2010-12-13 Thread Jonathan P Daily
?Sweave LyX is a bit harder, although you can probably export LyX docs to a *.tex and Sweave those fairly painlessly. -- Jonathan P. Daily Technician - USGS Leetown Science Center 11649 Leetown Road Kearneysville WV, 25430 (304) 724-4480 "Is the room still a ro

Re: [R] integration of two normal density

2010-06-28 Thread Matt Shotwell
> Genentech Nonclinical Biostatistics > > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf Of bill.venab...@csiro.au > Sent: Friday, June 25, 2010 10:53 PM > To: carrieands...@gmail.com; R-help@r-project.org

Re: [R] integration of two normal density

2010-06-28 Thread Bert Gunter
: Re: [R] integration of two normal density Your intuition is wrong and R is right. Why should the product of two probability density functions be a normalized pdf also? -- as is trivially seen with two uniforms on [0,2], with pdf= 1/2, product = 1/4 on [0,2] . -- Bert -Original Message

Re: [R] integration of two normal density

2010-06-26 Thread Matt Shotwell
On Fri, 2010-06-25 at 23:28 -0400, Carrie Li wrote: > Hello everyone, > > I have a question about integration of two density function > Intuitively, I think the value after integration should be 1, but they are > not. Am I missing something here ? > > > t=function(y){dnorm(y, mean=3)*dnorm(y/2, m

Re: [R] integration of two normal density

2010-06-26 Thread Ravi Varadhan
I sent you a "doubble integration" solution a couple of days ago, that answered your question. You did not have the coureteousy to acknowledge that. Now, you are asking a different question that is "incorrectly" formulated. What you are doing is not "multivariate" integration. You are just i

Re: [R] integration of two normal density

2010-06-25 Thread Bill.Venables
Your intuition is wrong and R is right. Why should the product of two probability density functions be a normalized pdf also? -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Carrie Li Sent: Saturday, 26 June 2010 1:28 PM To: r-he

Re: [R] Integration problem: error in invoking an outside function

2010-06-15 Thread David Winsemius
On Jun 15, 2010, at 9:05 AM, Frankvb wrote: Dear all, Currently I am trying to integrate a function which depends on four variables, two of which are given, one is given in the integrate function, so there is one variable to integrate on. The code is as follows: Pmatrix = function(th) {

Re: [R] Integration problem: error in invoking an outside function

2010-06-15 Thread Ravi Varadhan
Frank, The trouble is that your integrand function `int' is not vectorized. You can use `Vectorize' or `sapply' to rectify this. int.vec = function(theta, s, a, lambda) { sapply(theta, function(t,s,a,lambda) int(t,s,a,lambda), s=s, a=a, lambda=lambda) } integrate(int.vec,lower=0.0001,u

Re: [R] integration function

2010-03-01 Thread Uwe Ligges
On 01.03.2010 17:09, li li wrote: Hi all, I have some problem regarding the integration function. Can any one take a look at the following and give me some help? Thank you in advance! Hannah ## f0 is a function of r,x, and y f0<- function(r, x, y){ pnorm((x-sqrt(r

Re: [R] integration error when I use "optim" and "integrate" simultaneously

2008-04-26 Thread Charles C. Berry
On Sat, 26 Apr 2008, kathie wrote: > > Dear R users, > > When I use two functions, 'optim' and 'integrate', simultaneously, I always > get an error like this > > -- > numint = function(z) { > dlnorm(z,mu[1],sqrt(exp(g[1]

Re: [R] integration

2007-12-18 Thread Ravi Varadhan
Hi Davide, It is difficult to say what the problem is without knowing more about the nature of the integrand. So, you should do a couple of preliminary things before attempting compute the integral. First, is the integral is finite? You should establish this. Second, plot the integrand over