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
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.