I'm trying to understand whether the number of words used to title a problem are related to the time used to solve that problem. In order to do this, I have derived two vectors from my data-set, one vector contains values from 1 to 7 representing the number of words used to described a problem, the other vector contains the average time values of all the problems defined with a given number of words.

words                    1     2     3     4      5    6     7
avg.time to solve (hrs) 450.3 510.1 560.2 631.9 720.4 706.6 690.8

Can I calculate the correlation between the number of words and the average values using the Spearman's rho? Is it correct?

Any reference is welcome

  • 1
    $\begingroup$ "number of words" would appear to be a count (seemingly at least interval, possibly ratio), rather than ordinal. $\endgroup$ – Glen_b Jan 13 '15 at 11:55
  • 3
    $\begingroup$ Agree with @Glen_b here, the 'number of words' variable is clearly not just ordinal given that 4 words really are twice as many words as 2 words. You may want to be more precise and just model the number of characters and the associated answers without taking averages and then (assuming a linear relationship, although this can be tested), you could use the more classic Pearson's and be more accurate with your proposed relationship. That said, Spearman's rho is a perfectly acceptable method here too. $\endgroup$ – Mensen Jan 13 '15 at 12:09
  • $\begingroup$ thanks for answering. However I don't understand the threats about calculating the correlation on average values, could you explain me a bit more why is better to avoid working with average values? $\endgroup$ – user2314405 Jan 13 '15 at 12:18
  • 2
    $\begingroup$ A relevant question is when the mean is a poor summary statistic of a given sample. For example, mean may be of limited use if the distribution is skewed. Also, even if the distribution is perfectly symmetric, using all observation in place of means would yield a different answer; the observations far away from the mean would have a larger effective weight than those close to the mean. But if you want to check the strength of linear relationship between $words$ and $avg.time$ you may actually prefer just means (and thus in a way equal weights within each group) over all observations. $\endgroup$ – Richard Hardy Jan 13 '15 at 14:18
  • $\begingroup$ The n of each average would be relevant to know here ... $\endgroup$ – kjetil b halvorsen Oct 16 '20 at 15:49

For the reason stated by Glen_b and others, using the Pearson product-moment correlation coefficient is better than the Spearman's rho. The Pearson will use more of the information in your data and so give you a better estimate of the size of the correlation. It will give you a better test of the statistical significance, should you choose to do such a test. Any basic statistics textbook will show how to do the calculations. You can also do the calculations in a spreadsheet. If you use a spreadsheet, I suggest you replicate one or more examples in a textbook to be sure you are using the correct formula correctly.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.