Modify a random variable to make its range Borel? Let $X: \Omega\to{\mathbb R}$ be a random variable. Is it always possible to modify it (i.e. change the value of $X$ on a subset of $\Omega$ of zero measure) so that the range of $X$ is a Borel set?
This is related to the following question: we know that $E(Y|X)$ can be written as a function of $X$, i.e. $E(Y|X)=\varphi(X)$ for some $\varphi: {\mathbb R}\to{\mathbb R}$. Is $\varphi$ (Borel) measurable? We can prove this if we know $X$ has Borel range.
I guess the answers might be negative, will there be (easy) counterexamples? Can we add some assumptions to make the conclusion true?
 A: Assume that $(\Omega, {\mathcal F}, P)$ itself is a Lebesgue space, so it can be realized as a Polish space equipped with the completion of the Borel sets. If $X$ is a random variable, it can be changed on a set of measure zero to be a Borel measurable function. (This is an easy consequence of [1]). Thus we may assume $X$ itself is Borel measurable.
The class of analytic sets is closed under   direct images  by Borel functions, see e.g. Proposition 1.4 in [2], or [3].
Finally, any analytic set is universaly measurable [3], so $X(\Omega)$ differs from a Borel set $B$ on a set $A$ of zero measure with respect to the push-forward $\mu:=PX^{-1}$, that is $B=X(\Omega) \setminus  A$. Thus if $X^*$ is obtained from $X$ by changing it to map $X^{-1}(A)$ to one point in $B$, then $X^*(\Omega)=B$.
[1] https://en.wikipedia.org/wiki/Monotone_class_theorem
[2]  https://webusers.imj-prg.fr/~dominique.lecomte/Chapitres/6-Analytic%20and%20co-analytic%20sets.pdf
[3] Kechris, A. Descriptive set theory, Springer.
