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

[R] Integration in R

2013-01-08 Thread Naser Jamil
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 0https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-p

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

[R] Integration in R

2012-11-21 Thread Rehena Sultana
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 other data. As I understand, when I am int

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
-project.org Sent: Tuesday, October 2, 2012 10:23 AM Subject: [R] 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 wonderin

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

[R] Integration in R

2012-10-02 Thread Naser Jamil
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 prov

Re: [R] Integration in R

2011-01-10 Thread Ravi Varadhan
ct.org Subject: [R] Integration in R Dear all, It has been ages since I studied integration in college. Right now I try to recover all this kind of knowledge and then try to understand how integration works. Thus I am doing some first 'experiments' and I would like to request your h

[R] Integration in R

2011-01-10 Thread Alaios
Dear all, It has been ages since I studied integration in college. Right now I try to recover all this kind of knowledge and then try to understand how integration works. Thus I am doing some first 'experiments' and I would like to request your help and comments. I have the function: