Skip to main content
edited body
Source Link
Rob Hall
  • 1.3k
  • 1
  • 9
  • 24

If x and xy are each independent of z, x/y and z will also be independent. So observing a significant correlation between x/y and z is an indication that there is some genuine association between the two.

You can see an example of this by recreating the example in the Wikipedia article you linked for your setting in R (or a similar program):

n <- 1000
x <- rnorm(n, mean = 10, sd = 1)
y <- rnorm(n, mean = 10, sd = 1)
z <- rnorm(n, mean = 10, sd = 1)
plot(x/y, z)
cor(x/y, z, method = "spearman")
cor.test(x/y, z, alternative = "two.sided", method = "spearman")

For 1000 observations, I arrive at a Spearman correlation of -0.035 and a pretty unimpressive p-value of 0.269. You can also use a Pearson correlation (-0.031, p=0.321 for my simulation), but be careful not to produce outliers in your x/y by choosing sensible means and variances. As you can see, in this setting both correlations are close to 0, whereas in the example you linked the Pearson correlation was 0.53, which is pretty far away from 0.

Edit: x and y need not be independent for this to work, we just need that x and y are each independent of z (and hence x/y is independent of z). Changing the example from above so that there is quite a strong association between x and y:

n <- 1000
x <- rnorm(n, mean = 10, sd = 1)
y <- x + 1 + rnorm(n, mean = 1, sd = 1) ## create some dependence on x, maybe add random noise
cor(x, y, method = "spearman")
cor.test(x, y, alternative = "two.sided", method = "spearman")
cor(x, y, method = "pearson")
cor.test(x, y, alternative = "two.sided", method = "pearson")


z <- rnorm(n, mean = 10, sd = 1)
plot(x/y, z)
cor(x/y, z, method = "spearman")
cor.test(x/y, z, alternative = "two.sided", method = "spearman")
cor(x/y, z, method = "pearson")
cor.test(x/y, z, alternative = "two.sided", method = "pearson")

We see a strong relationship between x and y in this example (Pearson=0.729, p<2.2e-16; Spearman=0.709, p<2.2e-16), but no relationship between x/y and z (Pearson=0.036, p=0.252; Spearman=0.026, p=0.396).

If x and x are each independent of z, x/y and z will also be independent. So observing a significant correlation between x/y and z is an indication that there is some genuine association between the two.

You can see an example of this by recreating the example in the Wikipedia article you linked for your setting in R (or a similar program):

n <- 1000
x <- rnorm(n, mean = 10, sd = 1)
y <- rnorm(n, mean = 10, sd = 1)
z <- rnorm(n, mean = 10, sd = 1)
plot(x/y, z)
cor(x/y, z, method = "spearman")
cor.test(x/y, z, alternative = "two.sided", method = "spearman")

For 1000 observations, I arrive at a Spearman correlation of -0.035 and a pretty unimpressive p-value of 0.269. You can also use a Pearson correlation (-0.031, p=0.321 for my simulation), but be careful not to produce outliers in your x/y by choosing sensible means and variances. As you can see, in this setting both correlations are close to 0, whereas in the example you linked the Pearson correlation was 0.53, which is pretty far away from 0.

Edit: x and y need not be independent for this to work, we just need that x and y are each independent of z (and hence x/y is independent of z). Changing the example from above so that there is quite a strong association between x and y:

n <- 1000
x <- rnorm(n, mean = 10, sd = 1)
y <- x + 1 + rnorm(n, mean = 1, sd = 1) ## create some dependence on x, maybe add random noise
cor(x, y, method = "spearman")
cor.test(x, y, alternative = "two.sided", method = "spearman")
cor(x, y, method = "pearson")
cor.test(x, y, alternative = "two.sided", method = "pearson")


z <- rnorm(n, mean = 10, sd = 1)
plot(x/y, z)
cor(x/y, z, method = "spearman")
cor.test(x/y, z, alternative = "two.sided", method = "spearman")
cor(x/y, z, method = "pearson")
cor.test(x/y, z, alternative = "two.sided", method = "pearson")

We see a strong relationship between x and y in this example (Pearson=0.729, p<2.2e-16; Spearman=0.709, p<2.2e-16), but no relationship between x/y and z (Pearson=0.036, p=0.252; Spearman=0.026, p=0.396).

If x and y are each independent of z, x/y and z will also be independent. So observing a significant correlation between x/y and z is an indication that there is some genuine association between the two.

You can see an example of this by recreating the example in the Wikipedia article you linked for your setting in R (or a similar program):

