# Plot the density function of a normal random variable knowing only the characteristic function in R

The characteristic function of a normal random variable with mean $\mu$ and standard deviation $\sigma$ is:

\begin{alignat*}{1} \hat{\phi}(t) & =e^{i\mu t}e^{-\frac{1}{2}\sigma^{2}t^{2}}\\ & =\exp(i\mu t-\frac{1}{2}\sigma^{2}t^{2}) \end{alignat*}

What I want to do is to plot the PDF of the normal random variable knowing only the characteristic function outlined above $\hat\phi(t)$. Ideally the solution to this problem would be to apply the Inverse Fourier Transform on $\hat\phi(t)$ and then plot the result for different values of $x$. Applying the Inverse Transform leads me to solve this integral to get the PDF of $x$:

\begin{alignat*}{1} f(x) & =\frac{1}{2 \pi}\int_{-\infty}^{\infty}\hat{\phi}(t)\exp(-itx)dt\\ & =\frac{1}{2 \pi}\int_{-\infty}^{\infty}\exp(i\mu t-\frac{1}{2}\sigma^{2}t^{2})\exp(- itx)dt\\ & =\frac{1}{2 \pi}\int_{-\infty}^{\infty}\exp(i\mu t-\frac{1}{2}\sigma^{2}t^{2}- itx)dt \end{alignat*}

The problem is that I do not know how to do it in R. I could use the integrate() function, but how do I treat the imaginary unit $i$?

• Can't you just read off the coefficients of $t$ and $t^2$ in the characteristic function in order to deduce the values of $\mu$ and $\sigma^2$? – Mark L. Stone May 28 '16 at 13:30

## 1 Answer

Just read off the coefficients of $t$ and $t^2$ in the characteristic function in order to deduce the values of $\mu$ and $\sigma^2$. If the characteristic function is not (or cannot be put) in the form $exp(a i t - b t^2)$, where $a$ is a real number and $b$ is a non-negative real number, then it is not the characteristic function of a Normal random variable. If it is of that form, then $\mu = a$ and $\sigma^2 = 2 b$. Now plot a Normal density with those parameters to your heart's content.

Your formula for the probability density function is incorrect. it should be \begin{alignat*}{1} f(x) & =\frac{1}{2 \pi}\int_{-\infty}^{\infty}\hat{\phi}(t)\exp(-itx)dt\\\end{alignat*}which lo and behold, comes out correct.

• Ward Whitt and colleagues have devised some very clever numerical algorithms in the past to bring transforms back to the probability domain. Not just for normal distributions (which would be rather silly like Mark Stone remarked), but for general distributions as well). References can be provided although I doubt if R-implementations exist. – StijnDeVuyst May 28 '16 at 19:00
• Thank you for you answer Mark. Sorry for the error in the formula, I have updated the question. What do you mean with "read off the coefficients of $t$ and $t^2$ in the characteristic function"? Unfortunately I have been introduced to concepts like the Fourier Transform and the characteristic function without having the proper theoretical background to understand them (it's a long story...), and now I'm asked to do things which, apparently, I cannot do. – ChicagoCubs May 28 '16 at 20:04
• What is your starting point for this process? Do you have an explicit characteristic function? If so, what does one look like? it should match the form I described. If not, what does it look like? – Mark L. Stone May 28 '16 at 20:28
• @MarkL.Stone Yes, I have the explicit characteristic function of the normal distribution, which is the following: $$\hat{\phi}(t) = \exp(i\mu t-\frac{1}{2}\sigma^{2}t^{2})$$ And I need to plot the density function using the inverse Fourier transform: $$f(x) =\frac{1}{2 \pi}\int_{-\infty}^{\infty}\hat{\phi}(t)\exp(-itx)dt$$ – ChicagoCubs May 28 '16 at 21:14
• Applying the fourier transform Is pretty much the same idea either direction. You ought to get the idea how to do things looking at mathworld.wolfram.com/FourierTransformGaussian.html or the first couple of pages of web.mit.edu/8.03-esg/watkins/8.03/ft.pdf .Whether you're supposed to symbolically or numerically evaluate the integrals, I leave to you. Or use an approach like stackoverflow.com/questions/10029956/… (I haven't checked the correctness myself). I don't know the expectations of your assignment. – Mark L. Stone May 29 '16 at 12:30