# How to find the expectation $\mathbb{E}\left[ a \mathcal{Q} \left( \sqrt{b } \gamma \right) \right]$?

I'm trying to find the following expectation

$$\mathbb{E}\left[ a \mathcal{Q} \left( \sqrt{b } \gamma \right) \right],$$ where $$a$$ and $$b$$ are constant values, $$\mathcal{Q}$$ is the Gaussian Q-function, which is defined as $$\mathcal{Q}(x) = \frac{1}{2 \pi}\int_{x}^{\infty} e^{-u^2/2}du$$ and $$\gamma$$ is a random variable with Gamma distribition, i.e., $$f_{\gamma}(y) \sim \frac{1}{\Gamma(\kappa)\theta^{\kappa}} y^{\kappa-1} e^{-y/\theta}$$.

I have tried to solve that with Mathematica, however, it says it does not converge.

• Define: q[x_] := 1/(2 π) Integrate[Exp[-u^2/2], {u, x, ∞}] G = GammaDistribution[α, β, γ, μ]; gpdf = PDF[G, g];. Then Expectation[a q[Sqrt[b] g], g \[Distributed] G] , but this will not work, neither will Integrate[a q[Sqrt[b] g]*gpdf, {g, 0,∞}]. It's too complicated for Mathematica - however if you have values for the gamma distribution parameters, then this is quite easy even with unknown constants a,b. Commented Jul 20, 2020 at 1:52

It's not too hard to set this up. I had no luck with the more complex four parameter GammaDistribution but fortunately you only mentioned the two parameter version:

q[x_] = 1/(2 π) Integrate[Exp[-u^2/2], {u, x, ∞}]
gpdf = PDF[G, y]
result = a*Expectation[q[Sqrt[b] y], y \[Distributed] G]


Result:

2^(-3 - κ/2) a b^(-(1/2) - κ/
2) θ^(-1 - κ) (2 Sqrt[2] Sqrt[
b] θ HypergeometricPFQRegularized[{(1 + κ)/
2, κ/2}, {1/2, (2 + κ)/2}, 1/(
2 b θ^2)] - κ HypergeometricPFQRegularized[{(
1 + κ)/2, (2 + κ)/2}, {3/2, (3 + κ)/2}, 1/(
2 b θ^2)])


Let's do a quick check to make sure it returned something reasonable. We'll generate some gamma distributed random numbers, apply the function and get the mean. Then also use these constants with our result obtained earlier to confirm it's a close match to this numerical experiment:

qn[x_?NumericQ] := 1/(2 π) NIntegrate[Exp[-u^2/2], {u, x, ∞}]
With[{κ = 1, θ = 2, a = 4, b = 3},
Mean[a*qn[Sqrt[b]*#] & /@ rands]
]
(* result: 0.155478 *)

N[result /. {κ -> 1, θ -> 2, a -> 4, b -> 3}]
(* result: 0.15502 *)


Your version of the Q-function has 1/(2 π). I think this should be 1/Sqrt[2 π] instead. In which case the result changes:

q[x_] = 1/Sqrt[2 π] Integrate[Exp[-u^2/2], {u, x, ∞}]
gpdf = PDF[G, y]
result = a*Expectation[q[Sqrt[b] y], y \[Distributed] G]


Result:

2^(-(5/2) - κ/2) a b^(-(1/2) - κ/
2) Sqrt[π] θ^(-1 - κ) (2 Sqrt[2] Sqrt[
b] θ HypergeometricPFQRegularized[{(1 + κ)/
2, κ/2}, {1/2, (2 + κ)/2}, 1/(
2 b θ^2)] - κ HypergeometricPFQRegularized[{(
1 + κ)/2, (2 + κ)/2}, {3/2, (3 + κ)/2}, 1/(
2 b θ^2)])

• +1. Also, dist = TransformedDistribution[a q[Sqrt[b] y], y \[Distributed] GammaDistribution[\[Kappa], \[Theta]]]; Mean[dist]] works, too.
– JimB
Commented Jul 20, 2020 at 3:27
• +1 Recommend that the definition of q use Set rather than SetDelayed so that the integral is only done once. Also, in the check with random variates you can use q rather than qn. Commented Jul 20, 2020 at 3:50
• For whatever it's worth: $q(x)=\frac{\text{erfc}\left(\frac{x}{\sqrt{2}}\right)}{2 \sqrt{2 \pi }}$.
– JimB
Commented Jul 20, 2020 at 4:11