Got it. Thank you very much! library(mnormt) library(cubature) ff <- function(x, rho){ mu <- rep(0,3) Sigma <-(1-rho)*diag(3)+matrix(rho,3,3) f <- dmnorm(x/(1-x^2), mu, Sigma)*((1+x^2)/(1-x^2)^2) f } adaptIntegrate(ff, lower=rep(-1, 3), upper=rep(1,3), rho=0, maxEval=10000)
2013/3/21 Blaser Nello <nbla...@ispm.unibe.ch> > Under ?adaptIntegrate, you will find the link to > http://ab-initio.mit.edu/wiki/index.php/Cubature#Infinite_intervals, > where it says that "Integrals over infinite or semi-infinite intervals is > possible by a change of variables." > > > > -----Original Message----- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf Of li li > Sent: Donnerstag, 21. März 2013 16:10 > To: r-help > Subject: [R] "adaptIntegrate" function > > Hi all, > it seems that there is problem with function "adaptIntegrate", when the > integration limits is infinity. > Please see the code below. The second integration does not seem to work. > Can anyone familiar with this give some help? > Thank you with much. > Hanna > > > library(mnormt) > library(cubature) > > ff <- function(x, rho){ > mu <- rep(0,3) > Sigma <-(1-rho)*diag(3)+matrix(rho,3,3) > f <- dmnorm(x, mu, Sigma) > f > } adaptIntegrate(ff, lower=c(-10, > -10, -10), upper=c(3,2,1), rho=0.1, maxEval=10000) > > adaptIntegrate(ff, lower=rep(-Inf, 3), upper=c(3,2,1), rho=0.1, > maxEval=10000) > > [[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<http://www.r-project.org/posting-guide.html> > and provide commented, minimal, self-contained, reproducible code. > > > [[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.