[R] integration of two normal density

Bert Gunter gunter.berton at gene.com
Mon Jun 28 17:42:51 CEST 2010


Inline Below

Bert Gunter
Genentech Nonclinical Biostatistics
 
 -----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of Bill.Venables at csiro.au
Sent: Friday, June 25, 2010 10:53 PM
To: carrieandstat at gmail.com; R-help at r-project.org
Subject: Re: [R] integration of two normal density

Your intuition is wrong and R is right.

Why should the product of two probability density functions be a normalized
pdf also? 

-- as is trivially seen with two uniforms on [0,2], with pdf= 1/2, product =
1/4 on [0,2] . 

-- Bert

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of Carrie Li
Sent: Saturday, 26 June 2010 1:28 PM
To: r-help
Subject: [R] integration of two normal density

Hello everyone,

I have a question about integration of two density function
Intuitively, I think the value after integration should be 1, but they are
not. Am I missing something here ?

> t <- function(y){dnorm(y, mean=3)*dnorm(y/2, mean=1.5)}
> integrate(t, -Inf, Inf)
0.3568248 with absolute error < 4.9e-06


Also, is there any R function or package could do multivariate integration ?

Thanks for any suggestions!

Carrie

	[[alternative HTML version deleted]]

______________________________________________
R-help at 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.

______________________________________________
R-help at 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.



More information about the R-help mailing list