# What correlation coefficient and graph is appropriate with this data?

I'm not in Statistics field. I conducted the case study and collected the data as shown below I have data as shown in the table below:

I would like to find correlation coefficient from this two table data(between NOA and HVOC, and between NOA and HVOL). I conducted the case study with the source code.

I measured software metrics named "NOA" and "HVOL" for all the method/function before I modified this source code. And then, after I modified the code, I again measureed the same metrics for all the method.

NOA Diff field in the table is calculated from NOA (after modifying the code) minus NOA (before modifying the code). That is "NOA Diff = NOA(after)-NOA(before)". The same way was applied to HVOC metric; HVOC Diff = HVOC(after)-HVOC(before)

My questions are

• What type of correlation coefficient should I use?
• What kind of graph should I create to illustrate my data?
• The table above is all data, i mean it's population not a sample, can I use the method that is used with a sample
• Is Spearman is for non normally distributed data?
• @BB01, the answer depends heavily on what do your values represent, i.e. what does -1 mean for example. Since your data is discrete you should use Spearman rank correlation coefficient or its alternatives. For the graph, again the answer depends on details of your study. Mar 7, 2011 at 8:21
• @mpiktas You're probably correct in recommending a rank correlation coefficient but, IMHO, not for the reason given. After all, Pearson (product-moment) correlations are computable and interpretable with discrete data. (Ultimately all data are "discrete" anyway when represented numerically.) Rank correlations won't resolve the many ties in values, either. Your request for more details is spot on: the purpose of the study (and the nature of the data generation process) are critical determinants of the statistical (and graphical) procedures to use for data analysis.
– whuber
Mar 13, 2011 at 17:56
• @whuber, I must admit that my recommendation for using Spearman correlation came from some old drill: if data is discrete, use Spearman correlation. After reading the wikipedia page I now have trouble remembering why this particular advice stuck in my mind. My main intention in writing comment was to ask for more information and throw something alternative for the OP to think about. I must be careful what I throw. Mar 13, 2011 at 19:16
• @BB01 I doubt these are data for a "population." They appear to be measurements of some process and therefore constitute a finite sample of that process. If you aim is to draw conclusions about the process--or to generalize anything from the data--you must treat these data as a sample.
– whuber
Mar 19, 2011 at 4:51

To echo everyone else: MORE DETAILS ABOUT YOUR DATA. Please give a qualitative description of what your independent and dependent variable(s) is/are.

EDIT: Yes this is confusing; hopefully it's cleared up now.

In general, you probably want to avoid using sample statistics to estimate population parameters if you have the population data. This is because sample statistics are estimates of population parameters, thus the methods used to compute sample statistics always have less power than those same methods in their population parameter version(s). Of course, most of the time you have to use sample statistics because you don't have complete population data.

In your case either way you slice it inferring anything about a population from a case study is dubious because case studies are, by definition, case by case. You could make an inference about the case on which you collected data, but how useful is that? Maybe in your case it is.

Either way, forget about whether or not you can/should use a sample method when you have the population data. You don't have population data if it's a case study. Also, sample vs. population has to do with making inferences. You do not need to worry about sample vs. population methods if all you want is a correlation coefficient, because it is a purely descriptive statistic.

Your fourth bullet point is completely unintelligible. Please clear that up if you would like people to help you with it.

@mpiktas A Spearman rank correlation is NOT the proper correlation coefficient to use here. To use that test all data must be ranked and discrete (unless >= 2 values compete for a rank), i.e., they must be ordinal data. Maybe the HVOC table could be analyzed via Spearman's $\rho$, however more information must be provided by the poster to make that conclusion.

@whuber Yes all data are discrete when represented on a computer, however in this case it seems like what BB01 was referring to was the scale of measurement, not the electronic representation of numbers.

• (1) The Spearman (rank) correlation can be computed just fine even with non-discrete data. (2) My point about machine numbers was that viewing data as discrete or not is a modeling decision, whence it is unwise to base one's statistical judgment solely on whether, for some other purpose, the data have been considered discrete. (3) Your second paragraph is difficult to follow because you seem to be advising against the use of sample statistics to make any estimates at all. (It's unlikely the OP has a complete census anyway.)
– whuber
Mar 19, 2011 at 4:56
• @whuber Yes of course Spearman's $\rho$ can be computed with continuous data. I didn't think that was in question.I'd have a really hard time believing that someone could make a more meaningful inference with continuous data using a rank correlation than they could with a plain old Pearson's $r$. Mar 21, 2011 at 3:38

What kind of graph should I create to illustrate my data?

I would use a scatterplot - it would give you an idea about the type of relationship between the data. It is important to identify if the relationship is linear or not, before calculating correlation between the measurements.