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

[R] Integration of functions with a vector argument

2024-06-12 Thread Levine, Michael
Hello all, I have a question concerning integration of a function of a multivariate argument with respect to one or more variables in r. 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 o

Re: [R] R Integration with SPSS Modeler

2016-12-02 Thread Bert Gunter
Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Fri, Dec 2, 2016 at 8:37 AM, Paul Bernal wrote: > Hello everyone, > > I have installed R version 3.3.2 (64 bit)

[R] R Integration with SPSS Modeler

2016-12-02 Thread Paul Bernal
Hello everyone, I have installed R version 3.3.2 (64 bit) but SPSS Modeler (version 16.0) requires R version 2.15.2 (which is obviously pretty old). Would it cause any problem if I have two different R versions installed in my computer? Can I have both versions 3.3.2 and 2.15.2? Any consideration

Re: [R] R integration with Hive with Kerberos enabled

2016-06-08 Thread Arti Wadhwani
Does anyone have any insight on this? Regards, Arti Wadhwani From: default mailto:awadhw...@hortonworks.com>> Date: Thursday, June 2, 2016 at 1:40 PM To: "r-help@r-project.org<mailto:r-help@r-project.org>" mailto:r-help@r-project.org>> Subject: R integration with Hi

[R] R integration with Hive with Kerberos enabled

2016-06-02 Thread Arti Wadhwani
Hi, I have a question regarding R integration with Hive in kerberized mode. Is it supported? It works fine without kerberos however fails with below error in a kerberized cluster: java.lang.RuntimeException: org.apache.thrift.transport.TTransportException: Peer indicated failure: GSS initiate

[R] R integration with SAP-HANA and SQLScripting

2016-04-12 Thread Griffiths, Michael
Dear R forum, I am seeking relevant material that discusses processes and methods of incorporating R code into SAP-HANA. I would greatly appreciate links to any relevant literature. Background research on my part has only found the SAP-HANA R Integration Guide, and several short examples. If the

[R] Integration using nlsLM ?

2015-06-03 Thread Jeremy Clark
Dear All - I'm trying to integrate the following function via nlsLM - and I think the problem is something to do with passing the correct arguments (error is given below) - any help gratefully appreciated - many thanks. library(minpack.lm) dOM <- function(x, mu = 0, sigma = 1, log = FALSE) {

[R] Hadoop R integration

