Dear R helpers I am working on the Bi-variate Normal distribution probabilities. I need to double integrate the following function (actually simplified form of bivariate normal distribution) f(x, y) = exp [ - 0.549451 * (x^2 + y^2 - 0.6 * x * y) ] where 2.696 < x < 3.54 and -1.51 < y < 1.98 I need to solve something like INTEGRATE (2.696 to 3.54) dx INTEGRATE [(-1.51 to 1.98)] f(x, y) dy I have referred to stats::integrate but it deals with only one variable. This example appears in Internal Credit Risk Model by Michael Ong (page no. 160). Kindly guide. Regards Sarah [[alternative HTML version deleted]]
On Jul 1, 2010, at 8:30 AM, Sarah Sanchez wrote:> Dear R helpers > > I am working on the Bi-variate Normal distribution probabilities. I > need to double integrate the following function (actually simplified > form of bivariate normal distribution) > > f(x, y) = exp [ - 0.549451 * (x^2 + y^2 - 0.6 * x * y) ] > > where 2.696 < x < 3.54 and -1.51 < y < 1.98 > > I need to solve something like > > > INTEGRATE (2.696 to 3.54) dx INTEGRATE [(-1.51 to 1.98)] f(x, y) dy > > I have referred to stats::integrate but it deals with only one > variable.I find the latest version of RSiteSearch to be poorly configured for searching r-help, so I have constructed a different set of defaults that include the rhelp archive in the searches. rhelpSearch <- function(string, restrict = c("Rhelp10", "Rhelp08", "Rhelp02", "functions" ), matchesPerPage = 100, ...) RSiteSearch(string=string, restrict = restrict, matchesPerPage = matchesPerPage, ...) rhelpSearch("double integra*") 241 hits -- David Winsemius, MD West Hartford, CT
Sarah Sanchez <sarah_sanchez09 <at> yahoo.com> writes:> > Dear R helpers > > I am working on the Bi-variate Normal distribution probabilities. > I need to double integrate the following function > (actually simplified form of bivariate normal distribution) > > f(x, y) = exp [ - 0.549451 * (x^2 + y^2 - 0.6 * x * y) ] > > where 2.696 < x < 3.54 and -1.51 < y < 1.98 > > I need to solve something like > > INTEGRATE (2.696 to 3.54) dx INTEGRATE [(-1.51 to 1.98)] f(x, y) dy > > I have referred to stats::integrate but it deals with only one variable. > > This example appears in Internal Credit Risk Model by Michael Ong > (page no. 160).There has been the same request last month, the answer is still valid: library(cubature) fun <- function(x) exp(-0.549451*(x[1]^2+x[2]^2-0.6*x[1]*x[2])) adaptIntegrate(fun, c(-1.51,1.98), c(2.696,3.54), tol=1e-8) # $integral # [1] 0.1376102 # $error # [1] 1.372980e-09 # ... Hans Werner> > Kindly guide. > > Regards > > Sarah >
Function adapt in package integrate maybe?> Date: Thu, 1 Jul 2010 05:30:25 -0700 > From: sarah_sanchez09@yahoo.com > To: r-help@r-project.org > Subject: [R] Double Integration > > Dear R helpers > > I am working on the Bi-variate Normal distribution probabilities. I need to double integrate the following function (actually simplified form of bivariate normal distribution) > > f(x, y) = exp [ - 0.549451 * (x^2 + y^2 - 0.6 * x * y) ] > > where 2.696 < x < 3.54 and -1.51 < y < 1.98 > > I need to solve something like > > > INTEGRATE (2.696 to 3.54) dx INTEGRATE [(-1.51 to 1.98)] f(x, y) dy > > I have referred to stats::integrate but it deals with only one variable. > > This example appears in Internal Credit Risk Model by Michael Ong (page no. 160). > > Kindly guide. > > Regards > > Sarah > > > > > > > [[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._________________________________________________________________ Hotmail: Trusted email with powerful SPAM protection. [[alternative HTML version deleted]]