# How can I calculate the Expectation for a particular known vector?

Let us say I have a row vector $X = [x_1, x_2, x_3, \ldots, x_n]$ and another row vector $Y = [y_1, y_2, y_3, \ldots, y_n]$. I want to check whether the two vectors are statistically independent or not.

Now two vectors are said to be statistically independent if $E(X Y) = E(X) E(Y)$, where $E$ is the expectation operator.

So how would I calculate the expectation value for each of the concerned vectors?

Thank you for your suggestions - I'm really new to statistics.

• Your statement "Now two vectors are said to be statistically independent if E(X Y) = E(X) * E(Y), where E is the expectation operator." is incorrect on several counts. Unless your vectors are vectors of random variables, there is no expectation operator that you can use. If the vectors are vectors of random variables, then the vectors are independent if their joint density factors into the product of the marginal densities: $$f_{X,Y}(u_1,\cdots,u_n,v_1,\cdots,v_n) = f_X(u_1,\cdots,u_n)f_Y(v_1,\cdots,v_n)$$ and the random variables are independent if the RHS factors into $2n$ densities. Feb 27 '12 at 14:52
• Since you asked about doing this in MATLAB, then I'll assume that you have two vectors of "numbers" that are really observations from two random processes. In that case, there's no single operation that you can do in order to declare the two underlying processes as statistically independent. You need to at least have some probability model for the sources of the realizations that you're looking at. There are then statistical tests that you can apply to determine the amount of dependence with some amount of confidence. Feb 27 '12 at 15:05
• @DilipSarwate Thank you for your comment. So if I have for example two vectors - one vector is sin(x), and the other vector has numbers drawn from a Gaussian distribution.. You mentioned that they HAVE to be vectors of random variables. So sine wouldn't count? Also, if they are random, how would you compute the joint density factors. I've really been looking into this but can't seem to find a straight answer. Feb 27 '12 at 15:56
• @DilipSarwate Joint PDF being a product of the marginals is correct, but I do not think this helps the OP. She is asking about a test. Let us assume for the sake of argument that the two vectors were indeed made by 2 random variables. From HERE, how do we test for independence? Feb 27 '12 at 16:59
• @Rachel If one of your vectors is deterministic as in $$X=[\sin(\omega t_1),\sin(\omega t_2),\ldots,\sin(\omega t_n))$$ where the $t_i$ are fixed time instants (not necessarily equally spaced in time) and $\omega$ is a known constant, and $Y$ is a vector obtained by calling randn (say), then $X$ and $Y$ are independent in that knowing one tells you nothing about the other, and this is reflected in the probability assignment. If $X$ and $Y$ are generated by separate calls to randn and you are not playing tricks by forcing the same "seed" in both calls, then $X$ and $Y$ are independent. Feb 28 '12 at 3:35