# Integrating a function over a random effect (Normal distribution)

I would like to integrate a function with a random effect. The function is :

$$G(t; \beta) = exp(- \lambda t^\gamma \exp(\beta Z))$$,

$$\beta$$ being the random effect taken from a normal distribution of mean 0 and variance $$\sigma$$. The solution would be to make a double integration, first on $$t$$ and then over the distribution of the random effect.

But, I don't know ho to do in practice ! I am ready to use Monte-Carlo integration, I just need to calculate the area under the curve.

Any suggestion ?

Thanks a lot !

• So you want $\int_0^\infty dt\int_{\Bbb R}d\beta G(t;\,\beta)f(\beta)$, with $f$ the pdf of $\beta$? – J.G. Jan 24 at 13:38
• Yes ! The integration on $dt$ should be done first, and then on $d\beta$ – Flora Grappelli Jan 24 at 13:43

Define $$K:=\lambda\exp\beta Z$$ so $$G=\exp -Kt^\gamma$$ and $$\int_0^\infty Gdt=\frac{1}{\gamma}\Gamma\left(\frac{1}{\gamma}\right)K^{-1/\gamma}$$. Next integrate out the $$\beta$$ dependence, viz. $$\int_{\Bbb R}\frac{1}{\sigma\sqrt{2\pi}}\exp\left(-\frac{\beta^2}{2\sigma^2}-\frac{Z}{\gamma}\beta\right)\cdot\frac{1}{\gamma}\Gamma\left(\frac{1}{\gamma}\right)\lambda^{-1/\gamma}d\beta=\frac{1}{\gamma}\Gamma\left(\frac{1}{\gamma}\right)\lambda^{-1/\gamma}\exp\frac{(Z\sigma)^2}{2\gamma^2}.$$
• Thanks a lot for your suggestion. Does it change anything if in the first step, I need the integral of $G$ between 0 and a constant $\tau$ such as $\int_0^{\tau} G dt$ ? – Flora Grappelli Jan 24 at 13:55
• @FloraGrappelli It must, yes, if only because when $\tau=0$ we get $0$. More generally, your generalised problem would return some smooth function of $\tau$ that merges the two extreme cases. – J.G. Jan 24 at 13:58
• Hello, in fact when I want to integrate the first part over $[0,\tau]$ rather than on $[0, \infty]$, I have a problem : $\beta$ is present in the gamma function (in the second parameter) ! The integral is $-\frac{K^{-\frac{1}{\gamma}}}{\gamma} \Gamma ( \frac{1}{\gamma}, K t^\gamma)$. In this case, how can I do to then integrate out the $\beta$ dependence ? – Flora Grappelli Jan 24 at 20:12