[R] Multiple Integrals
Luísa Freitas
luisamrfreitas at gmail.com
Thu Jan 7 01:03:38 CET 2016
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]]
More information about the R-help
mailing list