# Construct joint distribution of $X,Y$ such that $E[X|Y=y,y\geq \bar{y}]$ is piecewise linear

Can one construct a joint density $f(x,y)$ such that the marginal distribution of $Y\sim~U[c,d]$, no restrictions on $X$ (it would be great that $X$ also has uniform distribution) as long as it has finite support such that $\mathbb{E}[X|Y=y, Y\geq \bar{y}]$ (where $\bar{y}$ is some pre-specified number that is within the support of $Y$) is a piecewise linear function of $y$?

Here is some background of this problem. $X$ is the true state of a system and $Y$ is some index of the state which is not perfect but it is related to $X$. An agent observe $Y$ and want to learn the true state $X$. But the agent was told that $Y$ is greater than some threshold $\bar{y}$, i.e., the agent know that he cannot observe $Y$ that is strictly lower than $\bar{y}$, a pre-specified constant. I've read this (Is there a parametric joint distribution such that $X$ and $Y$ are both uniform and $\mathbb{E}[Y \;|\; X]$ is linear?). It is relevant to my problem but I think they are not completely the same.

Suppose the joint density of $X$ and $Y$ is uniformly distributed on the two squares with opposite vertices at $(0,0)$ and $(1,1)$ and at $(1,1)$ and $(2,2)$ respectively. Then, $X$ and $Y$ are $\sim U(0,2)$.
• Conditioned on $Y=y$ where $y \in (0,1)$, the conditional density of $X$ is $\sim U(0,1)$ and so $E[X\mid Y = y] = \frac 12$.
• Conditioned on $Y=y$ where $y \in (1,2)$, the conditional density of $X$ is $\sim U(1,2)$ and so $E[X\mid Y = y] = \frac 32$.
So, if your given $\bar{y}$ (particularly dreadful choice of notation on stats.SE!) is in $(0,1)$, then for $y>\bar{y}$, $E[X\mid Y = y]$ is a piecewise linear function, having value $\frac 12$ in one interval and value $\frac 32$ in another interval.