# Example of a joint density function $f(x,y)$ such that $E(Y|x)=\ln(x)$:

Let $X$ and $Y$ be jointly continuous random variables with $X$ taking values in some $D$. Give an example of a joint density function $f(x,y)$ such that $E(Y|x)=\ln(x)$:

I have tried so many functions but none seem to fit! Is there a trick/method/theorem I am supposed to use?

I know that:

$$\int_c^d\int_a^{b(x)}\, f(x,y)\, dy\, dx=1$$

and

$$E[Y|x]=\int_a^{b(x)}\,y\cdot f_{Y|x}(y)\, dy=\ln x$$ (so I guess that $$f_{Y|x}(y)=\frac{1}{y^2}$$ and $$b(x)=x\, , a=0$$ but then I can't find suitable $f(x,y)$ and $f_X(x)$.)

Also, $$\int_a^{b(x)}f(x,y)\, dy=f_{X}(x)$$ and $$f_{Y|x}(y)=\dfrac{f(x,y)}{f_X(x)}.$$

-

Since $\ln x$ is undefined (or at least not real) if $x \le 0$, all possible values of $X$ must be positive. If we want to allow all positive numbers as possible values of $X$, note that $E[Y|X] = \log(X)$ could be either positive or negative, so we'll want to allow arbitrarily large positive or negative values for $Y$. A convenient distribution with a given mean $\mu$ is the normal distribution with parameters $\mu$ and $1$. Thus we could have $$f(x,y) = f_X(x) f_{Y|X}(y|x) = \frac{f_X(x)}{\sqrt{2\pi}} e^{-(y - \ln x)^2/2}\ \text{for } \ x > 0$$ where $f_X(x)$ is any probability density function on $(0,\infty)$.

-
I was about to post my example, when your more general answer arrived (+1). The example I had in mind was $$f_{X,Y}(x,y) = \frac{1}{\pi x} \mathrm{e}^{-y^2/2} \mathrm{e}^{-(y-2\ln(x))^2/2} [x>0] = \frac{1}{\pi x} \mathrm{e}^{-\log(x)^2} \mathrm{e}^{-(y-\ln(x))^2} [x>0]$$ – Sasha Sep 10 '12 at 4:48