n <- 1000
x <- rnorm(n, mean = 10, sd = 1)
y <- rnorm(n, mean = 10, sd = 1)
z <- rnorm(n, mean = 10, sd = 1)
plot(x/y, z)
cor(x/y, z, method = "spearman")
cor.test(x/y, z, alternative = "two.sided", method = "spearman")

For 1000 observations, I arrive at a Spearman correlation of -0.035 and a pretty unimpressive p-value of 0.269. You can also use a Pearson correlation (-0.031, p=0.321 for my simulation), but be careful not to produce outliers in your x/y by choosing sensible means and variances. As you can see, in this setting both correlations are close to 0, whereas in the example you linked the Pearson correlation was 0.53, which is pretty far away from 0.

Edit: x and y need not be independent for this to work, we just need that x and y are each independent of z (and hence x/y is independent of z). Changing the example from above so that there is quite a strong association between x and y:

n <- 1000
x <- rnorm(n, mean = 10, sd = 1)
y <- x + 1 + rnorm(n, mean = 1, sd = 1) ## create some dependence on x, maybe add random noise
cor(x, y, method = "spearman")
cor.test(x, y, alternative = "two.sided", method = "spearman")
cor(x, y, method = "pearson")
cor.test(x, y, alternative = "two.sided", method = "pearson")


z <- rnorm(n, mean = 10, sd = 1)
plot(x/y, z)
cor(x/y, z, method = "spearman")
cor.test(x/y, z, alternative = "two.sided", method = "spearman")
cor(x/y, z, method = "pearson")
cor.test(x/y, z, alternative = "two.sided", method = "pearson")

We see a strong relationship between x and y in this example (Pearson=0.729, p<2.2e-16; Spearman=0.709, p<2.2e-16), but no relationship between x/y and z (Pearson=0.036, p=0.252; Spearman=0.026, p=0.396).

added 1049 characters in body
Source Link
Rob Hall
  • 1.3k
  • 1
  • 9
  • 24

If x,y and zx are all pairwiseeach independent of z, x/y and z will also be pairwise independent. So observing a significant correlation between x/y and z is an indication that there is some genuine association between the two.

You can see an example of this by recreating the example in the Wikipedia article you linked for your setting in R (or a similar program):

n <- 1000
x <- rnorm(n, mean = 10, sd = 1)
y <- rnorm(n, mean = 10, sd = 1)
z <- rnorm(n, mean = 10, sd = 1)
plot(x/y, z)
cor(x/y, z, method = "spearman")
cor.test(x/y, z, alternative = "two.sided", method = "spearman")

For 1000 observations, I arrive at a Spearman correlation of -0.035 and a pretty unimpressive p-value of 0.269. You can also use a Pearson correlation (-0.031, p=0.321 for my simulation), but be careful not to produce outliers in your x/y by choosing sensible means and variances. As you can see, in this setting both correlations are close to 0, whereas in the example you linked the Pearson correlation was 0.53, which is pretty far away from 0.

Edit: x and y need not be independent for this to work, we just need that x and y are each independent of z (and hence x/y is independent of z). Changing the example from above so that there is quite a strong association between x and y:

n <- 1000
x <- rnorm(n, mean = 10, sd = 1)
y <- x + 1 + rnorm(n, mean = 1, sd = 1) ## create some dependence on x, maybe add random noise
cor(x, y, method = "spearman")
cor.test(x, y, alternative = "two.sided", method = "spearman")
cor(x, y, method = "pearson")
cor.test(x, y, alternative = "two.sided", method = "pearson")


z <- rnorm(n, mean = 10, sd = 1)
plot(x/y, z)
cor(x/y, z, method = "spearman")
cor.test(x/y, z, alternative = "two.sided", method = "spearman")
cor(x/y, z, method = "pearson")
cor.test(x/y, z, alternative = "two.sided", method = "pearson")

We see a strong relationship between x and y in this example (Pearson=0.729, p<2.2e-16; Spearman=0.709, p<2.2e-16), but no relationship between x/y and z (Pearson=0.036, p=0.252; Spearman=0.026, p=0.396).

If x,y and z are all pairwise independent, x/y and z will also be pairwise independent. So observing a significant correlation between x/y and z is an indication that there is some genuine association between the two.

You can see an example of this by recreating the example in the Wikipedia article you linked for your setting in R (or a similar program):

n <- 1000
x <- rnorm(n, mean = 10, sd = 1)
y <- rnorm(n, mean = 10, sd = 1)
z <- rnorm(n, mean = 10, sd = 1)
plot(x/y, z)
cor(x/y, z, method = "spearman")
cor.test(x/y, z, alternative = "two.sided", method = "spearman")

