advanced statistics

Transformations of Random Variables

Let me set the example;
You have two independant random variables $X$ with pdf $f_{X}(x)$ and $Y$ with pdf $f_{Y}(y)$.
You will have a new random variable $Z$, where $Z=X-Y$, and say we want to calculate the marginal pdf of $Z$.

First we need to make a new joint pdf including Z, to avoid cluterization of the same random variables, lets first let give $X$ a different name, i.e. $X=W$.
Now we saw that we have $Z=X-Y$, but now its $Z=W-Y$.
We want to know our variable $Y$, so we re-arrange the above to get $Y=W-Z$.

Now, we use something called a Jacobian, and we will use its determinant to transform from $(x,y)$ to $(w,z)$, and then we can get the marginal pdf of $Z$.
So the jacobian is:
$$|J|=|frac{partial(x,y)}{partial(w,z)}|=begin{vmatrix}
frac{partial x}{partial w} & frac{partial y}{partial w} \
frac{partial x}{partial z} & frac{partial y}{partial z}
end{vmatrix}$$
We can then do the following:
$$f_{Z,W}=f_{X,Y}(w,w-Z)|J|$$
$$=f_{X}(w)f_{Y}(w-z) cdot |J|$$
And then finally, to find the marginal pdf of $Z$, we intergrate out w from the joint pdf:
$$f_{Z}(z)=int_{-infty}^{infty}f_{X}(w)f_{Y}(w-z)dw$$