I would like to integrate a function with two random effects, implying three successive integrations. My problem is that after the first integration, it is not possible to obtain an analytical solution for the second integration, making impossible the third integration, even numerically (Monte-Carlo integration). What can I do ? I desperatly need a solution !

The function I need to integrate is $G(t; \beta_1, \beta_2)$ (below) first on $t$ between $[0;t^*]$, $t^*$ being a pre-specified constant such as $t^*>0$. We then need to integrate the expression we have obtained twice on $\Bbb R$: first, on the distribution of $\beta_1$ and secondly, on the distribution of $\beta_2$.

In practice :

$G(t; \beta_1, \beta_2) = \exp(- \lambda t^\gamma \exp(\beta_1 +\beta_2 Z))$,

The $\beta$'s are the random effects taken from normal distributions of mean 0 and variance $\sigma$, and mean $\mu$ and variance $\nu$, respectively.

The first integral is :

$\int_0^{t^*} G \ dt=\left[\frac{1}{\gamma}\Gamma\left(\frac{1}{\gamma}, \lambda\exp\beta Z t^\gamma \right)(\lambda\exp\beta Z)^{-1/\gamma}\right]_0^{t^*}$

Then, I need to integrate it twice over the two normal distributions of the $\beta$'s.

Which numerical algorithm may I use to obtain the area under the curve of $G(t; \beta_1, \beta_2)$, knowing we have specific values for $t^*$, $\lambda$, $\gamma$, $\sigma$, $\mu$ and $\nu$ ?

Thanks for any help !


There may be algorithms for nD integration that are more efficient, but you can integrate a 2D or 3D function numerically using Simpson's rule.

Suppose you want $$I = \int_a^b\int_{c(x)}^{d(x)}\int_{e(x,y)}^{f(x,y)}g(x,y,z)dzdydx$$

Well, if you regard $$\int_{c(x)}^{d(x)}\int_{e(x,y)}^{f(x,y)}g(x,y,z)dzdy$$ as a function $h(x)$, then to find $I$, you can use Simpson't rule to integrate $h(x)$ from $a$ to $b$. Simpson's rule requires you to evaluate $h(x)$, which is an integral - but you can evaluate the integral using Simpson's rule in the same way.

Note that the time this needs blows up exponentially with the number of dimensions.

  • $\begingroup$ thanks a lot ! So in my case, would you advice me to integrate the function $K(\beta_1, \beta_2) = \int_0^{t^*} G \ dt $ using Simpson's rule ? I am not sure to have understood what to do in practice, since $K(\beta_1, \beta_2) $ should be integrated in a Normal distribution. $\endgroup$ – Flora Grappelli Jan 25 '19 at 8:35
  • 1
    $\begingroup$ By "integrate f in a normal distribution", I take it you mean $\int\int f(x,y) \frac{1}{2\pi}e^{-(x^2+y^2)/2}dxdy$, no? in that case your integrand isn't $f$, but $f$ times the pdf of the gaussian, but it's still just an integral $\endgroup$ – Michael Hartley Jan 27 '19 at 1:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.