# How can I evaluate a certain probability density function?

The PDF of a random variable $X$ is given by

Note that $H(t)$ is also a function of $x$. Here $-\infty<\mu<\infty$, $\lambda>=0$ and $m>=1/2$

Let $I$ be a function of random variable $Y$.

I need to evaluate

$\exp\left(-\mathbb{E}[I]\right)$

How do I do it? I tried the following:

Lets say $N=10$ and $T$ and $W$ vectors are given by

Am I doing it right.?

• What have you tried? Please provide copy-paste-able Mathematica code in your question so that you have higher chances to receive help. Right now this looks like “do this for me, although I haven't tried anything“. Nevertheless, NIntegrate should be useful... – Lukas May 1 '16 at 9:17
• Integrate will work, too. Look up Sum and/or Dot for the summation. – Michael E2 May 1 '16 at 11:36
• @MichaelE2, Thanks for your comment. Please havea look at the edit. How to express the multiplication in the summation? – Srestha Narayanan May 1 '16 at 11:54
• f[x_] := 2*m^m*x^(2*m - 1)/(Sqrt[\[Pi]]*Gamma[m])*W.(H /@ T) Also, TransformedDistribution outputs a distribution not a PDF. You cannot reuse f as the name of a second function. The PDF would be pdfY[y_]:=PDF[dist, y]. You need to add some assumptions/constraints on parameters and x to evaluate the integral. – Bob Hanlon May 1 '16 at 15:42
• @BobHanlon, Thank you very much for your very useful comment. I have edited my MMA code. Is it okay now? – Srestha Narayanan May 1 '16 at 16:01

It is certainly not required but usually one writes a weighted sum of probability density functions where the sum of the weights equals 1. In your example the sum of the weights is $\sqrt{\pi}$. One can rewrite the pdf of $X$ as

$$f_X(x)={{2m^m x^{2m-1}}\over{\Gamma(m)}}\sum_{i=1}^n w_i h(t_i)$$

with $\sum_{i=1}^n w_i=1$. This makes it more explicit that each of the weighted pdf's is indeed a legitimate pdf:

$$\int_{0}^{\infty}{{2m^m x^{2m-1}}\over{\Gamma(m)}}h(t_i)dx=1$$

As a check here is the Mathematica code:

g[x_] := (2 m^m x^(2 m - 1)/Gamma[m])
Exp[-m (2^(1/2) λ t + μ + x^2 Exp[-2^(1/2) λ t - μ]) ]

Integrate[g[x], {x, 0, ∞}, Assumptions -> {a > 0, t ∈ Reals, λ > 0, μ > 0, m > 1/2}]
(* 1 *)


Because we have a weighted sum of nice pdf's we can write

$$\int_{\sqrt{a}}^{\infty}f_X(x)dx=\sum_{i=1}^{n}w_i \int_{\sqrt{a}}^{\infty}{{2m^m x^{2m-1}}\over{\Gamma(m)}}h(t_i)dx=\sum_{i=1}^{n}w_i{{\Gamma(m,a\,m\, e^{-\sqrt{2}t_i \lambda-\mu})}\over{\Gamma(m)}}$$

(I say "nice pdf" to avoid me messing up any discussion of switching the order of integration and summation.) You want $Pr(Y>a)=Pr(X^2>a)=Pr(X>\sqrt{a})$ (because the only positive support is where $X \ge 0$). (The numerator in the final sum above is the incomplete gamma function.)

• Thanks for your answer and nice explanation. However, I just have one comment. $f_X(x)$ is the PDF of random variable $X$. If $Y$ is a random variable where $Y=X^2$, what about the PDF $f_Y(y)$? Is it okay just to modify the integration limits? Don't we need to transform the PDF? – Srestha Narayanan May 2 '16 at 4:30
• That sounds like a separate question. But you have everything above to determine the pdf of $Y$. $F_Y(y)=Pr(Y \le y)=1-Pr(Y>y)$. And $f_Y(y)$ is just the derivative of that. – JimB May 2 '16 at 4:35
• In fact, It is a part of my question. My ultimate aim is to find the PDF $f_Y(y)$ where $Y$ is a random variable with $Y=X^2$. Would you please help me to find that. – Srestha Narayanan May 2 '16 at 4:51
• Why did you assume $t>0$ in your assumptions? – Srestha Narayanan May 2 '16 at 5:52
• Sorry. I shouldn't have assumed $t>0$. I guess I was just on a roll with such $>0$ assumptions. I'm sure that assumption isn't necessary. I'll check that out tomorrow. – JimB May 2 '16 at 6:27