0
$\begingroup$

I encountered the following question while studying machine learning:

We are asked to calculate mean and covariance of a given probability density function

$$p(x) = \frac{1}{16} \cdot 1_{0 \leq x_1 \leq 4} \cdot 1_{-1 \leq x_2 \leq 3} $$

where $x \in \mathbb{R}^2$ and $1$ is an indicator function.

I know the mean in a one-dimensional setting can be computed like so:

$$\mu = \int p(x) x dx $$

What confuses me here are two things:

  1. How to compute the mean in a two-dimensional setting?
  2. If it involves integration: How to integrate the indicator functions?
$\endgroup$
0
$\begingroup$

For the two dimensional random vector $(X_1,X_2)$ with pdf $f(x_1,x_2)$, you have two ways to get the expectations involved one random variables, for $g(X_1)$. 1) you get the marginal pdf of $X_1$ first, then following the way that you get thge expectation for one random variables. 2) $\int \int g(x_1)f(x_1,x_2)dx_1 dx_2$. For the expectation involved two random variables, $g(x_1,x_2)$, for example, $E(X_1X_2)$, you must go through $\int \int g(x_1,x_2)f(x_1,x_2)dx_1 dx_2$.

For question 2. Here is example: to show $\int\int p(x_1,x_2) d_x1 dx_2 =1$, so that it meet one of the requirements to be pdf. For the area that pdf = 0, the integral is zero on the, so you just to consider the area that pdf not zero. In you case, the area is $0 \leq x_1 \leq 4$ and $-1 \leq x_2 \leq 3$.

$\int_{-1}^{3}\int_{0}^{4} p(x_1,x_2) dx_1 dx_2 = \int_{-1}^{3}\int_{0}^{4} \frac 1{16} dx_1 dx_2 = \int_{-1}^{3}\frac {x_1}{16}|_0^4 dx_2 = \int_{-1}^{3}\frac {1}{4} dx_2 = \frac {x_2}{4}|_{-1}^3 = \frac 34 - (-\frac 14) = 1 $

| cite | improve this answer | |
$\endgroup$
  • $\begingroup$ Thanks! So if I understand correctly, in this specific case $g(x_1, x_2) = \begin{pmatrix}x_1\\x_2\end{pmatrix}$? And would it be sufficient to calculate $\int \int g(x_1)f(x_1,x_2)dx_1 dx_2$ for $x_1$, $x_2$ respectively and then outputting the mean as $\begin{pmatrix}\mu_1\ \\mu_2\end{pmatrix}$ $\endgroup$ – BlockchainDieter Nov 22 '18 at 8:58
  • $\begingroup$ $g(x_1,x_2)$ should be single value function. I do not know how to work with $g(x_1, x_2) = \begin{pmatrix}x_1\\x_2\end{pmatrix}$. For $\mu_1$, $g(x_1,x_2) = x_1$, For $\mu_2$, $g(x_1,x_2) = x_2$. $\endgroup$ – user158565 Nov 22 '18 at 14:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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