[R] Integration of mixed normal distribution

David Winsemius dwinsemius at comcast.net
Thu Jan 31 01:57:58 CET 2013


On Jan 30, 2013, at 4:19 AM, Johannes Radinger wrote:

> Hi,
>
> I already found a conversation on the integration of a normal
> distribution and two
> suggested solutions
> (https://stat.ethz.ch/pipermail/r-help/2007-January/124008.html):
>
> 1) integrate(dnorm, 0,1, mean = 0, sd = 1.2)
>
> and
>
> 2) pnorm(1, mean = 0, sd = 1.2) - pnorm(0, mean = 0, sd = 1.2)
>
> where the pnorm-approach is supposed to be faster and with higher  
> precision.
>
> I want to integrate a mixed normal distribution like:
> normaldistr_1 * p + normaldistr_2 * (1-p)

I think if you check any calculus text you will find a theorem stating  
that

integral( a*f(x) + b*g(x) ) = a*integral(f(x)) + b*integral(g(x))
>
> where p is between 0 and 1 and the means for both distributions are 0
> but the standard deviations differ.
>
> In addition, I want to get the integrals from x to infinity or from -
> infinity to x for
> the mixed distribution.
>
> Can that be done with high precision in R and if yes how?

The application to this problem seems straightforward. The fact that  
you are using the range of -Inf to x should make the calculations  
easier.

-- 
David Winsemius, MD
Alameda, CA, USA



More information about the R-help mailing list