# A variation on the $F$-distribution

If I have $\frac{X/n_1}{Y/n_2}$ where $X$ and $Y$ are independent chi-squared random variables, with degrees of freedom $n_1$ and $n_2$, respectively, then the distribution of this ratio is given by the $F$-distribution. If I have, instead, $\frac{X}{Y + k}$ where $k$ is a constant, what would the distribution be?

-
It's likely nonstandard and can almost certainly be obtained the same way the density of the $F$-distribution is normally derived: Change of variables. Question: Is $k \geq 0$? – cardinal Apr 21 '11 at 21:55
yes, in particular, k>0 – ACAC Apr 21 '11 at 22:27

This question can be resolved via change of variables. Let's generalize slightly to consider two independent gamma-distributed random variables. Let $\newcommand{\G}{\Gamma}X\sim \G(r_1, \lambda)$ and $Y \sim \G(r_2, \lambda)$, where $\G(r,\lambda)$ denotes a distribution with density $$f(x\;;r,\lambda) = \frac{\lambda^r x^{r-1}}{\Gamma(r)} e^{-\lambda x} \mathbf{1}_{(x > 0)} \> .$$

In what follows, we will need the following basic fact. Let $\beta > 0$ (for simplicity). Then, if $Z \sim \G(r, \lambda)$, $$\newcommand{\e}{\mathbb{E}} \e(Z^\beta) = \lambda^{-\beta} \frac{\G(r+\beta)}{\G(r)} \> .$$ Note that there is no restriction that $\beta$ be an integer here.

Under the previously established notation, a chi-square random variable with $n$ degrees of freedom is also a $\Gamma(n/2, 1/2)$ random variable.

Define the transformation variables $U = X / (Y + k)$ and $V = Y$. Then the map $(X,Y) \mapsto (U,V)$ is one-to-one.

In particular, $X = U(V+k)$ and $Y = V\,$ so that the Jacobian is $$J = \left| \begin{matrix} \frac{\partial x}{\partial u} & \frac{\partial x}{\partial v} \\ \frac{\partial y}{\partial u} & \frac{\partial y}{\partial v} \\ \end{matrix} \right| = \left| \begin{matrix} v+k & u \\ 0 & 1 \\ \end{matrix} \right| = v+k \> ,$$ and since $v > 0$, $k > 0$, we have that $|J| = J = v + k$.

The joint density of $(U,V)$ defined on $\{(u,v): u > 0, v > 0\}$ is thus $$f_{U,V}(u,v) = |J| f_{X,Y}(x,y) = \frac{\lambda^{r_1 + r_2}}{\G(r_1)} u^{r_1 - 1} e^{-\lambda k u} \cdot \frac{(v+k)^{r_1} v^{r_2-1}}{\G(r_2)} e^{-\lambda(1+u)v} \> .$$

Now we are left to integrate out $v$ so that we can recover $f_U(u)$.

So, for $u > 0$, $$f_U(u) = \frac{\lambda^{r_1}}{\G(r_1)} u^{r_1 - 1} (1+u)^{-r_2} e^{-\lambda k u} \cdot \int_0^\infty (v+k)^{r_1} \frac{v^{r_2-1} (\lambda(1+u))^{r_2}}{\G(r_2)} e^{-\lambda(1+u)v} \,\mathrm{d}v \> .$$

Observe that if $Z_u \sim \G(r_2, \lambda(1+u))$, then $$\e(Z_u+k)^{r_1} = \int_0^\infty (v+k)^{r_1} \frac{v^{r_2-1} (\lambda(1+u))^{r_2}}{\G(r_2)} e^{-\lambda(1+u)v} \,\mathrm{d}v \> ,$$ which provides a probabilistic interpretation of the integral.

Let's consider some special cases.

Case 1: $k = 0$.

$$\e(Z_u+k)^{r_1} = \e Z_u^{r_1} = (\lambda(1+u))^{-r_1} \frac{\G(r_1+r_2)}{\G(r_2)}$$ and so

