(- (B[1] + B[2] * (x + u * dnorm(u,
0, sem1), -Inf, Inf)$value, MoreArgs = list(B, x, sem1))
-Original Message-
From: David 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
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 functions, but often avoid mapply() as I find it so non-
intuitive
help; David L Carlson; David Winsemius
Subject: Re: [R] Vectorizing integrate()
Hi,
Using David's function:
fun - function(u, m, s) 1/ (1 + exp(- (B[1] + B[2] *
(m + u * dnorm(u, 0, s)
res-mapply(function(i) integrate(fun,-
Inf,Inf,m=x[i],s=sem1[i])$value,1:nrow(X))
res
# [1
]
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 IRLS. In one step, I need to integrate
-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 David's function:
fun - function(u, m, s) 1/ (1 + exp(- (B[1] + B[2
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:rqcasestudys=compiler;.
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
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),
+
, 2012 11:54 AM
Subject: RE: [R] Vectorizing integrate()
Must be a cut and paste issue. All three agree on the results but they are
different from those in arun's message:
B - c(0,1)
sem1 = runif(10, 1, 2)
x - rnorm(10)
X - cbind(1, x)
eta - numeric(10)
for(j in 1:nrow(X)){
+ fun - function(u
0.4740685 0.7576587
identical(res,eta)
#[1] TRUE
A.K.
- Original Message -
From: Doran, Harold hdo...@air.org
To: David Winsemius dwinsem...@comcast.net
Cc: r-help@r-project.org r-help@r-project.org
Sent: Friday, December 7, 2012 10:14 AM
Subject: Re: [R] Vectorizing integrate()
David et al
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
: David L Carlson dcarl...@tamu.edu
To: 'arun' smartpink...@yahoo.com; 'Doran, Harold' hdo...@air.org
Cc: 'R help' r-help@r-project.org; 'David Winsemius'
dwinsem...@comcast.net
Sent: Friday, December 7, 2012 11:54 AM
Subject: RE: [R] Vectorizing integrate()
Must be a cut and paste issue
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
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 to
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 IRLS. In one step, I need to integrate something out of
the linear
15 matches
Mail list logo