<p>This question does not have a definite answer. Rather, the answer depends heavily on the assumptions you wish to make regarding your data.</p>

<p>Given a pair of random variables <span class="math-container">$x$</span> and <span class="math-container">$y$</span>, Pearson's rho has a value of
1 when there is a linear relationship between <span class="math-container">$x$</span>; i.e. <span class="math-container">$y = x\beta + c$</span>, where <span class="math-container">$c$</span> is a constant, and there is no noise. 
Note that the slope, <span class="math-container">$\beta$</span>, and intercept, <span class="math-container">$c$</span>, of this relationship
do not affect the correlation coefficient. With Spearman's rho, we first compute the rank
of each element in <span class="math-container">$x$</span> and <span class="math-container">$y$</span>. We then calculate the Pearson correlation between
these ranks.</p>

<p>Kendall's tau correlation coefficient also deals with the ranks of <span class="math-container">$x$</span> and <span class="math-container">$y$</span>,
but is slightly more complex. The most relevant difference in this case is likely
that tau is better in the case of ties, and may be more robust for low sample sizes.
In most cases, Kendall's and Spearman's are likely to give very similar results</p>

<p>If you wish to assess only linear relationships between expression profiles, 
Pearson's is the most appropriate. If you wish to allow for non-linear effects,
Spearman or Kendall is most appropriate (Kendall if the data contains ties).</p>

CC BY-SA 4.0
2019-10-17T16:04:06.643Z
2019-10-17T16:04:06.643Z
alan ocallaghan
<p>Disclaimer: This is not a complete answer but more a comment, posting as an answer because of character restrictions for comments. Also, I am not a statistican but a molecular biologist who did quite some reading/courses on stats.</p>

<p>Two scRNA-seq tools, namely <code>SingleR</code> and <code>RCA</code> (Reference Component Analysis, Li et. al, 2017) compute correlations of bulk transcriptomic data to single cells; for this they use <code>Spearman correlation</code> and <code>Pearson correlation</code> respectively (The two tools use the same bulk transcriptome reference). I am using these two tools for different purposes so I did not really compare their results, however, single cell clusters that I compute using the <code>reference components</code> (calcuated with <code>RCA</code>) is in good agreement with single cells labels computed with <code>RCA</code> (adjusted rand index of 0.81).</p>

<p>In addition to that, please take a look at <a href="https://academic.oup.com/bioinformatics/advance-article/doi/10.1093/bioinformatics/btz292/5480299" rel="nofollow noreferrer">scMatch: a single-cell gene expression profile annotation tool using reference datasets</a>, they claim (scMatch computes bulk - single cell correlations like SingleR and RCA):</p>

<blockquote>
  <p>From this comparison we found Spearman’s correlation coefficient
  outperformed Pearson’s correlation for all six libraries.</p>
</blockquote>

CC BY-SA 4.0
2019-10-13T18:51:35.317Z
2019-10-13T19:19:37.490Z
2019-10-13T19:19:37.490Z
haci
<p>Pearson correlation evaluates two continuous variables. Spearman correlation is often used to evaluate ordinal variables. Kendall correlation is a nonparametric test for two continuous variables.</p>

CC BY-SA 4.0
2019-11-24T22:00:04.947Z
2019-11-24T22:00:04.947Z
FPS
<p>I'm analyzing single cell rna-seq data and trying to compute the correlation score between different clusters. Wondering how to choose the correlation method("pearson" (default), "kendall", or "spearman") of the Cor function?</p>

<p>I'm a new comer in bioinformatics and know little about these arithmetics. Can anyone give me some advice or show me the code to decide which method to choose for my data matrix?</p>

<p>Below is my gene expression matrix: rows are gene names,and columns are clusters.I use the default Peasrson method to do analysis,but I really don't know if it is right.
<a href="https://user-images.githubusercontent.com/30619010/66716137-313b7600-edfd-11e9-810b-5bf7e58959ff.png" rel="nofollow noreferrer"><img src="https://user-images.githubusercontent.com/30619010/66716137-313b7600-edfd-11e9-810b-5bf7e58959ff.png" alt="my data matrix"></a></p>

<pre><code>CorOb.cor.exp &lt;- as.data.frame(cor(CorOb.av.exp))
CorOb.cor.exp<span class="math-container">$x &lt;- rownames(CorOb.cor.exp)
neupeptide.cor.df &lt;- tidyr::gather(data = CorOb.cor.exp, y, correlation,CorOb.cor.exp$</span>x)
a &lt;- ggplot(neupeptide.cor.df, aes(x, y, fill = correlation)) + geom_raster()+scale_fill_gradientn(colors = c("blue", "white", "red"))+ 
  theme(axis.text.x = element_text(angle = 45, vjust = 1, 
                                   size = 12, hjust = 1))+
  coord_fixed()
