[R] Problem with numerical integration and optimization with BFGS

Ben Bolker bolker at zoo.ufl.edu
Fri May 25 00:44:19 CEST 2007


Deepankar Basu <basu.15 <at> osu.edu> writes:

> 
> 
> For my model, the likelihood function for each observation is the sum of
> three integrals. The integrand in each of these integrals is of the
> following form:
> 
> A*exp(B+C*x-D*x^2)
> 

 (where D is positive)

  Being very lazy, I tried Mathematica's online integrator
(http://integrals.wolfram.com/index.jsp), which says that

                           2
Integrate[Exp[b + c x - d x ], x] == 

      2
 b + c /(4 d)              -c + 2 d x
E             Sqrt[Pi] Erf[----------]
                           2 Sqrt[d]
--------------------------------------
              2 Sqrt[d]

  R knows "Erf" (the error function)
as pnorm -- can you use this to avoid numerical
integration entirely ??



More information about the R-help mailing list