I have data that looks like this (I am using R):
5 6 7
10 550 168 333
20 390 133 299
30 280 135 255
40 145 100 34
50 130 54 12
The values are the counts of how many observations took on the values represented in the column and row names (values). For example, there were 550
observations that took on 5
of the first variable and 10
of the second variable.
I do not observe the following data, but the above data is constructed from something like the following:
Obs FirstVar SecondVar
1 5 10
2 7 20
3 5 20
4 6 10
5 7 50
...
My question is how to think about and construct (preferably in R) correlation using only the first data. (If we had access to the second data, it would be one line of code - just correlation between FirstVar
and SecondVar
.)