2015-05-26 Thread Lalitha Kristipati
Hi, I need to showcase how R and Hadoop can work together using ORCH. I have found a sample code from the ORACLE website as follows dfs <- hdfs.attach("ontime_DB") res <- hadoop.run( dfs, mapper = function(key, value) { if (key == 'SFO' & !is.na(x$ARRDELAY)) {

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

[R] Integration of vector syntax unknown

2013-03-22 Thread Benjamin Sabatini
Hello, I'm very new to using R, but I was told it could do what I want. I'm not sure how best to enter the information but here goes... I'm trying to transfer the following integral into R to solve for ln(gamma_1), on the left, for multiple instances of gamma_i and variable N_i. gamma_i is, fo

[R] Integration

2013-02-27 Thread li li
Hi all, I defined the function integrand as follows. library(mnormt) integrand <- function (rho, a, b,z, x, y){ Sigma <- matrix(c(1, rho, rho, 1), 2,2) mu <- rep(0,2) f <- pnorm(c((z-a*x)/b, (z-a*y)/b), mu, Sigma)*dnorm(c(0,0), mu, diag(2)) f

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

[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 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

[R] Integration between R and Microsoft SQL Server?

2012-09-11 Thread johannes rara
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 have any plans to integrate R and SQL Server

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

[R] Integration of two dimension function

2012-05-17 Thread li li
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 integral equal some prefixed value, say 0.025. It involves two dim

[R] Integration methods

2011-08-31 Thread . .
Hi all, I was using integrate to do some integration. Also tried a little bit of the AdaptIntegrate from the cubature package. Is there other functions in R for numerical integration? May be a compound of function for this purpose... __ R-help@r-projec

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)

[R] integration function

2011-06-25 Thread li li
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) } integrate(in

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
-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 variables which is defined on some > irregular domain, an

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

[R] integration

2011-04-08 Thread cindy Guo
Hi, All, I have a density function with 3 variables which is defined on some irregular domain, and I want to get the marginal distribution of each variable. Is there any function doing this? A simple example is p(x,y,z)=x*y*z*I(xy>z). So each marginal distribution is a function of the other two 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
gy School of Medicine Johns Hopkins University Ph. (410) 502-2619 email: rvarad...@jhmi.edu - Original Message - From: Dmlong21 Date: Tuesday, March 29, 2011 3:05 am Subject: [R] Integration with variable bounds To: r-help@r-project.org > If this is posted elsewhere I cannot find

[R] Integration with variable bounds

2011-03-29 Thread Dmlong21
If this is posted elsewhere I cannot find it. I need to perform multiple integration where some of the variables are in the bounds of the other variables. I was trying to use R2Cuba function but cannot set the upper and lower bounds. My code so far is : int <- function(y){ u2 = y[1] z2 = y[2] u

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

[R] Integration with an Indicator Function in R

2011-02-17 Thread li li
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){ integrate(func1, lower = 0, upper = Inf,x)

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 <-

[R] Integration of two lines

2011-01-25 Thread Xavier Robin
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, f_y) Then I would like to compute Integral( | f_x - f_y

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:

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/

[R] integration Sweave and TexMakerX

2011-01-05 Thread Sebastián Daza
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. Thank you in advance, -- Sebastián Daza sebastian.d...@gmail.com __ R-help@r-project.org mailing li

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
ill a room when its empty? Does the room, the thing itself have purpose? Or do we, what's the word... imbue it." - Jubal Early, Firefly r-help-boun...@r-project.org wrote on 12/13/2010 10:27:43 AM: > [image removed] > > [R] Integration with LaTex and LyX > > Edua

[R] Integration with LaTex and LyX

2010-12-13 Thread Eduardo de Oliveira Horta
Hello, Are there any packages which allow for a good integration between R and LaTex / LyX? I'm interested mainly in automatic (automagic?) imports of plots/graphics. Thanks in advance and best regards, Eduardo de Oliveira Horta [[alternative HTML version deleted]]

[R] Integration under Tps

2010-08-08 Thread sam.e
Hi there, After many attempts at trying different methods I have used the Tps package to interpolate between a number of measurements of field data, in this case thickness of a sedimentary deposit. My input values are Longitude, Latitude and Thickness and I have produced a valid contour map base

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
hool of Medicine Johns Hopkins University Ph. (410) 502-2619 email: rvarad...@jhmi.edu - Original Message - From: Carrie Li Date: Friday, June 25, 2010 11:29 pm Subject: [R] integration of two normal density To: r-help > Hello everyone, > > I have a question about integration

Re: [R] integration of two normal density

2010-06-25 Thread Bill.Venables
-help Subject: [R] integration of two normal density 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, me

[R] integration of two normal density

2010-06-25 Thread Carrie Li
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, mean=1.5)} > integrate(t, -Inf, Inf) 0.3568248 with absolute error

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
15, 2010 9:06 AM To: r-help@r-project.org Subject: [R] Integration problem: error in invoking an outside function 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

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

2010-06-15 Thread Frankvb
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) { P = matrix(nrow=6, ncol=6, data=0)

[R] What is happening with SQLite and R integration

2010-05-10 Thread Matt Young
Who is working on it, using it etc. I use both. -- View this message in context: http://r.789695.n4.nabble.com/What-is-happening-with-SQLite-and-R-integration-tp2173219p2173219.html Sent from the R help mailing list archive at Nabble.com. __ R-help

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

[R] integration function

2010-03-01 Thread li li
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)*y)/sqrt(1-r), mean=0,sd=1, lower.tail=

Re: [R] SPSS Statistics-R Integration Plug-In

2009-09-12 Thread Muenchen, Robert A (Bob)
ttp://RforSASandSPSSusers.com, right-hand side. Cheers, Bob -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Michael Chajewski Sent: Tuesday, September 08, 2009 9:43 AM To: r-help@r-project.org Subject: [R] SPSS Statistics-R Integrat

Re: [R] SPSS Statistics-R Integration Plug-In

2009-09-10 Thread Michael Bibo
> . The links are: R Sources -> Windows -> base -> > Previous Releases. The direct link is: http://cran.at.r- > project.org/bin/windows/base/old/ That should of course read "R Binaries -> Windows -> base -> Previous Releases". __ R-help@r-proje

Re: [R] SPSS Statistics-R Integration Plug-In

2009-09-08 Thread Michael Bibo
Michael Chajewski fordham.edu> writes: > > Dear All, > > Has anyone tried to use this plug-in? Since I am running R-2.9.1 it will not even let me install it. Further, > since I am running Windows I cannot use the R provided R-2.7.0 Linux installation file from the archive > (tried to install

[R] SPSS Statistics-R Integration Plug-In

2009-09-08 Thread Michael Chajewski
Dear All, Has anyone tried to use this plug-in? Since I am running R-2.9.1 it will not even let me install it. Further, since I am running Windows I cannot use the R provided R-2.7.0 Linux installation file from the archive (tried to install it through cygwin and it was a mess). Suggestions? Id

[R] integration within maximum likelihood

2008-12-04 Thread Cristian Angelo Guevara
Hi: I'm trying to estimate a latent variable model in mnl discrete choice framework using R. I need to do first a uni dimensional integral within each observation (row) in the database and then sum over observations. I'm stacked in the point shown below. Apparently I have a dimensionality problem

  1   2   >