Dear R-helpers,
I'm looking for a quick way to calculate triple integrals.
I have tried something like this example:
f <- function(x,y,z) dnorm(x)*dnorm(y)*dnorm(z)
llim <- -Inf
ulim <- Inf
integrate(function(z)
{
sapply(z,function(z)
{
integrate(function(y)
{
sapply(y, function(y)
{
integrate(function(x) f(x,y,z), llim, ulim)$value
})
}, llim, ulim)$value
})
},llim,ulim)
I'm not sure if there are other ways faster than this one.
Any help will be appreciated.
Thanks,
L.M.
[[alternative HTML version deleted]]
______________________________________________
[email protected] 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.