Sorry. I meant in the previous email that the function h() is a monotone decreasing function. Thanks very much.
2018-02-06 13:32 GMT-05:00 li li <hannah....@gmail.com>: > Hi all, > The function h below is a function of c and it should be a monotone > increasing function since the integrand is nonnegative and integral is > taken from c to infinity. However, as we can see from the plot, it is not > shown to be monotone. Something wrong with the usage of integrate function? > Thanks so much for your help. > Hanna > > > > h <- function(c){ > g <- function(x){pnorm(x-8.8, mean=0.4, sd=0.3, > lower.tail=TRUE)*dnorm(x, mean=9,sd=0.15)} > integrate(g, lower=c, upper=Inf)$value} > > xx <- seq(-20,20,by=0.001) > y <- xx > for (i in 1:length(xx)){y[i] <- h(xx[i])} > plot(xx, y) > > [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.