$$f_U(u) = \frac{\G(r_1+r_2)}{\G(r_1)\G(r_2)} u^{r_1 - 1} (1+u)^{-(r_1+r_2)} \> .$$

From this, if $r_1 = n_1/2$, $r_2 = n_2/2$ and $\lambda = 1/2$, it's easy to see that $\frac{X/n_1}{Y/n_2} = \frac{n_2}{n_1}\frac{X}{Y+k} \sim F(n_1,n_2)$, as we should expect.

Case 2: $r_1$ is integral.

If $r_1$ is an integer (e.g., in the chi-square case, if the degrees of freedom of the numerator are even) then, $$\e(Z_u+k)^{r_1} = \sum_{i=0}^{r_1} {r_1 \choose i} k^{r_1-i} \e(Z_u^i) \>,$$ and so the expression for $\e(Z_u^i)$ can be used to obtain a "closed-form" (at least if you admit the gamma function) expression for the density.

-
+1 (you are raising the level of MSE). Two quibbles: the Jacobian being a (signed) determinant, you might replace the first occurrence of $|J|$ by $J$ (but certainly not the second one). And I got confused at first reading by $u$ appearing in the moments of $Z$, until I realized that the distribution of $Z$ depends on $u$ (yes I am slow...). Maybe use $Z_u$ instead of $Z$ to help the reader. (Once again: good job.) – Did Apr 23 '11 at 7:45
@Didier, thanks for the kind remarks and the suggestions, which I've incorporated into the answer. I originally had $|J| = J = |\cdot| = v+k$ in that display equation, but thought that was overly explicit. Your remarks have changed my mind. Indicating the dependence on $u$ of $Z$ was also a very good suggestion. – cardinal Apr 23 '11 at 16:32

Define $Z=X/(Y+c)$. Let's find the CDF $F_Z(x) = P( X/(Y+c) < x ) = P(X < Yx + cx)$.

Since Y is a random variable, we can calculate this as

$F_Z(x) = \int_0^\infty P(X < xy + cx) f_Y(y) \mathrm d y = \int_0^\infty F_X( x(y+c) ) f_Y(y) \mathrm d y$

Now differentiate by $x$ to get the PDF of $Z$:

$f_Z(x) = \int_0^\infty f_X( x(y+c) ) (y+c) f_Y(y) \mathrm d y$

Substituting the appropriate PDF, we get

$f_Z(x) = \frac{1}{2^k \gamma(k/2)^2} \int_0^\infty [x(y + c)/2]^{k/2-1} \mathrm e^{-x(y+c)/2} y^{k/2-1} \mathrm e^{-y/2} \mathrm d y$

which according to Mathematica evaluates to

$f_Z(x) = \frac{2^{\frac{1}{2}-k} c^{\frac{1}{2} (-1+k)} e^{\frac{1}{4} (c-c x)} \sqrt{\pi } (1+x)^{\frac{1}{2}-\frac{k}{2}} \text{BesselK}\left[\frac{1}{2} (-1+k),\frac{1}{4} c (1+x)\right] \text{Csc}\left[\frac{k \pi }{2}\right]}{\text{Gamma}\left[1-\frac{k}{2}\right] \text{Gamma}\left[\frac{k}{2}\right]^2}$

This assumes that $X$ and $Y$ have the same degrees of freedom, $k$.

ed: Corrected per @cardinal's warning.

-
(-1) If $Y$ is a chi-square random variable, then $Y + k$ is not a noncentral chi-square random variable. – cardinal Apr 21 '11 at 22:15
I think this is still incorrect. – cardinal Apr 22 '11 at 0:26
Please be specific about which part. – Emre Apr 22 '11 at 0:39
Can you think of a sanity check you might try? – cardinal Apr 22 '11 at 0:52
I need to check this. What do you mean by "the degrees of freedom k is common to X and Y", you mean the same? – ACAC Apr 22 '11 at 2:01