# On Finding Means of Distributions

If I have a distribution which depends only on one variable, I usually find the mean by:

(Continuous Case) $$\mu=\displaystyle \int xf_X(x).dx$$

What happens in the following cases:

• Conditional Mean? $$\mu=\displaystyle \int xf_X(x|y).dx ?$$

• Joint Distribution? $$??f_{X,Y}(x,y)??$$

I have taken a course on this stuff a long time ago but I needed to do some Bayesian Analysis for my research and the Posterior Mean keeps ruining my life.

For instance,

$$f_{\Theta|X}(\theta|x)\propto f_{X|\Theta}(x|\theta)\cdot f_\Theta(\theta)$$ I have $\theta$ as 2 parameters and I have to find posterior mean (which is the expected value of $f_{\Theta|X}$)

-
The last displayed formula is wrong. Could you revise it? –  Did Dec 13 '12 at 6:45
@did. Should have been proportional to. Edited. –  Inquest Dec 13 '12 at 7:25
Still dubious: you misuse $x$ for $X$ and forget arguments. I modified it. –  Did Dec 13 '12 at 9:46
@did you are amazingly sharp and rigorous. –  Learner Dec 13 '12 at 9:55
@did. Thanks, I appreciate it. I have gotten used to this sloppy notation so it was hard for me to see where you said there was ambiguity. –  Inquest Dec 13 '12 at 16:00

Don't forget that the conditional mean should be written $$\mu(y)=\int x f_{X|Y}(x|y)d x$$ and is a function of $y$.

For the posterior mean,

\begin{eqnarray*} E \left[ \theta |x \right] & = & \int \theta f_{\Theta |X} \left( \theta |x \right) \mathrm{d} \theta\\ & = & \frac{1}{f_X \left( x \right)} \int \theta f_{\Theta} \left( \theta \right) f_{X| \Theta} \left( x \left| \theta \right. \right) \mathrm{d} \theta \end{eqnarray*}

If you have two components, then \begin{eqnarray*} E \left[ \theta |x \right] & = & \left(\begin{array}{c} E \left[ \theta_1 |x \right]\\ E \left[ \theta_2 |x \right] \end{array}\right)\\ & = & \left(\begin{array}{c} \int \theta_1 f_{\Theta |X} \left( \theta |x \right) \mathrm{d} \theta_1\\ \int \theta_2 f_{\Theta |X} \left( \theta |x \right) \mathrm{d} \theta_2 \end{array}\right) \end{eqnarray*}

There is nothing special about vectors here. It was implicit, in $\begin{array}{lll} E \left[ \theta |x \right] & = & \int \theta f_{\Theta |X} \left( \theta |x \right) \mathrm{d} \theta \end{array}$ that, if $\theta$ is a vector then both sides of the equation are a vector.

For the mean from the joint distribution (and non-rigorously) \begin{eqnarray*} E \left[ X \right] & = & \int xf_{X, Y} \left( x, y \right) \mathrm{d} x \mathrm{d} y\\ & = & \int xf_X \left( x \right) \underbrace{\left( \int f_{Y \left| X \right.} \left( y|x \right) \mathrm{d} y \right)}_{= 1} \mathrm{d} x\\ & = & \int xf_X \left( x \right) \mathrm{d} x \end{eqnarray*}

So if the object in which you are interested only depends on some marginal variables, you only need to compute the mean with respect to the distribution of those marginal variables.

I hope that things are clearer now!

-