On Thu, Mar 22, 2012 at 04:17:20PM -0700, casperyc wrote: > Hi all, > myint=function(mu,sigma){ > integrate(function(x) dnorm(x,mu,sigma)/(1+exp(-x)),-Inf,Inf)$value > } > > mymu=seq(-3,3,length(1000)) > mysigma=seq(0,1,length(500))[-1] > > k=1 > v=c() > for (j in 1:length(mymu)) { > for (i in 1:length(mysigma)) { > v[k]=myint(mymu[j],mysigma[i]) > k=k+1 > } > } > > > Basically, I want to investigate for what values of mu and sigma, the > integral is divergent.
Hi. The function dnorm(x,mu,sigma)/(1+exp(-x)) has a finite integral over (-Inf, Inf) for every mu, sigma. The reason is that dnorm(x,mu,sigma) is nonnegative and 0 < 1/(1+exp(-x)) < 1 So, the integral of dnorm(x,mu,sigma)/(1+exp(-x)) is upper bounded by the integral of dnorm(x,mu,sigma), which is 1. Hope this helps. Petr Savicky. ______________________________________________ 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.