# Finding the distribution of a piecewise function of a Gamma random variable

Let random variable $$X \sim \text{Gamma}(\alpha,\beta)$$. I want to derive the distribution of $$Y$$, where:

$$Y = \left\{ \begin{array}{ll} a X - k & \quad X \geq \frac{k}{a} \\ 0 & \quad \text{else} \end{array} \right.$$

where $$a$$ and $$k$$ are constants. Any suggestions? Can I use method of transformations and a truncated Gamma distribution somehow?

• What's piecewise about this problem? – AdamO Jun 12 at 15:03
• The function of the rv that I want to transform to is piecewise. – DavidL Jun 12 at 15:09
• Yeah, it looks like a simple mixture model. Find the probability of Qs=0 response as a point mass first. Use Jacobian method to find Qs as if there wasn't a condition. Truncate that distribution at 0, and scale by the complement of the 0 probability so that it all adds to 1. – AdamO Jun 12 at 15:12
• You can further simplify the question by noting (1) $aX$ has a $\text{Gamma}(\alpha,a\beta)$ distribution (assuming $\beta$ is a scale parameter); (2) the distribution of $aX-k$ is that of $aX$ shifted by $k;$ and (3) $Y=\max(0,aX-k).$ At this point the problem is so simple that you ought to consider applying the definition: compute $\Pr(Y \le y)$ for (a) $y\gt 0$ and (b) $y\le 0.$ Neither requires any calculation. – whuber Jun 12 at 19:03
• The foregoing series of comments and edits to the question nicely illustrates the benefits of a general procedure strongly advocated on Stack Overflow--it's therefore not of a statistical nature at all: present a minimal reproducible example of your problem. In statistics (and mathematics generally, as well as in programming) that approach frequently solves the problem, obviating any need even to ask it. :-) – whuber Jun 12 at 19:05