# Re: [R] integration of two normal density

From: Matt Shotwell <shotwelm_at_musc.edu>
Date: Mon, 28 Jun 2010 12:47:21 -0400

Isn't it equally trivial to demonstrate that the product of two pdfs _may_ be a normalized pdf? For example, the uniform (0,1) pdf:

f(x) = 1 for x in (0, 1), and 0 otherwise

Hence, g(x) = f(x)*f(x) = 1 for x in (0, 1), and 0 otherwise _is_ a normalized pdf.

But this is a little silly. Rather than memorize answers to questions like "is the product of pdfs also a pdf?", we ought to be confident in the properties of pdfs (i.e. not the answers, but the means to arrive at answers).

On Mon, 2010-06-28 at 11:42 -0400, Bert Gunter wrote:
> 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
> and provide commented, minimal, self-contained, reproducible code.
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> and provide commented, minimal, self-contained, reproducible code.
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> and provide commented, minimal, self-contained, reproducible code.

```--
Matthew S. Shotwell
Division of Biostatistics and Epidemiology
Medical University of South Carolina
http://biostatmatt.com

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
and provide commented, minimal, self-contained, reproducible code.
```
Received on Mon 28 Jun 2010 - 16:49:46 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 28 Jun 2010 - 17:40:43 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.