 # Correlation Matrix vs Contingency Table

Is there a difference between a correlation table and a contingency matrix?

Consider a vector w/ two random variables X= [X1 X2]’
Example:
X1= 1 if Left-handed, X1=2 if Right-handed
X2= 1 if Male, X2=2 if Female

1 A correlation matrix is a matrix w/ all correlations between the variables
-It can be based on the population, or computed from a sample just like the mean…

2 Suppose we have a sample w/ say N=100 realizations of X.
-For N=100 ppl, we have their X1 (Left/Right hand) & X2 (Sex)
A contingency table displays the frequency of observations

From this contingency table you can compute the:
joint distribution/marginal distributions/Means/Covariance Matrix/Correlation matrix

3a This type of question is not really a Julia discourse question, bc it is not using Julia.
Stack overflow & other forums are great for math & these types of questions.
3b This question is about material one learns in a class on probability/statistics & can be answered w/ a google search

OK, so it’s the same as a croll tab. I know how to do a cross tabulation in Julia.

1 Like

Check out this post:

Ok, I can go over that again. I usually post things like that in stack overflow, but with all going on, it’s hard to get to, and it’s a simple question. Also I thought I remembered how to do cross tabs in Julia, but now I can’t remember, and I’m not sure of a package that does it.