Hi all,
   Can anyone please take a look at the following two functions.
The answer does not seem to be right.
   Thank you very much!

f1 <- function(x)

    {integrand <- function (x, mu){

    dnorm(x, mean=mu, sd=1)*dnorm(mu, mean=2, sd=1)

                                   }

    integrate(integrand, -Inf, Inf,x)$val

    }


f2 <- function(x)

    {integrand <- function (x, mu){

    dnorm(x, mean=mu, sd=1)*mu^2*dnorm(mu, mean=2, sd=1)

                                   }

    integrate(integrand, -Inf, Inf,x)$val

    }

	[[alternative HTML version deleted]]

