Re: [R] Generalizing call to function

2011-09-07 Thread Berend Hasselman
. wrote: > > Hello guys, > > I would like to ask for help to understand what is going on in > "func2". My plan is to generalize "func1", so that are expected same > results in "func2" as in "func1". Executing "func1" returns... > > 0.25 with absolute error < 8.4e-05 > > But for "func2" I get..

Re: [R] Generalizing call to function

2011-09-07 Thread Jean V Adams
Try this: funa <- function(n, y, a, rate, samp) { lambda <- a * n dexp(n, rate) * do.call(paste("d", samp, sep=""), y, lambda) } funb <- function(y, a, rate, samp) { integrate(f1, 0, Inf, y, a, rate) } funb(1, 0.1, 0.1, "pois") Jean > > Hello guy

[R] Generalizing call to function

2011-09-06 Thread . .
Hello guys, I would like to ask for help to understand what is going on in "func2". My plan is to generalize "func1", so that are expected same results in "func2" as in "func1". Executing "func1" returns... 0.25 with absolute error < 8.4e-05 But for "func2" I get... Error in dpois(1, 0.1, 23.30