Hello, everyone,

I have a question about integration of product of two densities.
Here is the sample code; however the mean of first density is a function of
another random variable, which is to be integrated.

##
f=function(x) {dmvnorm(c(0.6, 0.8), mean=c(0.75, 0.75/x))*dnorm(x, mean=0.6,
sd=0.15)}
integrate(f, lower=-Inf, upper=Inf)

## error message
Error in dmvnorm(c(0.6, 0.8), mean = c(0.75, 0.75/x)) :
  mean and sigma have non-conforming size

I think it's because the mean in dmvnorm is a function of x....

is there any package or function to handle this question ?

Thanks for any help!

Carrie

        [[alternative HTML version deleted]]

______________________________________________
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.

Reply via email to