For 1000 observations, I arrive at a Spearman correlation of -0.035 and a pretty unimpressive p-value of 0.269. You can also use a Pearson correlation (-0.031, p=0.321 for my simulation), but be careful not to produce outliers in your x/y by choosing sensible means and variances. As you can see, in this setting both correlations are close to 0, whereas in the example you linked the Pearson correlation was 0.53, which is pretty far away from 0.

Edit: x and y need not be independent for this to work, we just need that x and y are each independent of z (and hence x/y is independent of z). Changing the example from above so that there is quite a strong association between x and y:

n <- 1000
x <- rnorm(n, mean = 10, sd = 1)
y <- x + 1 + rnorm(n, mean = 1, sd = 1) ## create some dependence on x, maybe add random noise
cor(x, y, method = "spearman")
cor.test(x, y, alternative = "two.sided", method = "spearman")
cor(x, y, method = "pearson")
cor.test(x, y, alternative = "two.sided", method = "pearson")


z <- rnorm(n, mean = 10, sd = 1)
plot(x/y, z)
cor(x/y, z, method = "spearman")
cor.test(x/y, z, alternative = "two.sided", method = "spearman")
cor(x/y, z, method = "pearson")
cor.test(x/y, z, alternative = "two.sided", method = "pearson")

We see a strong relationship between x and y in this example (Pearson=0.729, p<2.2e-16; Spearman=0.709, p<2.2e-16), but no relationship between x/y and z (Pearson=0.036, p=0.252; Spearman=0.026, p=0.396).

If x and x are each independent of z, x/y and z will also be independent. So observing a significant correlation between x/y and z is an indication that there is some genuine association between the two.

You can see an example of this by recreating the example in the Wikipedia article you linked for your setting in R (or a similar program):

n <- 1000
x <- rnorm(n, mean = 10, sd = 1)
y <- rnorm(n, mean = 10, sd = 1)
z <- rnorm(n, mean = 10, sd = 1)
plot(x/y, z)
cor(x/y, z, method = "spearman")
cor.test(x/y, z, alternative = "two.sided", method = "spearman")

For 1000 observations, I arrive at a Spearman correlation of -0.035 and a pretty unimpressive p-value of 0.269. You can also use a Pearson correlation (-0.031, p=0.321 for my simulation), but be careful not to produce outliers in your x/y by choosing sensible means and variances. As you can see, in this setting both correlations are close to 0, whereas in the example you linked the Pearson correlation was 0.53, which is pretty far away from 0.

Edit: x and y need not be independent for this to work, we just need that x and y are each independent of z (and hence x/y is independent of z). Changing the example from above so that there is quite a strong association between x and y:

n <- 1000
x <- rnorm(n, mean = 10, sd = 1)
y <- x + 1 + rnorm(n, mean = 1, sd = 1) ## create some dependence on x, maybe add random noise
cor(x, y, method = "spearman")
cor.test(x, y, alternative = "two.sided", method = "spearman")
cor(x, y, method = "pearson")
cor.test(x, y, alternative = "two.sided", method = "pearson")


z <- rnorm(n, mean = 10, sd = 1)
plot(x/y, z)
cor(x/y, z, method = "spearman")
cor.test(x/y, z, alternative = "two.sided", method = "spearman")
cor(x/y, z, method = "pearson")
cor.test(x/y, z, alternative = "two.sided", method = "pearson")

We see a strong relationship between x and y in this example (Pearson=0.729, p<2.2e-16; Spearman=0.709, p<2.2e-16), but no relationship between x/y and z (Pearson=0.036, p=0.252; Spearman=0.026, p=0.396).

added 1049 characters in body
Source Link
Rob Hall
  • 1.3k
  • 1
  • 9
  • 24

If x,y and z are all pairwise independent, x/y and z will also be pairwise independent. So observing a significant correlation between x/y and z is an indication that there is some genuine association between the two.

You can see an example of this by recreating the example in the Wikipedia article you linked for your setting in R (or a similar program):

n <- 1000
x <- rnorm(n, mean = 10, sd = 1)
y <- rnorm(n, mean = 10, sd = 1)
z <- rnorm(n, mean = 10, sd = 1)
plot(x/y, z)
cor(x/y, z, method = "spearman")
cor.test(x/y, z, alternative = "two.sided", method = "spearman")

For 1000 observations, I arrive at a Spearman correlation of -0.035 and a pretty unimpressive p-value of 0.269. You can also use a Pearson correlation (-0.031, p=0.321 for my simulation), but be careful not to produce outliers in your x/y by choosing sensible means and variances. As you can see, in this setting both correlations are close to 0, whereas in the example you linked the Pearson correlation was 0.53, which is pretty far away from 0.

