# Approximate expectation of a random variable that is the logarithm of a function of a binomial

I want the expectation of the following random variable: $$\log\left(\frac{X}{k-X}+\alpha \right)$$ with $$X \sim Bin_{(k-1),p}$$ and $$\alpha > 0$$, Therefore I derived the Taylor Series: $$$$T_{x_0=(k-1)p}\left[\log\left(\frac{X+\alpha}{k-X}\right)\right] = \log\left(\frac{x_0+\alpha}{k-x_0}\right)+ \sum_{n=1}^{\infty}\frac{1}{n}\left(\frac{(-1)^{n-1}}{(x_0+\alpha)^n}+\frac{1}{(k-x_0)^n}\right)\left(x-x_0\right)^n$$$$ Plugging in $$x_0=(k-1)p$$ and calculating the expectation leads me to: $$$$E\left[\log\left(\frac{X+\alpha}{k-X}\right)\right]= \log\left(\frac{(k-1)p+\alpha}{k-(k-1)p}\right)+\sum_{n=1}^{\infty}\frac{1}{nk^n}\left(\frac{(-1)^{n-1}}{\left(p+\frac{\alpha - p}{k}\right)^n}+\frac{1}{\left(1-p+\frac{p}{k}\right)^n}\right)E\left[\left(x-(k-1)p\right)^n\right]$$$$

I know that the Taylor series of $$\log(x+1)$$ only converges within the open ball $$(-1,1)$$. Does that apply for the random variable? That is, that for $$f(X) = \log\left(\frac{X+\alpha}{k-X}\right)$$ it holds that: $$$$E\left[f(X)\right]=E\left[T_{x_0=(k-1)p}f(X)\right] \Leftrightarrow f(X) \in (-1,1)$$$$ Clearly, that would depend on the values of $$k$$ and $$p$$. However, for me $$k$$ can take values up to a few hundred, so $$f(X) \in (-1,1)$$ does not hold $$\forall X$$. When I wasn't aware that this convergence could go wrong, I showed that in the parameter settings $$p=0.5$$ and $$k>>1$$, so that $$k \approx (k-1)$$, the expectation is $$0$$, given the Taylor approximation is true. Now, can I still use this result from the Taylor series?

• the variable $X$ can take on the value 0 with nonzero probability, so wouldn't the expectation of $\log(X/(k-X))$ diverge? Nov 30, 2020 at 12:23
• you're right. I add an $\alpha > 0$ Nov 30, 2020 at 12:39
• After "adding that $\alpha>0$", you can use this answer and linearity of expectation: for $\beta>0$, $$\mathbb{E}\log \frac{X+\beta}{k-X} = \mathbb{E}\log(X+\beta) - \mathbb{E}\log(Y+1)$$ where $Y$ is Binomial with parameters $k-1$ and $1-p$. Nov 30, 2020 at 12:47
• The command of Mathematica Table[Mean[ TransformedDistribution[Log[x/(k - x) + \[Alpha]], x \[Distributed] BinomialDistribution[k - 1, p]]], {k, 2, 5}] produces $\left\{(1-p) \log (\alpha )+p \log (\alpha +1),p^2 \log (\alpha +2)+(1-p)^2 \log (\alpha )+2 p (1-p) \log \left(\alpha +\frac{1}{2}\right),3 p^2 (1-p) \log (\alpha +1)+p^3 \log (\alpha +3)+(1-p)^3 \log (\alpha )+3 p (1-p)^2 \log \left(\alpha +\frac{1}{3}\right),\right.$ Mar 25, 2021 at 20:00
• $\left.6 p^2 (1-p)^2 \log \left(\alpha +\frac{2}{3}\right)+4 p^3 (1-p) \log \left(\alpha +\frac{3}{2}\right)+p^4 \log (\alpha +4)+(1-p)^4 \log (\alpha )+4 p (1-p)^3 \log \left(\alpha +\frac{1}{4}\right)\right\}$. Mar 25, 2021 at 20:03

So I use hint from Clement with $$E\left[\log\frac{X+\alpha}{k - X}\right]$$, where $$X\sim Bin_{(k-1),p}$$ and $$\alpha > 0$$ is identical to calculating $$E\left[\log\left(X+\alpha\right)\right]-E\left[\log\left(Y+1\right)\right]$$ with $$Y\sim Bin_{(k-1),(1-p)}$$. To first check the convergence disc for the log-Taylor series I apply the ratio test. $$$$T_{x_0}\left(\log(x+\alpha)\right)=\log\left(x_0+\alpha\right)+\sum_{i=1}^{\infty}\frac{(-1)^{i-1}}{i(x_0+\alpha)^i}(x-x_0)^i$$$$ My coefficient of the power series is $$c_i=\frac{(-1)^{i-1}}{i(x_0+\alpha)^i}$$. Thus, the radius around the center $$x_0$$ is: $$$$r=\lim_{i\rightarrow \infty}\left|\frac{c_i}{c_{i+1}}\right|=\lim_{i\rightarrow \infty}\left|\frac{(i-1)(x_0+\alpha)^{i+1}}{i(x_0+\alpha)^i}\right|=x_0+\alpha$$$$ Thus, plugging in $$x_0 = (k-1)p$$ causes no trouble if $$p\geq\frac12$$, otherwise, the realization can be outside of the convergent disc centered at $$x_0$$. As in my setting, if $$p\neq 0.5$$ I could be either for $$X$$ or for $$Y$$ outside of the convergent disc.
So in the case of $$p=0.5$$, the Taylor series is convergent (sum of two convergent series) and therefore indeed it holds that $$$$\lim_{k\rightarrow \infty}E\left[\log\frac{X+\alpha}{k-X}\right]=0$$$$ as the odd terms disappear because of symmetry and the even terms disappear because the big sum in the coeffient of the joint Taylor series above.