# Identify sub-dimension correlation between 2 variables

If we have two variables A={20 values} and B={20 values} and we want to measure the correlation between these two variables. Lets assume that the first n values are highly correlated but the remaining m values are not correlated. The overall correlation between A and B may not represent the importance of the relationship. Imagine that there is only weak correlation in some values, but several values show really good correspondence between A and B. Traditional correlation coefficients will not capture such relationship. Is there any measure or statistical method that can detect such relationship between A and B?

This question appears to entertain a methodological misunderstanding. Correlation is a theoretical dimensionless measure of linear association between two random variables, and it depends on their covariance and their variances. There is no such thing as "correlation of values" (i.e. of realizations) of random variables. Only the random variables themselves correlate or not. Moreover, in order to estimate the existence and magnitude of correlation from a set of data, we have to make certain assumptions. The main assumption is that each realizations-series we have at hand comes from the same random variable, or at least, from identically distributed random variables.

Assume now that we have two such series that we know that come each from r.v. $A$ and r.v. $B$, each of size $n$, which we denote $\{a_1,...,a_n\}$ and $\{b_1,...,b_n\}$. We then break each series in two pieces, with sizes $m+k=n$.

You observed that

$$\operatorname{Corr}\left(\{a_1,...,a_m\},\{b_1,...,b_m\} \right) \approx 0$$ while

$$\operatorname{Corr}\left(\{a_{m+1},...,a_n\},\{b_{m+1},...,b_n\} \right) \neq 0$$

What does that tell us? That probably the full sample of $A$ and/or of $B$ realizations does not really come each from the same or from identical random variables. This conclusion holds irrespective of whether your data is cross-sectional or time-series.
This does not mean that each realization does not come from the same real world phenomenon. For a cross sectional example, say $A$ represents "household income". We do not contradict that, but we find evidence that not all household incomes have the same distribution, if viewed as random variables. Analogously for a time-series, say r.v. $A$ is Gross Domestic Product. In such a case, it means that this real-world phenomenon at some point in time has changed distribution (and so in mathematical terms, it is no longer the same random variable)...

OR, that the $B$-sample does not really come from the same distribution.

• Thanks @Alecos for the detailed reply (+1). The problem is that the realization-series of n values in each A and B variables belong to H categories. For example, we have 20 samples belong to 5 categories (4 samples per category) so we we have 20 values in each of A and B. We want to know if the realization series from 1 ore more categories will yield that A and B are have linear association. (One may suggest that we study correlation on each category independently. Actually, 4 values may not bring statistically significant correlation score). – Abbas Dec 21 '13 at 19:36
• Assume that each sub-sample had enough realizations to be considered reliable for inference. Assume further that just one sub-sample from the A-series showed strong correlation with just one sub-sample from the B-series. To then say that "A & B have linear association" would not be valid. You would have to qualify your conclusion saying that only a sub-sample of A showed correlation with only a sub-sample of B, and try to make sense of that, and whether it is meaningful in the context of the phenomenon you are investigating. – Alecos Papadopoulos Dec 21 '13 at 19:53
• Indeed!. the interesting cases for our study will be those that show sub-sample correlation, as we will perform further experimental investigation for the difference between the different categories. It seems for me now that clustering that is suggested by @dmartin is the only feasible way to achieve that. (because correlation between few dimensions will not give statically significant scores). – Abbas Dec 21 '13 at 19:59

If I'm understanding your question correctly, two possibilities spring to mind:

1) Multivariate adaptive regression splines. In a simple case, it models a piecewise regression slope that looks like a V. Take a look at this image. In this example, the correlation between x and y is smaller in magnitude from $8 \le x \le 14$, but magnitude is much larger when $x > 14$.

2) If you think the sub-dimensions are theoretically meaningful, like two homogeneous sub-populations within your sample, then clustering might also be something worthwhile to pursue.

• Thanks @dmartin for the useful suggestions. Indeed!. the sub-dimensions are theoretically meaningful. From total of N dimensions, there are M groups such that each group is represented by K dimensions (N=M*K dimensions). I like the clustering idea, but, I am thinking how to identify if at least 1 cluster show high homogeneity between B and A for a specific group. Do I need to measure the clustering purity measures like (davies bouldin and dunn index) shall I measure them when comparing a cluster versus all others and do that for all clusters then select max value. Any other suggestions? – Abbas Dec 21 '13 at 19:01
• For the MARS, it may work. But, I am not sure how I can convert the obtained equation to a correlation-like score. – Abbas Dec 21 '13 at 19:02
• When clustering, you might want to compare the 1 cluster to the 2 cluster using something like the gap index (for k-means) or BIC (for a mixture model). In the case of MARS, you can figure out the split point using that method, then manually calculate the correlations when you split the groups into two. Regardless, N = 20 so there is not too much you can do. – dmartin Dec 21 '13 at 19:52