# Is the expectation of log-concave function still log-concave?

I know the expectation preserves the concavity (or convexity), but I was wondering is it still true that the expectation of log-concave function still log-concave; to be more precise,

Let $g(x,Y)$ be log-concave function in $x$ where $Y$ be discrete-time random variable with density $f_Y$. Is it true that $$E[g(x,Y)]$$be still log-concave in $x$?

I noticed there is one result called Prekopa theorem, which states that if $g(x,y): \mathbb{R}^{n+m} \to \mathbb{R}$ be (jointly) log-concave, then $$h(x) = \int g(x,y) dy$$is log-concave. But I'm not sure how to apply properly on the expectation case, since I have to deal with the log-concavity of integrand function $g(x,y) f_Y(y)$ first; i.e., $$E[g(x,Y)] = \int g(x,y) f_Y(y)dy$$

Any suggestion is appreciated. Thanks

Not necessarily. Consider $Y$ such that $Pr[Y=0]=Pr[Y=1]=1/2$. Define $g(x,Y)=e^{Yx}$. Then $g(x,Y)$ is log concave in $x$ because $\log g(x,Y) = Yx$ is linear. But: $$E[g(x,Y)] = \frac{1 + e^x}{2}$$ and $\log E[g(x,Y)] = \log(1/2) + \log(1 + e^x)$, which is no longer concave.
Proposition. Let $$g(x,y)$$ be jointly log-concave and $$Y$$ be a log-concave random variable with density $$f(y)$$. Then $$\mathbb{E}[g(x,Y)]$$ is log-concave.
Proof. The function $$g(x,y)f(y)$$ is log-concave because is logarithm $$\log g(x+y) + \log f(y)$$ is the sum of two concave functions. Therefore, because log-concavity is preserved under marginalization, $$\mathbb{E}[g(x,Y)] = \int g(x,y)f(y)\,dy$$ is log-concave.