[R] Vectorizing integrate()

2012-12-06 Thread Doran, Harold
I have written a program to solve a particular logistic regression problem using IRLS. In one step, I need to integrate something out of the linear predictor. The way I'm doing it now is within a loop and it is as you would expect slow to process, especially inside an iterative algorithm. I'm h

Re: [R] Vectorizing integrate()

2012-12-06 Thread David Winsemius
On Dec 6, 2012, at 10:10 AM, Doran, Harold wrote: > I have written a program to solve a particular logistic regression problem > using IRLS. In one step, I need to integrate something out of the linear > predictor. The way I'm doing it now is within a loop and it is as you would > expect slow

Re: [R] Vectorizing integrate()

2012-12-06 Thread David L Carlson
half Of David Winsemius > Sent: Thursday, December 06, 2012 12:59 PM > To: Doran, Harold > Cc: r-help@r-project.org > Subject: Re: [R] Vectorizing integrate() > > > On Dec 6, 2012, at 10:10 AM, Doran, Harold wrote: > > > I have written a program to solve a parti

Re: [R] Vectorizing integrate()

2012-12-07 Thread Doran, Harold
r-help@r-project.org > Subject: Re: [R] Vectorizing integrate() > > > On Dec 6, 2012, at 10:10 AM, Doran, Harold wrote: > > > I have written a program to solve a particular logistic regression problem > using IRLS. In one step, I need to integrate something out of the linear

Re: [R] Vectorizing integrate()

2012-12-07 Thread David L Carlson
ject.org] On Behalf Of Doran, Harold > Sent: Friday, December 07, 2012 9:14 AM > To: David Winsemius > Cc: r-help@r-project.org > Subject: Re: [R] Vectorizing integrate() > > David et al > > Thanks, I should have made the post more complete. I routinely use > apply

Re: [R] Vectorizing integrate()

2012-12-07 Thread David L Carlson
arun [mailto:smartpink...@yahoo.com] > Sent: Friday, December 07, 2012 10:36 AM > To: Doran, Harold > Cc: R help; David L Carlson; David Winsemius > Subject: Re: [R] Vectorizing integrate() > > > > Hi, > Using David's function: > fun <- function(u, m, s) 1/ (1

Re: [R] Vectorizing integrate()

2012-12-07 Thread David Winsemius
id Winsemius [mailto:dwinsem...@comcast.net] Sent: Thursday, December 06, 2012 1:59 PM To: Doran, Harold Cc: r-help@r-project.org Subject: Re: [R] Vectorizing integrate() On Dec 6, 2012, at 10:10 AM, Doran, Harold wrote: I have written a program to solve a particular logistic regression problem using

Re: [R] Vectorizing integrate()

2012-12-07 Thread Spencer Graves
65210 0.2378657 0.3492133 identical(eta, res) [1] TRUE --- David C -Original Message- From: arun [mailto:smartpink...@yahoo.com] Sent: Friday, December 07, 2012 10:36 AM To: Doran, Harold Cc: R help; David L Carlson; David Winsemius Subject: Re: [R] Vectorizing integrate() Hi, Using Dav

Re: [R] Vectorizing integrate()

2012-12-07 Thread Berend Hasselman
On 07-12-2012, at 18:12, Spencer Graves wrote: > Has anyone suggested using the byte code compiler "compiler" package? > An analysis by John Nash suggested to me that it may be roughly equivalent to > vectorization; see > "http://rwiki.sciviews.org/doku.php?id=tips:rqcasestudy&s=compile

Re: [R] Vectorizing integrate()

2012-12-07 Thread Spencer Graves
On 12/7/2012 9:40 AM, Berend Hasselman wrote: On 07-12-2012, at 18:12, Spencer Graves wrote: Has anyone suggested using the byte code compiler "compiler" package? An analysis by John Nash suggested to me that it may be roughly equivalent to vectorization; see "http://rwiki.sciviews.or

Re: [R] Vectorizing integrate()

2012-12-07 Thread Berend Hasselman
On 07-12-2012, at 19:37, Spencer Graves wrote: > On 12/7/2012 9:40 AM, Berend Hasselman wrote: >>> >>> benchmark(eta1 <- f1(X, B, x, sem1), eta2 <- f2(X, B, x, sem1), eta3 <- >>> f3(X, B, x, sem1), >> + eta4 <- f4(X, B, x, sem1), eta5 <- f5(X, B, x, sem1), eta6 <- >> f6(X, B, x, sem1

Re: [R] Vectorizing integrate()

2012-12-07 Thread arun
HI, I can see ?runif(), ?rnorm() without a set seed. A.K. - Original Message - From: David L Carlson To: 'arun' ; "'Doran, Harold'" Cc: 'R help' ; 'David Winsemius' Sent: Friday, December 7, 2012 11:54 AM Subject: RE: [R] Vectorizi

Re: [R] Vectorizing integrate()

2012-12-07 Thread arun
] 0.7531899 0.4740685 0.7576587 identical(res,eta) #[1] TRUE A.K. - Original Message - From: "Doran, Harold" To: David Winsemius Cc: "r-help@r-project.org" Sent: Friday, December 7, 2012 10:14 AM Subject: Re: [R] Vectorizing integrate() David et al Thanks, I

Re: [R] Vectorizing integrate()

2012-12-07 Thread Prof J C Nash (U30A)
I found mixed (and not always easy to predict) results from the byte-code compiler. It seems necessary to test whether it helps. On some calculations, it is definitely worthwhile. JN On 12-12-07 01:57 PM, Berend Hasselman wrote: On 07-12-2012, at 19:37, Spencer Graves wrote: On 12/7/2012

Re: [R] Vectorizing integrate()

2012-12-07 Thread Berend Hasselman
ions stay the same. The compiled versions f2, f6 are the quickest. Berend > A.K. > > - Original Message - > From: David L Carlson > To: 'arun' ; "'Doran, Harold'" > Cc: 'R help' ; 'David Winsemius' > > Sent: Friday, Decembe