fisher r to z test with different number of observations between variables.

Is there a way to test whether the correlation coefficient between two variables with a shard third variable is significantly different, if the sample sizes are different?

Here is the case, specifically. Variable A and Variable B have the same number of observations, but Variable C has less. I would like to test if Variable B has a significantly different correlation with Variable A, compared to Variable C. A fisher r to z can do this, but only if there is a equal number of observations for all variables. That is not the case here. Is there a similar test that can be done?

Many thanks in advance!

• To compute a correlation coefficient you need paired data. That means having a natural way to pair the data and consequently an equal sample size. If you have unequal sample size but a natural pairing then the data without a pair could be dropped and you can estimate the correlation. – Michael R. Chernick Jul 13 '17 at 3:09

Not a comprehensive answer, but an interesting approach which makes use of existing tools, namely linear regression. First, we must admit that inference on the least squares slope parameter is equivalent to inference on the Pearson correlation coefficient. This is because the least squares inference is location/scale invariant in that the X or Y may be added or multiplied by any constant, and obtain the same $p$-values testing the hypothesis that the slope is equal to 0. In fact, if we center and scale the X and the Y, the least squares slope is the Pearson correlation.

With two independent samples $(X, Y_1)$ of size n and $(Z, Y_2)$ of size m, you can test the hypothesis of $\mathcal{H}_0: \rho(X,Y) = \rho(Z,Y)$ by creating a "long" dataset of size n+m with a grand column $Y = [Y_1, Y_2]$ being the concatenated outcome, a "covariate" column $W = [X, Z]$, and an experiment column $E = [0_n, 1_m]$. Fit a model with $Y$ as the outcome, $W$ and $E$ as predictors and finally the product of $W$ and $E$. If this product term is significant, you can infer that the correlation between $Y$ and $Z$ and $X$ are different.