</code></pre>

<p>a</p>

CC BY-SA 4.0
2019-10-14T11:41:52.003Z
Cross-posted: https://github.com/satijalab/seurat/issues/2198
haci
CC BY-SA 4.0
2019-10-17T15:47:46.447Z
I don't think github issues are the best place to ask for general help such as this.
alan ocallaghan
<r><rna-seq><scrnaseq><seurat><single-cell>
Which correlation method to compute the correlation score between different clusters of Sc-RNAseq data?
# Which correlation method to compute the correlation score between different clusters of Sc-RNAseq data?

(Asked by: username_0 on 2019-10-13)

I'm analyzing single cell rna-seq data and trying to compute the correlation score between different clusters. Wondering how to choose the correlation method("pearson" (default), "kendall", or "spearman") of the Cor function?
I'm a new comer in bioinformatics and know little about these arithmetics. Can anyone give me some advice or show me the code to decide which method to choose for my data matrix?
Below is my gene expression matrix: rows are gene names,and columns are clusters.I use the default Peasrson method to do analysis,but I really don't know if it is right.

CorOb.cor.exp <- as.data.frame(cor(CorOb.av.exp))
CorOb.cor.exp$x <- rownames(CorOb.cor.exp)
neupeptide.cor.df <- tidyr::gather(data = CorOb.cor.exp, y, correlation,CorOb.cor.exp$x)
a <- ggplot(neupeptide.cor.df, aes(x, y, fill = correlation)) + geom_raster()+scale_fill_gradientn(colors = c("blue", "white", "red"))+ 
  theme(axis.text.x = element_text(angle = 45, vjust = 1, 
                                   size = 12, hjust = 1))+
  coord_fixed()

a

**Tags:** r, rna-seq, scrnaseq, seurat, single-cell
> **Comments:**
> **username_1**: Cross-posted: https://github.com/satijalab/seurat/issues/2198  
> **username_2**: I don't think github issues are the best place to ask for general help such as this.  

---

## 3 answers

### Answer by username_2 on 2019-10-17. Score: 1

This question does not have a definite answer. Rather, the answer depends heavily on the assumptions you wish to make regarding your data.

Given a pair of random variables $x$ and $y$, Pearson's rho has a value of
1 when there is a linear relationship between $x$; i.e. $y = x\beta + c$, where $c$ is a constant, and there is no noise.
Note that the slope, $\beta$, and intercept, $c$, of this relationship
do not affect the correlation coefficient. With Spearman's rho, we first compute the rank
of each element in $x$ and $y$. We then calculate the Pearson correlation between
these ranks.

Kendall's tau correlation coefficient also deals with the ranks of $x$ and $y$,
but is slightly more complex. The most relevant difference in this case is likely
that tau is better in the case of ties, and may be more robust for low sample sizes.
In most cases, Kendall's and Spearman's are likely to give very similar results

If you wish to assess only linear relationships between expression profiles,
Pearson's is the most appropriate. If you wish to allow for non-linear effects,
Spearman or Kendall is most appropriate (Kendall if the data contains ties).


---

### Answer by username_1 on 2019-10-13. Score: 1

Disclaimer: This is not a complete answer but more a comment, posting as an answer because of character restrictions for comments. Also, I am not a statistican but a molecular biologist who did quite some reading/courses on stats.

Two scRNA-seq tools, namely `SingleR` and `RCA` (Reference Component Analysis, Li et. al, 2017) compute correlations of bulk transcriptomic data to single cells; for this they use `Spearman correlation` and `Pearson correlation` respectively (The two tools use the same bulk transcriptome reference). I am using these two tools for different purposes so I did not really compare their results, however, single cell clusters that I compute using the `reference components` (calcuated with `RCA`) is in good agreement with single cells labels computed with `RCA` (adjusted rand index of 0.81).

In addition to that, please take a look at [scMatch: a single-cell gene expression profile annotation tool using reference datasets](https://academic.oup.com/bioinformatics/advance-article/doi/10.1093/bioinformatics/btz292/5480299), they claim (scMatch computes bulk - single cell correlations like SingleR and RCA):

> From this comparison we found Spearman’s correlation coefficient
> outperformed Pearson’s correlation for all six libraries.


---

### Answer by username_3 on 2019-11-24. Score: 0

Pearson correlation evaluates two continuous variables. Spearman correlation is often used to evaluate ordinal variables. Kendall correlation is a nonparametric test for two continuous variables.


---

