1
$\begingroup$

Let $X = A \sin(\phi)$ where $A \sim \mathcal{N}(\mu, \sigma^2)$ and $\phi$ is a uniform random variable defined over $[0,2\pi]$. Assume these two random variables are independent. What is the PDF of $X$?

According to [1], the PDF is given by:

$$f(x) = \int_x^\infty \frac{e^{-\frac{1}{2}\left(\frac{A-\mu}{\sigma}\right)^2}}{\sqrt{A^2-x^2}} dA$$

I had no luck solving for this integral.

[1] Random Data: Analysis and Measurement Procedures, 4th Edition Julius S. Bendat, Allan G. Piersol

$\endgroup$
6
  • 1
    $\begingroup$ Do you mean that $\mu=A\sin\omega n$ or is $A$ random or what? $\endgroup$ Commented Oct 27, 2022 at 1:47
  • $\begingroup$ $\mu$ is the average value of A, so A can be, for example, 10 on average. A is a normal random variable. $\endgroup$
    – student1
    Commented Oct 27, 2022 at 13:44
  • 1
    $\begingroup$ Please make corrections in your question and add in missing information. For example, you have $Y\sim N(\mu,\sigma^2)$ when I think you mean $A\sim N(\mu,\sigma^2)$. The integral you present does not converge on $(x,\infty)$ and the $x-\mu$ term in that integral is probably $A-\mu$ but that doesn't necessarily fix things. Exactly what do you mean that $\sin(\omega n)$ has a uniform distribution? Is that a uniform distribution on $[-1,1]$? Is that random variable independent of $A$? $\endgroup$
    – JimB
    Commented Oct 27, 2022 at 15:14
  • $\begingroup$ Thanks for catching these errors, yes I meant A in both cases. I edited to make the problem more clear. Regarding the fact that the integral does not converge, this is what I found and that is why I am stuck. $\endgroup$
    – student1
    Commented Oct 27, 2022 at 15:38
  • 1
    $\begingroup$ You probably also need to state explicitly that $A$ and $\phi$ are independent random variables. Else the answer depends on the unspecified joint density of $A$ and $\phi$ which cannot, in general, be determined from the individual (a.k.a. marginal) densities of $A$ and $\phi$. $\endgroup$ Commented Oct 27, 2022 at 16:07

1 Answer 1

3
$\begingroup$

The Gaussian density is

$$g(A)=\frac{e^{-\frac{(A-\mu )^2}{2 \sigma ^2}}}{\sqrt{2 \pi } \sigma }$$

and the density of $Z=\sin(\phi)$ where $\phi\sim U(0,2\pi)$ is

$$h(z)=\begin{equation} \begin{cases} \frac{1}{\pi \sqrt{(1-z) (z+1)}} & -1<z<1 \\ 0 & \textrm{otherwise} \end{cases} \\ \end{equation} $$

Using a formula for the product of two independent random variables (https://en.wikipedia.org/wiki/Distribution_of_the_product_of_two_random_variables), the density for $X=A \sin(\phi)=A Z$ is

$$f(x)=\int_{-\infty}^\infty g(A) h(x/A) /|A|dA$$

Because $Z$ ranges from -1 to 1 (and not $-\infty$ to $\infty$) we need to fiddle with the limits of integration:

$$f(x)=\int_{-\infty }^{-| x| } \frac{\sqrt{2} e^{-\frac{(A-\mu )^2}{2 \sigma ^2}}}{2 \pi ^{3/2} \sigma \sqrt{A^2-x^2}} \, dA +\int_{| x| }^{\infty } \frac{\sqrt{2} e^{-\frac{(A-\mu )^2}{2 \sigma ^2}}}{2 \pi ^{3/2} \sigma \sqrt{A^2-x^2}} \, dA$$

So that equation you post isn't correct or I've made a mistake in the algebraic manipulations or both are incorrect. (But in any event, the equation you post is certainly missing a multiplicative normalizing constant.) I don't think there's a nice closed-form for this integral so one would need to evaluated it numerically.

How to check? Simulations are handy. Let $\mu=5$ and $\sigma=1$. Using Mathematica we have the following:

f[x_, μ_, σ_] := 
  NIntegrate[(Sqrt[2] E^(-((A - μ)^2/(2 σ^2))))/(2 π^(3/2) σ Sqrt[A^2 - x^2]), {A, -∞, -Abs[x]}] +
  NIntegrate[(Sqrt[2] E^(-((A - μ)^2/(2 σ^2))))/(2 (π^(3/2)) σ Sqrt[A^2 - x^2] ), {A, Abs[x], ∞}]

n = 1000000;  (* Sample size *)
ϕ = RandomVariate[UniformDistribution[{0, 2 π}], n];
a = RandomVariate[NormalDistribution[5, 1], n];
x = a Sin[ϕ];
Show[Histogram[xx, "FreedmanDiaconis", "PDF"],
 Plot[f[x, 5, 1], {x, -10, 10}, PlotRange -> All]]

Histogram and theoretical density

To do the equivalent in R:

# Integrand
  f <- function(a, x, mu, sigma) {
    exp(-(a-mu)^2/(2*sigma^2))*sqrt(2)/(2*pi^(3/2)*sigma*sqrt(a^2-x^2))
  }
  
# Probability density function of X = A*sin(phi)
  d <- function(x, mu, sigma) {
    integrate(f,  -Inf, -abs(x), x=-abs(x), mu=mu, sigma=sigma)$value +
    integrate(f, abs(x),    Inf, x= abs(x), mu=mu, sigma=sigma)$value
  }

# Random sample
  n = 1000000
  mu0 <- 5
  sigma0 <- 1
  a = rnorm(n, mu0, sigma0)
  phi = 2*pi*runif(n)
  hist(a*sin(phi), breaks=100, freq=FALSE, las=1, ylim=c(0,0.13), axes=FALSE)
  axis(1, c(-10:10), pos=0)
  axis(2, pos=-10, las=1)

# True density
  p <- NULL
  x <- NULL
  for (i in 1:499) {
      x[i] <- -10 + (10-(-10))*i/500
      p[i] <- d(x[i], mu0, sigma0)
  }
  lines(x, p, type="l", col="red", lwd=3)

Histogram and true pdf using R

$\endgroup$
4
  • $\begingroup$ This doesn't look right. The distribution I get from simulation in Matlab is completely different. $\endgroup$
    – student1
    Commented Oct 30, 2022 at 2:33
  • $\begingroup$ @student1. Ok. What does your Matlab code look like? $\endgroup$
    – JimB
    Commented Oct 30, 2022 at 2:50
  • $\begingroup$ ibb.co/N7mKnH2 N = 5000; phi = 2*pi* rand(N,1); r = 0.1*randn(N,1); D = r .* sin(phi); histogram(D) $\endgroup$
    – student1
    Commented Oct 30, 2022 at 3:00
  • $\begingroup$ I get the same histogram as you do when $\mu=0$ and $\sigma=0.1$. The example I gave in the answer uses $\mu=5$ and $\sigma=1$. $\endgroup$
    – JimB
    Commented Oct 30, 2022 at 3:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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