Message Boards Message Boards

0
|
5027 Views
|
4 Replies
|
0 Total Likes
View groups...
Share
Share this post:
GROUPS:

a correlation question

Posted 9 years ago
POSTED BY: Javad Emami
4 Replies
Posted 9 years ago

You can look at simulations (as Eric Rimbey shows) to see that a negative relationship is certainly possible and not unlikely (as Frank Kampas describes logically). Another way is attempting to work out out the appropriate integrals if you're feeling energetic. And one more way is to use a discrete distribution for $X$, $Y$, and $Z$ and just enumerate all of the possibilities followed by the calculation of the correlation coefficient.

Suppose $X$, $Y$, and $Z$ are independent of each other and uniform on the integers 1 through $n$. We can write a function to enumerate the possibilities for (not too large) values on $n$. Below is such a function.

corr[n_] := Module[{t, x, y, z, varyx, varzy, meanyx, meanzy, cov},

  (* Make a table of all possible values of y/x and z/y (and the product of y/x and z/y = z/x *)
  t = Flatten[Table[{y/x, z/y, z/x}, {x, 1, n}, {y, 1, n}, {z, 1, n}], 2];

  (* Calculate mean, variance, and covariance *)
  meanyx = Mean[t[[All, 1]]];
  varyx = Mean[t[[All, 1]]^2] - meanyx^2;
  meanzy = Mean[t[[All, 2]]];
  varzy = Mean[t[[All, 2]]^2] - meanzy^2;
  cov = Mean[t[[All, 3]]] - meanyx*meanzy;

  (* Now calculate correlation coefficient *)
  cov/(varyx^0.5 varzy^0.5)
  ]

(* Plot results for n going from 2 to 100 *)
ListPlot[Table[{i, corr[i]}, {i, 2, 100, 1}], Frame -> True, 
 FrameLabel -> {{"Correlation coefficient", ""}, {"n", ""}}]

Correlation over n

So the answer from this example is "Yes, the correlation can be negative." If you need a more global statement (such as "When the correlation exists for $Y/X$ and $Z/Y$, then the correlation will negative."), then more specifics about $X$, $Y$, and $Z$ will be needed (assuming that statement is true).

POSTED BY: Jim Baldwin
Posted 9 years ago

Agree with Jim that there doesn't seem to be any Mathematica involved in this question. But given some simple types of distributions, it would be easy to prove the statement. Consider if we just looked at Y and 1/Y. Those are clearly negatively correlated.

Here is a visualization using simple uniform distributions.

Comparing X/Y and Y/Z

POSTED BY: Eric Rimbey
POSTED BY: Frank Kampas
Posted 9 years ago
POSTED BY: Jim Baldwin
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract