回答:
はい、それは可能であり、それはあらゆる種類の方法で発生する可能性があります。1つの明白な例は、xとyの値を反映する何らかの方法でAとBのメンバーシップが選択された場合です。他の例も可能です。たとえば、@ Macroのコメントは別の可能性を示唆しています。
Rで記述された以下の例を考えてみます。xとyはiidの標準の通常の変数ですが、xとyの相対値に基づいてそれらをグループに割り当てると、名前が付けられます。グループAとグループB内では、xとyの間に統計的に有意な強い相関がありますが、グループ化構造を無視すると、相関はありません。
> library(ggplot2)
> x <- rnorm(1000)
> y <- rnorm(1000)
> Group <- ifelse(x>y, "A", "B")
> cor.test(x,y)
Pearson's product-moment correlation
data: x and y
t = -0.9832, df = 998, p-value = 0.3257
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
-0.09292 0.03094
sample estimates:
cor
-0.03111
> cor.test(x[Group=="A"], y[Group=="A"])
Pearson's product-moment correlation
data: x[Group == "A"] and y[Group == "A"]
t = 11.93, df = 487, p-value < 2.2e-16
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
0.4040 0.5414
sample estimates:
cor
0.4756
> cor.test(x[Group=="B"], y[Group=="B"])
Pearson's product-moment correlation
data: x[Group == "B"] and y[Group == "B"]
t = 9.974, df = 509, p-value < 2.2e-16
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
0.3292 0.4744
sample estimates:
cor
0.4043
> qplot(x,y, color=Group)