# Testing for the independence of random variables

In probability theory, $X$ and $Y$ are independent if: $f_{X|Y}(x|y)=f_X(x)f_Y(y)$

If I have sample $Y_1,...,Y_n$ and I would like to test if $Y_i$ is independent from the rest of the sample, I wonder if showing:

$f_{Y_1|Y_2,...Y_n}(y_1|y_2,...,y_n)=f_{Y_1}(y_1)...f_{Y_n}(y_n)$,etc.., would be the right way to do or there will be another way to test for independence of random variable $Y$? ( I found it is hard to show the above condition if I dont know the distribution/density function

Thank you so much in advance for any recommendation.

• Your very first formula is incorrect. It should read $$f_{X,Y}(x,y) = f_X(x) f_Y(y);$$ that is, the joint density of $X$ and $Y$ equals the product of their marginal densities. – heropup Aug 19 '14 at 5:25
• Your first formula does not seem to have anything to do with your question. You seem to be asking about independent events vs independent random variables. – user137481 Aug 19 '14 at 15:23
• @user137481, amWhy, Surb You suggested or approved an edit of the title mentioning independent events. There are no independent events in the question. How comes? – Did Aug 19 '14 at 15:44
• OP: To check that $Y_1$ is independent from the rest, one would show that $$f_{Y_1\mid Y_2,\ldots,Y_n}(y_1\mid y_2,\ldots,y_n)=f_{Y_1}(y_1),$$ not what you wrote. – Did Aug 19 '14 at 15:46
• @Did In the question, the OP stated that he would "like to test if $Y_i$ is independent from the rest of the sample". If I interpret each $Y_i$ as for example, the result of a coin toss, it would appear that the OP is asking about how he could determine whether the coin tosses are independent. – user137481 Aug 19 '14 at 15:48