Skip to content

Instantly share code, notes, and snippets.

@colbyford
Last active July 18, 2024 16:38
Show Gist options
  • Save colbyford/daa4aa58de70e7ecd8637f45fd68ecba to your computer and use it in GitHub Desktop.
Save colbyford/daa4aa58de70e7ecd8637f45fd68ecba to your computer and use it in GitHub Desktop.
Expected value of |XY|^p for bivariate normal distribution where 0<p<2

Expected value of $|XY|^p$ for a bivariate normal distribution, where $(0 &lt; p &lt; 2)$

Disclaimer: This was generated using AI with Mathestral on Ollama and then edited by an underqualfied human.

Denote the bivariate normal random variables as $(X)$ and $(Y)$ with the following properties:

  • Mean vector: $\mu = (\mu_X, \mu_Y)$

  • Covariance matrix: $\Sigma = \binom{\sigma_X^2 , \rho \sigma_X \sigma_Y}{\rho \sigma_X \sigma_Y , \sigma_Y^2}$

The goal is to find $(\mathbb{E}[|XY|^p])$.

  1. Transformation to standard bivariate normal:

    Assume $(X)$ and $(Y)$ are standard normal random variables with zero mean and unit variance with a correlation coefficient $(\rho)$.

  2. Joint probability density function (PDF):

    The joint PDF of $(X)$ and $(Y)$ is given by:

    $f_{X,Y}(x, y) = \frac{1}{2\pi\sqrt{1 - \rho^2}} \exp \left( -\frac{1}{2(1 - \rho^2)} (x^2 - 2\rho xy + y^2) \right)$

  3. Expectation calculation:

    $\mathbb{E}[|XY|^p] = \int_{-\infty}^\infty \int_{-\infty}^\infty |xy|^p f_{X,Y}(x, y) , dx , dy$

  4. Simplifying the integral:

    Converting to polar coordinates where (x = r \cos\theta) and (y = r \sin\theta), and the Jacobian determinant is (r).

    The integral becomes:

    $\mathbb{E}[|XY|^p] = \int_0^\infty \int_0^{2\pi} |r^2 \cos\theta \sin\theta|^p \frac{r}{2\pi\sqrt{1 - \rho^2}} \exp \left( -\frac{r^2}{2(1 - \rho^2)}(1 - 2\rho \cos\theta \sin\theta) \right) r , d\theta , dr$

    Simplified:

    $\mathbb{E}[|XY|^p] = \frac{1}{2\pi\sqrt{1 - \rho^2}} \int_0^\infty r^{2p+1} \exp \left( -\frac{r^2}{2(1 - \rho^2)} \right) dr \int_0^{2\pi} |\cos\theta \sin\theta|^p \exp \left( \frac{r^2 \rho \cos\theta \sin\theta}{1 - \rho^2} \right) d\theta$

  5. Separating the integrals: Considering the radial part and the angular part separately. The radial part is:

    $\int_0^\infty r^{2p+1} \exp \left( -\frac{r^2}{2(1 - \rho^2)} \right) dr$

    This is a gamma function integral:

    $\int_0^\infty r^{2p+1} e^{-\frac{r^2}{2(1 - \rho^2)}} dr = \left( \frac{2(1 - \rho^2)}{2} \right)^{p+1} \Gamma(p+1)$

    Simplified as:

    $(1 - \rho^2)^{p+1} \Gamma(p+1)$

  6. Angular part: Assuming $(\rho = 0)$:

    $\int_0^{2\pi} |\cos\theta \sin\theta|^p d\theta = 2 \int_0^{\pi/2} (\cos\theta \sin\theta)^p d\theta = 2 \int_0^{\pi/2} \cos^p \theta \sin^p \theta d\theta$

    Using the Beta function $(B(x,y))$:

    $2 \int_0^{\pi/2} \cos^p \theta \sin^p \theta d\theta = 2 \cdot B\left( \frac{p+1}{2}, \frac{p+1}{2} \right) = 2 \frac{\Gamma(\frac{p+1}{2}) \Gamma(\frac{p+1}{2})}{\Gamma(p+1)}$

  7. Combining results:

    $\mathbb{E}[|XY|^p] = \frac{(1 - \rho^2)^{p+1} \Gamma(p+1)}{2\pi\sqrt{1 - \rho^2}} 2 \frac{\Gamma(\frac{p+1}{2})^2}{\Gamma(p+1)}$

    Simplified, the terms involving $(\Gamma(p+1))$ cancel:

    $\mathbb{E}[|XY|^p] = \frac{(1 - \rho^2)^{p+1}}{\sqrt{1 - \rho^2}} \frac{\Gamma(\frac{p+1}{2})^2}{\pi}$

Therefore, the expected value $\mathbb{E}[|XY|^p]$ for $(0 &lt; p &lt; 2)$ is:

$\boxed{\mathbb{E}[|XY|^p] = (1 - \rho^2)^p \frac{\Gamma\left(\frac{p+1}{2}\right)^2}{\pi}}$


R Function

expected_value_XY_p <- function(p, rho) {
  if (p <= 0 || p >= 2) {stop("p must be between 0 and 2.")}
  
  ## Compute the Gamma function values
  gamma_half_p1 <- gamma((p + 1) / 2)
  
  ## Compute the expected value
  expected_value <- (1 - rho^2)^p * (gamma_half_p1^2) / pi
  
  return(expected_value)
}

## Example usage
p <- 1.5
rho <- 0.5
result <- expected_value_XY_p(p, rho)
print(result)
# [1] 0.1698573

Disclaimer: This was generated using AI with Mathestral on Ollama and then edited by an underqualfied human.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment