[R] integration of two normal density
Ravi Varadhan
rvaradhan at jhmi.edu
Sat Jun 26 15:27:40 CEST 2010
I sent you a "doubble integration" solution a couple of days ago, that answered your question. You did not have the coureteousy to acknowledge that. Now, you are asking a different question that is "incorrectly" formulated. What you are doing is not "multivariate" integration. You are just integrating a univariate function, which as Prof. Venables pointed out, is not even a density.
Ravi.
____________________________________________________________________
Ravi Varadhan, Ph.D.
Assistant Professor,
Division of Geriatric Medicine and Gerontology
School of Medicine
Johns Hopkins University
Ph. (410) 502-2619
email: rvaradhan at jhmi.edu
----- Original Message -----
From: Carrie Li <carrieandstat at gmail.com>
Date: Friday, June 25, 2010 11:29 pm
Subject: [R] integration of two normal density
To: r-help <R-help at r-project.org>
> 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
>
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list