Pearson correlation

Should the sample size n be equal when we are looking for simple correlation? I mean is it OK if variable 1 has a little more or fewer observations than variable 2? I am computing correlation between two variables...the n of one is a little higher than the n of other!

I am looking for correlation between 2 scales (psy tests). The n of one is a little higher than the n of another. I mean not ALL the respondents who filled up one form (scale) have filled up the other. There are some (very few though) missing.

• Correlation only makes sense if values are paired. If one or more of your values in sample 1 is not paired with a value in sample 2, then those values can't be used in a correlation. Most of all, if no values are paired, correlation does not apply. Oct 18, 2013 at 11:11
• @Tania, you have one sample, two variables. Oct 18, 2013 at 11:14
• Yes Nick! I am looking for correlation between 2 scales (psy tests). The n of one is a little higher than the n of another. I mean not ALL the respondents who filled up one form (scale) have filled up the other. There are some (very few though) missing... Oct 18, 2013 at 11:23
• So, you can't use any cases (observations, records) with missing values. Your software should take care of that somehow. (Depending on quite what your scale is, correlation might not be best, but that's another story.) Oct 18, 2013 at 11:29
• Sorry, but I am at a loss to know what you did that needs correcting. No statistical software worthy of the name will calculate a correlation from differing numbers of values for the two variables. Perhaps you should show us what commands you used and what output you got. Oct 18, 2013 at 12:23

Yes, kind of...

Yes, it is "fine." See this 10-case example, where case 5 and case 7 both have a missing:

Now, look at their correlation outcome, there are only 8 cases participating.

The reason is that Pearson's correlation requires the covariance between $x1$ and $x2$ to be calculated. If either one has a missing, there will be no covariance resulted, and the case is thrown out.

Now, to further illustrate, let us use select case to filter out the two cases:

And rerun the correlation again, the results are identical. This exclusion does not just happen to system missing, if you have assigned a user-defined missing, the case with that user-defined missing will also be excluded.

But wait...!

I said that it's "fine" because it's true that SPSS does screen out incomplete cases for you. But it is in no way solving the missing phenomenon for you. If there is any systematic reason that causes your participants to not answer a certain question, you correlation coefficient can be wrong. However, if you feel that they missed the answer in a random manner, then your correlation shouldn't be heavily affected, though you may lose some sample size and consequently power.

Q: But - I ask you - please tell Tania about pairwise and listwise deletion of missings and under what button it is found in SPSS -- ttnphns

A: Certainly. It would be necessary to illustrate with another example in which we have a new candidate, $x3$:

SPSS correlation analysis uses pairwise deletion by default, which means it'd always maximize the number of case in each of the pairwise comparisons. We have learned from above that the correlation between $x1$ and $x2$ has a sample size of 8 pairs. What about $x1$ and $x3$?

Turned out, it's 9 because maximally there are 9 pairs of data. Now, this can get inconvenient if you'd like to screen off the whole case and prevent it from being analyzed. In that case, you'll use list-wise deletion.

To call the option up, in the Correlation menu, press Option and then check Exclude cases listwise, then press Continute and OK to submit the test again:

Now let's run the correlation matrix again, you'll notice that all sample sizes are unified to 8; only cases that provide data to all the three variables are retained. Visit this IBM FAQ if you'd like to learn more about the two types of deletion.

• Very nice snapshots, gladden the eye! And the explanation. But - I ask you - please tell @Tania about pairwise and listwise deletion of missings and under what button it is found in SPSS. Oct 18, 2013 at 14:29
• @ttnphns, no problem. Revised. Oct 18, 2013 at 14:50
• Excellent (yes, really). Those shades, too... I feel like dragging it all to Flickr photostream. Oct 18, 2013 at 14:56
• @ttnphns, you're too kind. I use a screen capture software called Snagit to do capture and post-capture touch up (like adding circles and arrows.) It also makes screen video, too. Pretty handy. (Disclaimer: I am not affiliate with this software's maker.) Oct 18, 2013 at 15:02
• A THOUSAND thanks @Penguin_Knight!!! You are just amazing...you have saved my life:-) I wish ALL teachers/ mentors are like you! And look at these beautiful & amazing snapshots. Awesome... Oct 18, 2013 at 16:14