[R] how to use quadrature to integrate some complicated functions
R. Michael Weylandt
michael.weylandt at gmail.com
Tue Nov 8 20:14:05 CET 2011
It's polite to include the whole list in your replies so the threads
get archived properly.
Yes, underflow is occasionally a problem: hence the common use of
log-likelihood in MLE and other applications. Might that help you out
here? You can get log-likelihoods directly from pnorm and dnorm with
the log = TRUE option.
On Tue, Nov 8, 2011 at 11:35 AM, Zuofeng Shang <Zuofeng.Shang.5 at nd.edu> wrote:
> Hi Michael , Thanks for your suggestion!
> Integrate() possibly workx for my problem. However my function is a product
> a sequence with values between zero and one, which could be extremely small
> when the length of the sequence is large. Note: my integrand is like
> So when "n" is very small, the above product will be very close to zero.
> So my concern is whether integrate() can handle accurately such integrand.
> Thanks a lot for your time!
> Best wishes,
> 于 2011/11/8 8:43, R. Michael Weylandt <michael.weylandt at gmail.com> 写道:
>> Have you tried wrapping it in a function and using integrate()? R is
>> pretty good at handling numerical integration. If integrate() isn't good for
>> you, can you say more as to why?
>> On Nov 6, 2011, at 4:15 PM, JeffND<Zuofeng.Shang.5 at nd.edu> wrote:
>>> Hello to all,
>>> I am having trouble with intregrating a complicated uni-dimensional
>>> of the following form
>>> Here n is about 5000, Phi is the cumulative distribution function of
>>> standard normal,
>>> phi is the density function of standard normal, and x ranges over
>>> My idea is to to use quadrature to handle this integral. But since Phi
>>> not cloaed form,
>>> I don't know how to do this effeciently. I appreciate very much if
>>> has any ideas about it.
>>> View this message in context:
>>> Sent from the R help mailing list archive at Nabble.com.
>>> R-help at r-project.org mailing list
>>> PLEASE do read the posting guide
>>> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help