Edit: x and y need not be independent for this to work, we just need that x and y are each independent of z (and hence x/y is independent of z). Changing the example from above so that there is quite a strong association between x and y:

n <- 1000
x <- rnorm(n, mean = 10, sd = 1)
y <- x + 1 + rnorm(n, mean = 1, sd = 1) ## create some dependence on x, maybe add random noise
cor(x, y, method = "spearman")
cor.test(x, y, alternative = "two.sided", method = "spearman")
cor(x, y, method = "pearson")
cor.test(x, y, alternative = "two.sided", method = "pearson")


z <- rnorm(n, mean = 10, sd = 1)
plot(x/y, z)
cor(x/y, z, method = "spearman")
cor.test(x/y, z, alternative = "two.sided", method = "spearman")
cor(x/y, z, method = "pearson")
cor.test(x/y, z, alternative = "two.sided", method = "pearson")

We see a strong relationship between x and y in this example (Pearson=0.729, p<2.2e-16; Spearman=0.709, p<2.2e-16), but no relationship between x/y and z (Pearson=0.036, p=0.252; Spearman=0.026, p=0.396).

If x,y and z are all pairwise independent, x/y and z will also be pairwise independent. So observing a significant correlation between x/y and z is an indication that there is some genuine association between the two.

You can see an example of this by recreating the example in the Wikipedia article you linked for your setting in R (or a similar program):

n <- 1000
x <- rnorm(n, mean = 10, sd = 1)
y <- rnorm(n, mean = 10, sd = 1)
z <- rnorm(n, mean = 10, sd = 1)
plot(x/y, z)
cor(x/y, z, method = "spearman")
cor.test(x/y, z, alternative = "two.sided", method = "spearman")

For 1000 observations, I arrive at a Spearman correlation of -0.035 and a pretty unimpressive p-value of 0.269. You can also use a Pearson correlation (-0.031, p=0.321 for my simulation), but be careful not to produce outliers in your x/y by choosing sensible means and variances. As you can see, in this setting both correlations are close to 0, whereas in the example you linked the Pearson correlation was 0.53, which is pretty far away from 0.

If x,y and z are all pairwise independent, x/y and z will also be pairwise independent. So observing a significant correlation between x/y and z is an indication that there is some genuine association between the two.

You can see an example of this by recreating the example in the Wikipedia article you linked for your setting in R (or a similar program):

n <- 1000
x <- rnorm(n, mean = 10, sd = 1)
y <- rnorm(n, mean = 10, sd = 1)
z <- rnorm(n, mean = 10, sd = 1)
plot(x/y, z)
cor(x/y, z, method = "spearman")
cor.test(x/y, z, alternative = "two.sided", method = "spearman")

For 1000 observations, I arrive at a Spearman correlation of -0.035 and a pretty unimpressive p-value of 0.269. You can also use a Pearson correlation (-0.031, p=0.321 for my simulation), but be careful not to produce outliers in your x/y by choosing sensible means and variances. As you can see, in this setting both correlations are close to 0, whereas in the example you linked the Pearson correlation was 0.53, which is pretty far away from 0.

Edit: x and y need not be independent for this to work, we just need that x and y are each independent of z (and hence x/y is independent of z). Changing the example from above so that there is quite a strong association between x and y:

n <- 1000
x <- rnorm(n, mean = 10, sd = 1)
y <- x + 1 + rnorm(n, mean = 1, sd = 1) ## create some dependence on x, maybe add random noise
cor(x, y, method = "spearman")
cor.test(x, y, alternative = "two.sided", method = "spearman")
cor(x, y, method = "pearson")
cor.test(x, y, alternative = "two.sided", method = "pearson")


z <- rnorm(n, mean = 10, sd = 1)
plot(x/y, z)
cor(x/y, z, method = "spearman")
cor.test(x/y, z, alternative = "two.sided", method = "spearman")
cor(x/y, z, method = "pearson")
cor.test(x/y, z, alternative = "two.sided", method = "pearson")

We see a strong relationship between x and y in this example (Pearson=0.729, p<2.2e-16; Spearman=0.709, p<2.2e-16), but no relationship between x/y and z (Pearson=0.036, p=0.252; Spearman=0.026, p=0.396).

added 133 characters in body
Source Link
Rob Hall
  • 1.3k
  • 1
  • 9
  • 24
Loading
Source Link
Rob Hall
  • 1.3k
  • 1
  • 9
  • 24
Loading