Expected Value of a Logarithmic Function I was wondering if any of you could help me understand how to expand the following expression: $$E[\ln(b^T*X)]$$
for some $m \times 1$ vector $b$ and $m \times 1$ vector $X$.
I thought this meant the Expected value of the natural log function with the product of $b$ transpose matrix and matrix $X$. This is what I mean by saying that:
$$E[\ln(b_1*X_1+b_2*X_2+\ldots +b_m*X_m )]$$
But after this step, I am really unsure what to do next. How to detangle this expression so I understand what to code. I have written an algorithm in R, and wanted to test it on this function, but, obviously, I am getting an error.
So, please, help me understand how to expand this thing.
 A: Your first step is correct - $b^T X = b_1 X_1 + b_2 X_2 + \ldots + b_m X_m$, and you then need to take the logarithm of that calculation and find its expectation.
Unfortunately, in general there isn't a nice formula for the expectation of the logarithm of a random variable. There's Jensen's inequality, which gives the result that $E[\ln(X)] \leq \ln(E[X])$ (as long as both values exist), and you can get an approximation using Taylor series but that assumes a certain amount of stability that might not be guaranteed depending on the distribution of your $X$ variables.
Finally, if you're able to find the pdf of $b^T X$, then you can use that to calculate the expectation exactly since $E[g(X)] = \int g(x) f(x) dx$ where $f(x)$ is the pdf of $X$.
If you're getting an error, one likely possibility is that $b^T X$ is taking non-positive values. $\ln(x)$ is only defined for $x > 0$ (assuming we don't want to get into complex territory), so that's going to be a showstopper if, for example, your $X_i$ are normally distributed.
A: First use linearity of expectation but anyway you do need the distribution of $X_i$. Then
$$\mathbb{E}[\ln b_iX_i]=\int\ln (b_iX_i) f(x_i) dx_i    $$
